Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Drawing Mathematical Equations
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
glp




PostPosted: Fri Oct 22, 2004 8:11 pm   Post subject: Drawing Mathematical Equations

I'm trying to draw a mathematical equation with variables inputted by the user. I can't seem to find anything good to fit my needs. I need to be able to save and print it also. I have seen how that's done. Just the basics would be great as I can fill in the blanks. Just if ya can, put what each part generally does.

Thanks!
Sponsor
Sponsor
Sponsor
sponsor
bugzpodder




PostPosted: Fri Oct 22, 2004 8:27 pm   Post subject: (No subject)

first of all, restrict yourself to two variables as those could be drawn on a 2d plane. if you want it really easy, keep the degree of y to be 1. then its a function.

just pick a limit for x, and step through the x on small intervals Dx=0.001 say, and use the newton's approximation (goggle that) or bisection method if your y degree is more than 1 or just plug it into the function if the y degree is 1. either way, compute the value(s) of y and plot (x,y).

btw you might give parsing of input data a thought
glp




PostPosted: Fri Oct 22, 2004 8:49 pm   Post subject: (No subject)

yep, only drawing on a 2d plane

so basically, I should just put a limit for x and use small intervals

parsing?
(sorry. I'm pretty new to Turing)

I understand that, but how do you now add scrolling (or something similiar) to Turing to allow bigger graphics than the run window?
Delos




PostPosted: Fri Oct 22, 2004 9:35 pm   Post subject: (No subject)

Parsing...I've heard that before somewhere...hmmm...I believe it is the process of taking data and breaking it up into smaller chunks that you can manage more easily.

Now, as for scrolling or "something similar"...

code:

setscreen ("graphics:max;max")
cls
Input.Pause
setscreen ("graphics:100;100")
cls
Input.Pause
Cervantes




PostPosted: Sat Oct 23, 2004 9:21 am   Post subject: (No subject)

That doesn't get me my scroll bars, Delos.
The only way I've found to get scroll bars (other than using GUI or making your own) is to set the graphics to larger than your resolution:
code:

setscreen ("graphics:4000;4000")

for example.
But, this way, you're stuck with having your window take up your entire screen.
beard0




PostPosted: Sun Oct 24, 2004 12:53 pm   Post subject: (No subject)

This is a module I made for drawing functions:
http://www.compsci.ca/v2/viewtopic.php?p=62132
glp




PostPosted: Mon Oct 25, 2004 5:40 pm   Post subject: (No subject)

too bad I'm running an old version of Turing (3.1A) it doesnt seem to like you file beard0. It's yelling at me about the "Upper" function. Ah well Sad
beard0




PostPosted: Mon Oct 25, 2004 5:50 pm   Post subject: (No subject)

if you remove all the Str.Upper and then make sure you use all upper case in the string for Function.New (eg: RANGE:1;3.14159), then you should be OK. You will also probably need to chnage all instances of Math.PI to 3.14159, as I don't believe that is available in the older version that does not allow Str.Upper. Try it out! Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Hikaru79




PostPosted: Mon Oct 25, 2004 10:56 pm   Post subject: (No subject)

glp wrote:
too bad I'm running an old version of Turing (3.1A) it doesnt seem to like you file beard0. It's yelling at me about the "Upper" function. Ah well Sad


Why use an old version then? This thread contains numerous links to downloads of Turing 4.0.5 Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: