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

Username:   Password: 
 RegisterRegister   
 Graphing Calculator
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TianCaiWuDi




PostPosted: Fri May 02, 2008 5:30 pm   Post subject: Graphing Calculator

A couple of questions about making a graphing calculator in Turing.

1. How to find the appropriate range of x/y?
2. How to graph a parabola?

Thanks in advance.
Sponsor
Sponsor
Sponsor
sponsor
Asherel




PostPosted: Fri May 02, 2008 6:04 pm   Post subject: Re: Graphing Calculator

Well, seeing as you want to know Parabolas, Nick has a good program to do them.

However you will need to ask him to copy or use your code.

Nick's Parabola

And if you are looking for the X and Y corrdinates of the standard output window, look into 1st Quadrants. It's 600 by 400 pixels.

Hopefully this is what you are after.
Clayton




PostPosted: Fri May 02, 2008 9:56 pm   Post subject: RE:Graphing Calculator

Make sure you know how to do translations to any given function. If you don't, then you're just asking for trouble.
andrew.




PostPosted: Mon May 05, 2008 5:03 pm   Post subject: RE:Graphing Calculator

I made a parabola grapher a while back. It doesn't have the all the transformations of the parabola but by changing the variables, you can move it vertically and stretch or compress it. I was thinking of redoing it though. Make it fully functional.

Here is the code:

Turing:

setscreen ("graphics:max,max")
View.Set ("title:Parabola Grapher")
var c, y, d, a, b : real
var username : string := Sys.GetUserName
a := -51
b := 0
c := 0
d := 1
put "Welcome ",username,","
put ""
put "The equation of a parabola is as follows:"
put "y=ax**2+b"
put ""
put "Enter a value for a."
get d
put "Enter a value for b."
get c
cls
for i : 3 .. maxx by 10
    drawline (i, 0, i, maxx, grey)
end for
for j : 0 .. maxy by 10
    drawline (0, j, maxx, j, grey)
end for
drawline (maxx div 2, 0, maxx div 2, maxy, black)
drawline (0, maxy div 2, maxx, maxy div 2, black)
for x : -maxx .. maxx
    y := d * x ** 2 + c
    a := x - 1
    b := x - 1 ** 2
    drawline (round (a + maxx div 2), round (d * a ** 2 + c + maxy div 2), round (x + maxx div 2), round (y + maxy div 2), black)
    drawfilloval (round (x + maxx div 2), round (y + maxy div 2), 2, 2, red)
end for
Mackie




PostPosted: Mon May 05, 2008 5:34 pm   Post subject: RE:Graphing Calculator

I think you should work on naming conventions.

code:
put "Enter a value for a."
get d
put "Enter a value for b."
get c


I think there is something wrong here.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: