Short story: I was bored in Maths, I started writing this plotter thingie to better understand these things.
It's not perfect. It's just a learning tool for me and anyone else who wants to look at this mess of code. It was done in only a few maths classes.
Edit formulas by editing the characters marked in a reddish-yellowish background colour. If you don't have anything, the variable name will be shown instead.
You can also choose between formulas by selecting the tabs above.
- Graph doesn't change on input
- Additional information on the graph
I've decided to keep the equations seperate from the code (as in kept the in their own objects rather than intertwine them).
They are stored in the modes
objects and called up when needed.
They all have their title
, the equation
visiable and editable by the user, a function which calculates y
, whether it needs to be dualSided
since Math.sqrt()
only returns the positive result, required parameters
and an unused properties
object.
line: {
title: "Line",
equation: "y = $mx + $c",
y: function(x)
{
var m = eval(equVars["m"])
var c = eval(equVars["c"])
// y = mx + c
return (m * x) + c
},
dualSided: false,
parameters: [ "m", "c" ],
properties: { ... }, // Unused
}
return (m * x) + c
return Math.sqrt(Math.pow(r, 2) - Math.pow(x - h, 2)) + k
return Math.sqrt(Math.pow(b, 2) * (1 - (Math.pow(x - h, 2) / Math.pow(a, 2)))) + k
return Math.sqrt(4 * a * (x - h)) + k
return 4 * a * Math.pow(x - h, 2) + k
return Math.sqrt(Math.pow(b, 2) * ((Math.pow(x - h, 2) / Math.pow(a, 2))) - 1) + k