'; SDV($GUIButtons['ASCIIsvg'],array(1000, '\\\begin{graph} ', ' \\\end{graph}', 'width=300; height=200; xmin=-6.3; xmax=6.3; xscl=1; plot(sin(x));', '$ASCIIMathMLUrl/graph.gif"$[ASCIIsvg-graph]"')); SDV($GUIButtons['ASCIImath'],array(1000, '', '', 'sqrtn', '$GUIButtonDirUrlFmt/math.gif"$[Math formula (ASCIIMath)]"')); Math etc - Wiki Sandbox

# Wiki Sandbox

Apologies, due to spam this page cannot be edited at this point.

This wiki is using the ASCIIMathML.php cookbook for math (including LaTeX formulas and some formatting commands) and graphics. This version of ASCIIMathML (2.0.2) includes LaTeXMathML and ASCIIsvg in one simple package. Double-click on the graphs to see or modify the ASCIIsvg code.

Graphs can now be annotated with ASCIIMathML and LaTeX math notation. Also, the "axes()" command is added automatically (if it is missing).

Example ASCIIMathML: int x^2dx = x^3/3+C

Example LatexMathML: $\int x^2dx = \frac{x^3}{3}+C$

Example ASCIIsvg:

\begin{graph} width=300; height=200; xmin=-6.3; xmax=6.3; xscl=1; plot(x^2); \end{graph}

\begin{graph}

 width=300; height=200;
xscl=1; ymin=-1.5;
endpoints = "<->";
plot(x^2,-2,2);
text((-3,3),"x^2");
line((-4,-1),(4,3));
text((2,1),"$\\frac{1}{2}x+1$","right");


\end{graph}

(:graph

 width=200; height=50;
endpoints = "<->";
plot(sin(x),-4,4);
dot([0,0]);
point([pi/2,1]);


b=text([pi,0],"root",aboveright); dot(b,"closed"); :)

 (:graph plot(tan^-1(x)); :) (:graph plot(x^2):)

(:graph width=600; height=200;

 xmin=-6.3; xmax=6.3; xscl=1;
plot(x*sin(1/x),null,null,1000);


:)

(:graph

 width=200; height=200; border=25;
xmin=-1; xmax=6; xscl=1; ymin=-1;
plot(sin(x)+2.5);
a = [0,0];
b = [5,5];
marker = "dot";
line(a,b);
text(b,"b",aboveleft);
stroke = "red";
path([a,[0,5],b,[5,0]]);
stroke = "green";
marker = "none";
curve([a,[.25,0],[.5,.5],[1,1],[1.5,1.5]]);
stroke = "blue";
circle([5,0],1);
ellipse([0,5],1,2);
stroke = "purple";
rect([0,0],[2,2],null,.5,1);
marker = "arrowdot";
line(a,[5,0]);


:) \begin{definition} A number $p>1$ is prime if $p$ is only divisible by 1 and $p$. \end{definition}

\begin{lemma} For any natural numbers a,b and any prime p, if p divides a*b then p divides a or p divides b. \end{lemma}

\begin{itemize} \item item 1 \item item 2 \item item 3 \end{itemize}

\emph{Hello} blue $\sin x$ here

$\sqrt x$ and sqrtn

hello ok

This works very nicely! However, I will need to document things very well and give lots of examples for high school students. I've gotten a start on this but still need to understand a few more basic ideas.

ASCIIsvg Help Robert

QUESTIONS that have arisen:

1) Can the background color be changed, transparent? Is it possible to add an image to the background?

A: background now transparent, can be changed by setting "backgroundstyle". Adding image to svg does not work (yet), but it should be possible to use CSS layers.

2) Could an "opacity" attribute be added to the fill?

A: yes, has been added. Use fillopacity = ... and strokeopacity = ... where ... is a number from 0 (=transparent) to 1 (=solid)

3) How is the mouse listener (coordinates) turned off? In most of my graphs it is not necessary. Also, this only seems to work intermittently for me.

A: Coordinates can be switched off by adding "showcoordinates = false;" in ASCIIsvg code. But they are not so annoying anymore since moving out of the picture switches them off now. Also finally got them working reliably in Firefox (took almost 2 days!). However, with more than one graph, sometimes the y-coord is not correct??

4) How can a sector be drawn (easily)? Is there a sector command. I've drawn one by combining a triangle and an arc. This could be confusing to a young student, especially if a fill is required, then you run into layering issues (unless there's a better way that I'm not getting).

A: this has been added (see documentation for syntax).

agraph width=300; height=200; xmin=-5; xmax=3; xscl=1; ymin=-.5; plot((1-x)/(1+x)); endagraph

 (:graph width=200; height=200; xmin=-6.3; xmax=6.3; xscl=1; fill="yellow"; fillopacity=0.5; sector([0,0],[5,0],[0,5] ,1); fill="purple"; fillopacity=0.5; sector([0,0],[3.53, 3.53],[-3.53,3.53],2); :) Wow Peter, this is absolutely fantastic.

==test== agraph width=300; height=200; xmin=-5; xmax=5; ymin=-5; ymax=5; xscl=3; plot(x^2-5); endagraph

$$a^2 + b^2 = c^2$$

$X_{i+1,t+1} = 1 iff X_{i,t} = 1$ for $i,t > 0$, $X_{0,0} = 1$