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

Image:
screenshot of the scene

Author: KarateBrot

Group: Default

Filesize: 29 kB

Date added: 2009-11-09

Rating: 8.1

Downloads: 2064

Views: 2504

Comments: 14

Ratings: 12

Times favored: 2

Made with: Algodoo before v1.8.5

Tags:
function,
graph,
generator,
derivative,
creator

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

Controls:
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
1/math.sin(x)
math.cos(x) -x
3^x -1
math.tan(x)
math.sin(math.cos(x))
x^2 - 2^x
x^0.5
Because Algodoo has no implemented ln I made my own ln. To use it type "scene.my.ln()"
scene.my.ln(x^2 +1)

Credits:
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
edit
Similar scenes
Title: -Graph-
Rating: 5
Filesize: 18.29 kB
Downloads: 227
Comments: 3
Ratings: 1
Date added: 2013/09/03 23:24:50
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Alternative tension generator
Rating: 5
Filesize: 30.81 kB
Downloads: 212
Comments: 0
Ratings: 1
Date added: 2015/03/31 18:39:18
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: self made graph plot
Rating: 5
Filesize: 311.4 kB
Downloads: 482
Comments: 0
Ratings: 1
Date added: 2011/08/16 02:25:41
Made with: Algodoo v1.9.8b
Rating: rated 5
download
Title: Mechanical seismograph!
Rating: 5
Filesize: 14.17 kB
Downloads: 226
Comments: 0
Ratings: 1
Date added: 2018/10/23 21:04:59
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Random Number Generator
Rating: 5
Filesize: 11.6 kB
Downloads: 250
Comments: 0
Ratings: 1
Date added: 2012/10/20 22:59:51
Made with: Algodoo v2.0.2
Rating: rated 5
download
Title: Free Energy Generator
Rating: 4.5
Filesize: 164.89 kB
Downloads: 3154
Comments: 10
Ratings: 2
Date added: 2013/04/23 16:02:26
Made with: Algodoo v2.1.0
Rating: rated 4.5
download
Awesome use of eval! Great scene! :tup:
Awesome. I'll never know scripting so good._o_
thanks!
grady told me about eval.
Impressive
_o_
Just perfect! :tup:
Eval is cool, I did'n notice that before... :bonk:
КРУТО!!! Только точка функции x^2 не равна нулю...это так и должно быть?))
@KOCMOHABT
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 awesome....how you make that?
:tup: :tup:
@Physicsguy
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.

@dogwong
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:

[EDIT]
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 :)