You are here:

Advanced Math/function for a graph

Advertisement


Question
QUESTION: can you find me a function for r=1 [a circle] an x parameter[it represents angles from 0 to 360] and we will give increasing numbers to that x  and function should give us the coordinates of the point in the circle[it will be used in graph making in the computer,opengl....]
is may be explained insufficiently,if you need more parameters i may send them as a follow up question.

ANSWER: Do you mean polar coordinates?

In polar coordinates, r is the distance from the origin and
Θ is the angle from the positive x axis.

If I understand what you are asking for,
it is a function with increasing values of r.

A simple function like r = Θ would work.  If this what you want?

At 0°, r is 0.

At 90°, the angle is really π/2, so r is π/2.

At 180°, the angle is really π, so r is π.

At 270°, the angle is relly 3π/2, so r is 3π/2.

Back at 360°, the function could be chopped off,
since 360° = 0°, or it could be continued, and r would be 2π.

If it were continued, it would resemble a snail shell.

If this is not that for which you are looking,
please write back with a more thorough description.


---------- FOLLOW-UP ----------

QUESTION: a basic circle, r is [as you mentioned.] the length from origin of the circle to the circle,r will be 1...
we will only write the angle as parameter and that function will give us the polar coordinates....
like tanA[A as angle]=X1\X2[X1 and X2 the two coordinates]....[but that is not complete as you see ,X1/X2 is not enough specifically x1 or x2 is needed.....
i need a function which will give X1 or X2[ANGLE IS THE ONLY PARAMETER]
or we can give the coordinates and that function can give us the angle....
i will use for opengl or c++
that function will help us to draw that circle .....  

Answer
If the point is on the circle with radius r, angle Θ,
and x1 is in the x direction and x2 is in the y direction,
then x1 = r cos(Θ) and x2 = r sin(Θ).

It is known that π/2 radians is 90° and
there are 2π radians in a circle.

If the curve is drawn in Excel and a smoothed line is used,
it is fairly accurate with only 4 points in the circle,
and almost perfect with 6 points.

If the points are not smoothed, it looks OK with around 10 points,
but to make it really smooth, over 30 points are needed.


It is also possible to declare pi as a constant or maybe C has pi,
but I don't know that yet either.

A program in C to generate the points is

// max.cpp: program to print out the coordinates in a circle

// Note: C or C++ was not my first language and was not around when I was in college.

// Modified, this should print to a file and be able to be imported into Excel to draw it.
// I don't quite remember how to use files in C++ yet.

// It might be possible to do it in C++, but haven't learned C++ that well yet.

// If it is possible and you can do it, send me a copy.

// for file used, there something about declaring/using a variable with a */& or something like that

const N = 30;
const R = 10;
const PI = 3.14159265;

#include <stdio.h>
#include <math.h>

void main() {
 int i;   // used in for loop
 float x; // angle
  
 for (i=0; i<=N; i++) {
   x = 2*3.14159265*i/N;          // *2pi/N
   printf ("%f  %f\n", cos(x), sin(x));
  }
}

Advanced Math

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scott A Wilson

Expertise

I can answer any question in general math, arithetic, discret math, algebra, box problems, geometry, filling a tank with water, trigonometry, pre-calculus, linear algebra, complex mathematics, probability, statistics, and most of anything else that relates to math. I can even tell you it takes me over 2,000 steps to go a mile, but is that relevant?

Experience

Experience in the area; I have tutored people in the above areas of mathematics for almost two years in AllExperts.com. I have tutored people here and there in mathematics since before I received a BS degree almost 25 years ago. In just two more years, I received an MS degree as well, but more on that later. I tutored at OSU in the math center for all six years I was there. Most students offering assistance were juniors, seniors, or graduate students. I was allowed to tutor as a freshman. I tutored at Mathnasium for well over a year. I worked at The Boeing Company for over 5 years. I received an MS degreee in Mathematics from Oregon State Univeristy. The classes I took were over 100 hours of upper division credits in mathematical courses such as calculus, statistics, probabilty, linear algrebra, powers, linear regression, matrices, and more. I graduated with honors in both my BS and MS degrees. Past/Present Clients: College Students at Oregon State University, various math people since college, over 7,500 people on the PC from the US and rest the world.

Publications
My master's paper was published in the OSU journal. The subject of it was Numerical Analysis used in shock waves and rarefaction fans. It dealt with discontinuities that arose over time. They were solved using the Leap Frog method. That method was used and improvements of it were shown. The improvements were by Enquist-Osher, Godunov, and Lax-Wendroff.

Education/Credentials
Master of Science at OSU with high honors in mathematics. Bachelor of Science at OSU with high honors in mathematical sciences. This degree involved mathematics, statistics, and computer science. I also took sophmore level physics and chemistry while I was attending college. On the side I took raquetball, but that's still not relevant.

Awards and Honors
I earned high honors in both my BS degree and MS degree from Oregon State. I was in near the top in most of my classes. In several classes in mathematics, I was first. In a class of over 100 students, I was always one of the first ones to complete the test. I graduated with well over 50 credits in upper division mathematics.

Past/Present Clients
My clients have been students at OSU, people nearby, friends with math questions, and several people every day on the PC, and you're probably make one more.

©2012 About.com, a part of The New York Times Company. All rights reserved.