# Draw math functions

## Recommended Posts

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

Graph.rar

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

Here's some screenshots:

Main window: (Looks better on Vista or XP )

Functions:

Sin(x)

X^2+4*X+4

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

NICE

##### Share on other sites

nice job

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:

Another Bug (tooltip, the asymptote)

Edited by UPSman2

##### 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

##### Share on other sites

Another Bug (tooltip, the asymptote)

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

##### 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

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 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 on other sites

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 on other sites

thats cool!!...

I'm having this at school now ..

here's a windows screenshot:

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

## Create an account

Register a new account

×

• Wiki

• Back

• Git