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

Page by Murray Bourne, IntMath.com. Last updated: 18 May 2017
# 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. Here's a comparison:

| ASCIIsvg-IM.js | JSXGraph |

Uncompressed | 28 KB | 902 KB |

Compressed | 18 KB | 535 KB |

Gzipped | 6 KB | 157 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

## Number line

## Animations

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* = *ax*^{2} + *bx* + *c*, we have:

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