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.2

Downloads: 2509

Views: 3019

Comments: 14

Ratings: 13

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: Alternative tension generator
Rating: 5
Filesize: 30.81 kB
Downloads: 360
Comments: 0
Ratings: 1
Date added: 2015/03/31 18:39:18
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: math + hinge
Rating: 5
Filesize: 137.67 kB
Downloads: 417
Comments: 0
Ratings: 1
Date added: 2018/01/21 23:42:07
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: This weird thing
Rating: 5
Filesize: 9.57 kB
Downloads: 362
Comments: 1
Ratings: 1
Date added: 2020/05/05 03:39:55
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: self made graph plot
Rating: 5
Filesize: 311.4 kB
Downloads: 624
Comments: 0
Ratings: 1
Date added: 2011/08/16 02:25:41
Made with: Algodoo v1.9.8b
Rating: rated 5
download
Title: Spline-Based Tube Generator
Rating: 6.1111
Filesize: 45.94 kB
Downloads: 9027
Comments: 5
Ratings: 3
Date added: 2022/04/09 01:56:52
Made with: Algodoo v2.1.0
Rating: rated 6.1
download
Title: Four-bar function generator of the function Log(u)
Rating: 5
Filesize: 131.33 kB
Downloads: 338
Comments: 0
Ratings: 1
Date added: 2017/06/10 22:22:45
Made with: Algodoo v2.1.0
Rating: rated 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 :)