Browse Search Popular Register Upload Rules User list Login:
Graph Generator v1.1

screenshot of the scene

Author: KarateBrot

Group: Default

Filesize: 29 kB

Date added: 2009-11-09

Rating: 8.1

Downloads: 2133

Views: 2579

Comments: 14

Ratings: 12

Times favored: 2

Made with: Algodoo before v1.8.5


Scene tag

Graph Generator v1.0

Update v1.1: Improved algorithm to approximate roots

Forum topic

With this scene you can visualize mathematical functions. Next to "f(x) =" just type any function you want into the text box (make sure to use normal formatting like in the examples below). After that you can draw the graph, show it's roots, draw the first or second derivative.
As an example I already entered a function to the text box.

How to:
1) Start the simulation (press SPACE)
2) Select the text box next to "f(x) =" and go to it's appearance menu.
3) Now change the box text. Type in your desired function (or just keep the example function)
4) Close the appearance menu. Navigate with the ARROW KEYS within the menu. Choose with ENTER

Arrows - Navigate
Enter - Choose
D - delete graph

Function types: (examples)
2*x -3
x^5 - 2*x^4 - 3*x^3 + 2*x^2 + x - 0.25
math.cos(x) -x
3^x -1
x^2 - 2^x
Because Algodoo has no implemented ln I made my own ln. To use it type ""^2 +1)

Thanks to gradyfitz and standardtoaster for having an answer to scripting questions all the time related to this scene and to immibis for his extended for-function.
Last edited at 2009/11/12 23:08:53 by KarateBrot
Please log in to rate this scene
Similar scenes
Title: -Graph-
Rating: 5
Filesize: 18.29 kB
Downloads: 248
Comments: 3
Ratings: 1
Date added: 2013/09/03 23:24:50
Made with: Algodoo v2.1.0
Rating: rated 5
Title: Alternative tension generator
Rating: 5
Filesize: 30.81 kB
Downloads: 229
Comments: 0
Ratings: 1
Date added: 2015/03/31 18:39:18
Made with: Algodoo v2.1.0
Rating: rated 5
Title: math + hinge
Rating: 5
Filesize: 137.67 kB
Downloads: 223
Comments: 0
Ratings: 1
Date added: 2018/01/21 23:42:07
Made with: Algodoo v2.1.0
Rating: rated 5
Title: Function generator
Rating: 5.625
Filesize: 0.63 MB
Downloads: 614
Comments: 6
Ratings: 2
Date added: 2020/03/23 17:24:18
Made with: Algodoo v2.1.0
Rating: rated 5.6
Title: Four-bar function generator of the function Log(u)
Rating: 5
Filesize: 131.33 kB
Downloads: 247
Comments: 0
Ratings: 1
Date added: 2017/06/10 22:22:45
Made with: Algodoo v2.1.0
Rating: rated 5
Title: Visual torque curve
Rating: 5
Filesize: 440.22 kB
Downloads: 223
Comments: 1
Ratings: 1
Date added: 2017/02/10 20:51:53
Made with: Algodoo v2.1.0
Rating: rated 5
Awesome use of eval! Great scene! :tup:
Awesome. I'll never know scripting so good._o_
grady told me about eval.
Just perfect! :tup:
Eval is cool, I did'n notice that before... :bonk:
КРУТО!!! Только точка функции x^2 не равна нулю...это так и должно быть?))
it calculates the roots with approxiamtions. because i don't want algodoo to make too much calculation steps because the more the slower it will get. it's a little problem with a multiple root. the approximation speed is slower if there is a multiple root. and because i only do 30 approximation steps (iterations) it's not exactly 0 but it's very small and nearly 0. maybe i will increase the number of iterations. thanks! :)
hell yeah!
Nice, but since I don't understand graphs that well... It still is pretty cool!! 10/10!

I tried entering 2+2-(4^2)-3 and that just gave me a flat line... Although I don't know if that's 'valid'... :D
OMG, that's you make that?
:tup: :tup:
Yeah that's valid. And it's a function. But 2+2-(4^2)-3 is just a number if you simplify it.
2+2-(4^2)-3 = -15. And if your function is just a number, it's just a flat line. If you want curves and stuff you have to include a variable ( x ) to your function.

Way to complicated to explain in a few sentences and if you wouldn't have the maths knowledge it's even more complicated. But simply said it calculates y-values with x values from -5 to 5 in 0.1 steps. so there are a lot of points (110 to be exact). after that the points get connected with rectangles with the correct angle and length. it's called "linear interpolation".
for the derivaties it's the same but the y-values get calculated with Newton's difference quotient.
the roots are detected with an algorithm to approximate them. It's called "newton's method". sometimes the root's are detected twice or even thrice but i'm working on a better algorithm that can detect if a root has already been found. one can say it's intelligent :lol:

ok, i improved the algorithm. now it reads the array of roots and detects if a root already is in it. the new root will be ignored then. the old algorithm only detected if the new root is the same one as the last one in the array.
a second advantage of the new algorithm is that it can detect more roots now (theoretically thousands). the old algorithm only detected roots if they weren't too close to each other (maximum was 21 roots).
I will update the scene today or tomorrow. when it's updated i rename the scene to "Graph Generator v1.1"
Last edited at 2009/11/12 17:16:11 by KarateBrot
I've just use it for my math needs. Perfect! _o_
nice :)