PDA

View Full Version : VBA App for producing Unit Circle values



jamescol
09-07-2004, 04:16 PM
My daughter wants me to find out if it's possible to develop an Excel VB app that will reproduce the values of the Unit Circle (for her calculus class). The problem I'm running up against is that her classwork requires her to express answers in terms of PI and SQRT (e.g 3PI/SQRT2), not in a simplified decimal notation.

The application needs to accept a radian (either positive or negative) as input, and then calculate and display (using PI and SQRT symbols) the Sin, Cos, Tan, Csc, Sec, Cot in terms of the standard Unit Circle x,y coordinates.

I attached a diagram of the Unit Circle for reference. A specific example is:

Input: PI/3
Stored constants for this value are:
x = 1/2
y = SQRT3/2

Calculations are:
Degrees = Input * 180/PI
R = SQRT(x^2 + y^2)
Sin = y/R
Cos = x/R
Tan = y/x
Csc = R/y
Sec = R/x
Cot = x/y

(Some of these trigonometric values will result in a DIV/0! error, so I will need to trap that also)

That's the minimum. Gravy for this app would be:

1. A way to display the entire Unit Circle with labels for x,y, Rad, and Deg

2. A way to display the standard graph for the given Rad along with all labels above

Thanks for any advice or help.

Cheers,
James

johnske
09-08-2004, 03:06 AM
Hi jamescol,

Perhaps using a loop to generate a number of values between zero and one to plot on a MS scatter chart would do it???? :dunno

I?ve used an in-built programme on Apple systems to do this (it?s much simpler), for plotting things on windows I now use a little programme called GRAPHER that I picked up from a PC tools disc, the help file contains this link - Grapher Web Page:

http://students.washington.edu/bellc/grapher/ (http://students.washington.edu/bellc/grapher/) if you want to look at it.

As far as the maths is concerned, for any that have the programming/coding skills and time to do this but perhaps not enough maths, the attachment below may save you having to look up text books: :bink: