Computer Science Canada Need help drawing tangent, log, and exponent curves (C# but somewhat language independant) |
Author: | WilliamsD [ Sat Apr 14, 2007 3:16 pm ] | ||
Post subject: | Need help drawing tangent, log, and exponent curves (C# but somewhat language independant) | ||
Long story short, my class assignment is to make a graphing program in C# that draws sin, tangent, log, and exponent curves. My problem stems from the fact that I have had a serious lack of math instruction and don't know how to do this. I have the sin curve finished from an in-class example we were given, but I don't know where to begin on the others. Here is the code for the sin curve if it helps:
|
Author: | ericfourfour [ Sat Apr 14, 2007 4:11 pm ] |
Post subject: | RE:Need help drawing tangent, log, and exponent curves (C# but somewhat language independant) |
I imaging you would treat the screen as a Cartesian plane and simply graph each function. I really don't know what all of these functions would look like but I'm going to guess: sine: f(x) = sin(x) tangent: f(x) = tan(x) log: f(x) = log(x) exponent: f(x) = a^x Just plug numbers into those functions to get the y. Plain and simple. |
Author: | klopyrev [ Sat Apr 14, 2007 7:41 pm ] |
Post subject: | Re: Need help drawing tangent, log, and exponent curves (C# but somewhat language independant) |
Its as simple as replacing the line: double y = Math.Sin(x); with one of: double y = Math.Sin(x); double y = Math.Tan(x); double y = Math.Log(x); or double y = Log(a,x); (The first one is base E, second is base a) double y = Math.Pow(a,x); (Base a) |