What is the formula to make a sine wave without a sine function? This has no asm usefulness, but mere curiosity...
Posted on 2001-09-21 15:14:38 by Kenny
I don't know it, but I think you'll find its an infinite equation. You decide your level of accuracy by deciding how far down the equation you should go.
Posted on 2001-09-21 16:36:51 by Eóin
Just being flippant , usually a powerpoint is a good source of a sine wave. :eek:

Sorry couldn't help myself.

I'll try to find out.
Posted on 2001-09-21 16:42:35 by edgarbrits
Yeah, I assume it would be like PI where it goes forever but I also have a feeling it is a radian (or maybe a degree) multiplied by PI to get a location or maybe vice versa. See, I don't know much about PI and sine accept for the fact when I put them in the 4x4 matrix, they work, and PI is very useful for making circles.

I remember I used PI and sine a bunch when I was studying myy electronics, but that was before the brain surgery, and most of that stuff got erased. I do remember Ohm's law and the time it takes a capaciter to discharge, and that's it... (2PI RC)
Posted on 2001-09-21 16:57:38 by Kenny
Well, you can approximate the sin of x by this "row"

~ 1 3 1 5
sin(x) = x - -- x + -- x - + ...
3! 5!

to get a good approximation for x < Pi/4 you need the terms up to x^7 or x^9 !

Greetings, Caleb
Posted on 2001-09-21 17:12:13 by Caleb
Caleb's equation is correct but we need to emphasize that you should keep the x <= pi/4 if you use it. You can do this by exploiting the -symmetry of the sine wave. If you use a big x the convergence will be really bad because for x>>1 powers will outpace the factorials. There are other better methods here but I'm away from my home library so maybe later.
Posted on 2001-09-21 17:54:01 by rafe
One question, Kenny:

What is your intention ?

If you need a fast sinus-generator than you should rather use a table for the whole period. (never mind about the inaccuracies if you want to do some graphical stuff with it ...)

Greetings, CALEB
Posted on 2001-09-21 18:05:53 by Caleb
Well, actually I was just curious. See, I can't figure out WHY the sin fucntion works. See, when I was doing my Linear Algebra I would always use sin of something but I never knew why it worked, so I guess now I'm going to be studying your formula so I can check out how it's done.

So, I guess an answere to your question would be curiosity :)
Posted on 2001-09-22 01:14:36 by Kenny
To study sin-function starting at this formular isn't good. It's better to take a look at

- Simple trigonometry on triangulars
- Complex numbers (e.g sin x = 0.5 (exp ^(i x) - exp ^(-i x)), ...
- The identity (sin?x + cos?x = 1)
- Vector-products (dot-product, cross-product)

This all together will lead you on the way to understand sinus

The given formular you get if you do a taylor-algorithm with the sin-function.

Greetings, CALEB
Posted on 2001-09-22 02:51:10 by Caleb
Give us an example of a formula where you don't understand the funtion of Sin. Maybe we could explain it.
Posted on 2001-09-22 06:15:26 by Eóin
Well actually, I know NOTHING of sin :) I don't even know what it does :grin: (Actually I -knew- something of sin but it got erased in the brain surgery.)

I've used it where I've been told to use it, but I don't yet know how to use it. I will write out what is bothering me later because I have to do some other stuff today and tomorrow, so maybe wednesday I can study your formula and ask your guys help :)
Posted on 2001-09-24 11:43:54 by Kenny
Hi, Kenny,
Let me warn you that you may be starting at the wrong place. That equation isn?t a sine formula. It stems from another formula, which allows the writing of infinite series equations for functions. You can get a similar equation for pi that allows you to work it out to varying degrees of accuracy, but the formula for pi is circumference/diameter of any circle.

Basically, if you look at the diagram. In the right angled triangle the sin of a will equal x/h. In other words, sin is the ratio of the side opposite the angle to the hypotenuse. Cosine would be the ratio for the side adjacent the angle, i.e. the bottom line which I should have labelled y.

In the unit circle the hypotenuse is always 1 therefore the sin of the angle gives you the vertical height of a point on a circle, Cos gives you the horizontal displacement. Therefore this is useful to use programmers as it allows use to draw circles. I the centre is x,y then to draw a unit circle we need only cycle through the angles 0 to 360 calculating the displacement from the centre for points on the circumference. The general formula we get for each point is (x + cos(a), y + sin(a)) for a 0-360. To expand this beyond the unit circle you multiply by the desired radius r eg (x + r(cos(a)), y + r(sin(a))).

Another interesting fact regarding Sin and Cosine comes form Pythagoras Theorem that state that the square of the hypotenuse on a right angled triangle equals the sum of the square on the other two sides.
I.e. h^2 = x^2 + y^2.
But Sin(a) = x/h
Therefore x = h * Sin(a)
And by same logic y = h * Cos(a)
So the new formula is h^2 = (h * Sin(a))^2 + (h * Cos(a))^2.
Divide both side by h^2 and you get 1 = Sin(a)^2 + Cos(a)^2.

Well that?s it for the lessons today.
Posted on 2001-09-24 12:40:17 by Eóin
E?in... it's nice to have a "maths enabled" person on the messageboard :D
Posted on 2001-09-24 18:35:53 by f0dder
E?in, I wish my posts had that kind of quality information! :alright:
Posted on 2001-09-25 01:41:53 by bitRAKE