Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Paul****Member**- Registered: 2006-01-19
- Posts: 4

Hello

I have been trying to program some sine equations.

My hope has been to create a loop of 100 iterations to generate results from 0 to 1 which has been successful

I have started with i set to 0

I have incremented it by Pi/200 stopping when i gets to Pi/2

And sin(i) has produced 0 to 1 as hoped for.

The problem is how do I generate 0 to 1 to 0 again

I have tried stopping i when it gets to pi which works very well until the final loop where I get a tiny value. Can anyone help. Am i trying the impossible?

Offline

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

until the final loop where I get a tiny value

Why is a tiny value incorrect if you are trying to get values from 0 to 1?

If you are coding this on a computer or calculator, please, post your code.

*Last edited by Ricky (2006-01-24 12:29:35)*

"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,560

Probably a rounding error if you increment by a real number. Try basing the loop on integers.

As Ricky said, if you post your code we can take a look

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

Pages: **1**