Sign in to follow this  
Followers 0
Nahuel

Draw math functions

13 posts in this topic

I don't know if someone created a similar tool. Here's mine.

Graph.rar

I'm so proud of it :P I find it really useful.

Here's some screenshots:

Main window: (Looks better on Vista or XP :o )

Posted Image

Functions:

Sin(x)

Posted Image

X^2+4*X+4

Posted Image

I'm particulary proud of how accurate the graph is. You can tell at Sin(x), for instance, how it reaches exactly 1 and -1 and how it passes through (0,0). The only very annoying problem I've found is with the asymptotes. The program keeps drawing them, when of course they shouldn't be there or at least they should be drawn in a different color. If I make modifications so that they are not shown, then something else screws up. If the asymptote is vertical and it's located at an integer value of X, then the program will tell you.

Anyway, I hope someone likes it :P

Share this post


Link to post
Share on other sites



NICE

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

nice job :P

suggestion: maybe make it so you can zoom in/out on the graph or crop zoom certain areas

its buggy a bit

EX:

function: f(x)=4x

graph produced:

Posted Image

Another Bug (tooltip, the asymptote)

Posted Image

Edited by UPSman2

Share this post


Link to post
Share on other sites

^thanks! That's because you should always use * for product. Try 4*X

The zoom function would be great. I added the scale changing feature, wich lets you see the graph bigger in a way. Zooming properly would require the script to take new trace limits and plot according to those new limits. Sounds like a lot of work :P

Share this post


Link to post
Share on other sites

Another Bug (tooltip, the asymptote)

Posted Image

Weird... what function is that? I just tried 1/(x-3). It has an asymtote at X=3 and works fine...

Posted Image

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

^thanks! That's because you should always use * for product. Try 4*X

The zoom function would be great. I added the scale changing feature, wich lets you see the graph bigger in a way. Zooming properly would require the script to take new trace limits and plot according to those new limits. Sounds like a lot of work :P

maybe another thing you might be able to do is make the asymptotes another color, like blue or something (if possible)

Edit: about second tooltip, probably my bad w/ the "4x" as apposed to "4*x"

Edited by UPSman2

Share this post


Link to post
Share on other sites

I just found out what the problem is with the asymtotes. If the grid is too small it becomes less accurate. Not reall something that bothers me, looks natural to me. Making the grid a bit bigger fixes it.

Thanks for noticing.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

ok 1 last thing, maybe you could make it so the user can put in a custom interval on the graph, like by 3's, 4's, etc... or maybe even by "π" (pi's)

Edited by UPSman2

Share this post


Link to post
Share on other sites

I thought I left all this behind in college, never to be seen again. Very nice though. I love to include math in my scripts that makes you turn your head and try to comprehend it until you give up and your just happy it works.


Giggity

Share this post


Link to post
Share on other sites

Very nice, I've produced a few graph programs too.

The reason you get the asymptotes is because you are not re-setting your starting position using $GUI_GR_MOVE for the next $GUI_GR_LINE after you reach INF.

Zooming properly would require the script to take new trace limits and plot according to those new limits. Sounds like a lot of work

I have written a couple of formulas which allow you to take into account this sort of re-factorizing:

http://www.autoitscript.com/forum/index.php?showtopic=63497

feel free to modify etc.

Good work.


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

Very nice, I've produced a few graph programs too.

The reason you get the asymptotes is because you are not re-setting your starting position using $GUI_GR_MOVE for the next $GUI_GR_LINE after you reach INF.

Thanks. I think I did try that, and the result was that the asymptote was not drawn, but neither was the rest of the graph from that point on. I honestly never modified that code again, but I use it all the time.

I liked your scripts, the last screenshot you posted looks great.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0