GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 14-Dec-2008, 05:32
juned juned is offline
Awaiting Email Confirmation
 
Join Date: Dec 2008
Posts: 9
juned is on a distinguished road

Sine versus pythagoras


My name is Juned Wahab. I am 34 years old.

I started programming Assembler on the 8-bit commodore 64 computers in the late eighties. I have a diploma in business and 2 years credit computer science degree - where my calculator program was the fastest Hull University Computer Research Department ever came across.

I programmed a budget game, 'C.J.'s Island Capers' for Codemasters.

Before I hit you with any code, I need to verify my mathematical findings and see if I am correct in my assumtions.

When Imperial measurements were in use, Pye used to be 22/7 (fractions). A diameter of a circle is
pye * radius to the power of 2

Now that we are in decimal, Pye is approximately 3.142 (I believe endless). This is slightly innacurate. I have wrote a program in C++ using sine to manipulate and create a circle.

If you would like a free demo of my circle or spiral program, please
email: junedwahab@yahoo.co.uk

The code goes something like this:

for (x = 0; x < 100; x ++)
{
y = sin (x / 2.5) * (20 * 2.25);
sinarraytable[x] = y;
}

That is not the exact code but it will give you an idea. I am putting this to embeded systems to program things like radar and autpilot. I could most definetely do it in Assembler. Also a timekeeping program is on the cards.

I have a few budget games on the cards as well. Any comments, please let me know.
  #2  
Old 14-Dec-2008, 09:17
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,218
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Sine versus pythagoras


Quote:
Originally Posted by juned
...Pye used to be 22/7 (fractions).
No, it didn't, Sometimes teachers present 22/7 as being a simple rational approximation to pi.
Furthermore, I have never seen it spelled "Pye," since the usual Roman alphabet representation of the sixteenth letter of the Greek alphabet is "pi" Or maybe we are talking about something different?

However...

22/7 is equal to 3,142857142852142857...


The "..." means for us to continue in a like manner. In this case there is a pattern of repeated group of digits "142857"

So, in this case the "..." indicates that the repeating group "142857" goes on forever.

On the other hand, pi is approximately equal to 3.14159265358979323846...

In this case, "..." indicates that it goes on forever with no obvious way of knowing what the next digit will be.

Now, if you had a teacher who told you that pi was "equal to" 22/7, too bad. That's just flat wrong. Pi is not equal to 22/7. Never was. Never will be. See Footnotes.

Quote:
Originally Posted by juned
...Pye is approximately 3.142 (I believe endless). This is slightly innacurate.
This approximation is correct to four significant decimal digits. Note that if you truncate the decimal representation of 22/7 to four significant decimal digits, the result is 3.143, so 22/7 is accurate to three significant decimal digits.

There is no way to represent pi with a finite number of decimal digits in any rational number system, so trying to represent it as a decimal fraction (or binary fraction or whatever...) will always be an approximation, and "slightly inaccurate." Period. Full stop.

Quote:
Originally Posted by juned
.
I have wrote a program in C++ using sine to manipulate and create a circle.
What do you mean "manipulate pi"? Pi is pi. What's to manipulate?
Quote:
Originally Posted by juned
.
The code goes something like this:
The standard library function sin() takes an argument that is in radians. Are you really calculating the sine of 18 radians, 36 radians, 54, radians, ... ? Why? What does this have to do with pi? If you are not calculating the sine of multiples of 18 radians, why did you post that code? And what are we supposed to do with it?
Quote:
Originally Posted by juned
That is not the exact code but it will give you an idea.
It doesn't give me any ideas at all. I don't have a clue.
Quote:
Originally Posted by juned
Any comments, please let me know.
What, exactly, are you getting at?

Furthermore, you gave this thread the title "Sine versus pythagoras." What the heck does Pythagoras have to do with it?

Bottom line: Maybe this is one of those days where I just flat miss the point, and it would be better if you spelled it out.

Regards,

Dave

Footnotes:

The following doesn't quite rhyme, but it's a pretty close approximation, and it is just as easy for me to remember as 22/7:

“This above all numbers is sublime; 3.14159″
---Ellis Sanders.


Or, as cheerleaders for the math club are known to shout during competitions:

"Sine, Cosine, Cosine, Sine,
Three point one four one five nine.
Gooooooo Team!"



Irrational number enthusiasts around the world celebrate "Pi Day" on March 14 (3/14, get it?). It's not too early to start planning your activities now.
Details here Pi Day Home Page
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Sine graph iLLuSivE C++ Forum 4 27-Nov-2008 17:49
Associates degree versus master's degree BioHazard90 Miscellaneous Programming Forum 0 24-Nov-2008 17:57
Visual Studio 2005 versus Visual Studio 2008 Clay L Miscellaneous Programming Forum 2 25-Oct-2008 16:22
FLTK version 2.0 versus 1.1.6 TeXJunky FLTK Forum 3 11-Aug-2005 14:42
Photoshop versus ? nickbeee Graphics Forum 1 07-Oct-2001 19:35

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:16.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.