aantthony / graph.tk

Javascript Graphing Utility using HTML 5 Canvas
http://aantthony.github.com/graph.tk/
391 stars 51 forks source link

how to draw a piecewise function in graph.tk #50

Open chixg opened 12 years ago

chixg commented 12 years ago

seems piecewise function is not supported yet , have a plan ?

aantthony commented 12 years ago

Nope. How would something like

"y = (x>3) ? x : x^2" be? That would translate to ----/ x, if x>3 y=-\ x^2

chixg commented 12 years ago

example:

y =
x ( x > =0 )
-x ( x < 0 )

chixg commented 12 years ago

how to use "if" ? copy "x, if x>3 y=-\ x^2 " only "-\ x^2" works

aantthony commented 12 years ago

What works?

Also, I think another way to specify it could be:

"y = x \and x>3 \union y=x^2 \and x <= 3"

chixg commented 12 years ago

Sorry , I still can't catch your idea..

when copy "y = x \and x>3 \union y=x^2 \and x <= 3" to http://graph.tk/ console, "Too many '='s" is the result.

any help doc is available ?

aantthony commented 12 years ago

Oh. When I said "y = x \and x>3 \union y=x^2 \and x <= 3" I was speculating that in the future that could be a possible way to use such a feature. Piecewise functions are not supported yet, so it is not possible now.

There are no help docs yet.