Home | Math Display Experiments | ASCIIsvg-IM.js Demo and Syntax

Page by Murray Bourne, IntMath.com. Last updated: 07 Aug 2016

ASCIIsvg-IM.js Demo and Syntax

ASCIIsvg-IM.js is a lightweight javascript library that produces SVG-based math graphs with plain text function input (e.g. "3sin(5x)", rather than the normal javascript syntax of "3*Math.sin(5*x)").

ASCIIsvg-IM.js is a heavily modified version of Peter Jipsen's ASCIIsvg.js.

It's much smaller than the better-known JSXGraph, which also produces SVG math graphs:

 ASCII​svg-IM.jsJSXGraph
Uncompressed28 KB902 KB
Compressed18 KB535 KB
Gzipped6 KB157 KB

But of course, ASCIIsvg-IM.js is nowhere near as sophisticated or versatile as JSXGraph.

ASCIIsvg-IM.js demo

This page shows what ASCIIsvgIM.js can do and how to do it (the syntax). It is based on some of Peter Jipsen's examples.

Ellipses, squares, arcs and arrows

Here's the coode to produce the above graph.



Equal-scaled axes and plots

Here's the code:



Using a for loop to produce a spiral

The syntax:



Using a for loop to produce a discrete graph



Vectors



Animations

Frame rate: .

The syntax:




Vary parameters using sliders

This uses HTML5 sliders (which are independent of ASCIIsvg-IM.js).

For the graph of the quadratic expression, y = ax2 + bx + c, we have:

a =

b =

c =

Here's the code:




Related page

You may also be interested in svgPHPGrapher Syntax Examples. svgPHPGrapher is a highly modified PHP port of ASCIIsvg.js and produces static SVG math graphs with no javascript.

Search IntMath, blog and Forum