Because the Taylor series expansion works on 0-pi instead of 0-180. Pi is the ratio of a circle's circumference to it's diameter. If you want to find the distance along the edge of a circle you will find the angle to that spot from the beginning of the circle , convert it to radians(0-pi) and multiply it by the radius.
Sine and cosine, along with tangent, are functions based on the relationship of the sides of a right triangle with the angle of one of the non-right angle corners.
It's based on the relation ship between the sides of the triangle as they change size. If you own a protractor you can look at the angle on the outer edge. The triangle is formed by drawing a line down from the circular edge to the bottom, then from that point to center of the protractor and then back to the angle on the edge. If you measure the length of the lines that you drew then the ratio of the line on the bottom to the sloped line is the cos of the angle.
Sine and cosine, along with tangent, are functions based on the relationship of the sides of a right triangle with the angle of one of the non-right angle corners.
Scratch doesn't come with trig functions. This program shows you that it is possible to write your own using a Taylor-series expansion. It's an instructional program for people who want to be able to use cos in their programs. roberth and kevin_karplus have programs that calculate sin and cos in a different way based on a program that jay wrote.
Scratch doesn't come with trig functions. This program shows you that it is possible to write your own using a Taylor-series expansion. It's an instructional program for people who want to be able to use cos in the programs. roberth and kevin_karplus have programs that calculate sin and cos in a different way based on a program that jay wrote.
Sine can be done in a similar manner with the sin Taylor series. Right now it's really slow because it's using a [ broadcast and wait ] to call the cosine function and the cosine function is doing two [ repeat until ] commands which all kill performance.
Comments
You need to be logged in to post comments
Add a Comment
cool Checkout the graphing calculator Gallery.
A cosine is mathamatical equation, you can find in scratch under the number tab.
At the time that this was written there was no cosine function in Scratch.
well, I know what cosine is but I didn't know why Pi was needed and that was a very easy understandable explanation.
What's a cosine?
Because the Taylor series expansion works on 0-pi instead of 0-180. Pi is the ratio of a circle's circumference to it's diameter. If you want to find the distance along the edge of a circle you will find the angle to that spot from the beginning of the circle , convert it to radians(0-pi) and multiply it by the radius.
I understand but why does the "do cosine" sprite need to have the value of pi in the equation to calculate the cosine based on the angle?
Sine and cosine, along with tangent, are functions based on the relationship of the sides of a right triangle with the angle of one of the non-right angle corners.
whats a cosine?
It's based on the relation ship between the sides of the triangle as they change size. If you own a protractor you can look at the angle on the outer edge. The triangle is formed by drawing a line down from the circular edge to the bottom, then from that point to center of the protractor and then back to the angle on the edge. If you measure the length of the lines that you drew then the ratio of the line on the bottom to the sloped line is the cos of the angle.
REALLY: WHY DOES THIS DRAW A CURVED SLOPE IF COSINE IS BASED ON RIGHT TRIANGLES? Sorry for the outburst.
So if cosine is based on triangles, why does this draw a curved slope? I just don't understand that.
Sine and cosine, along with tangent, are functions based on the relationship of the sides of a right triangle with the angle of one of the non-right angle corners.
What are cos and sin and the things like that?
WOWIE!
Interesting :D
Scratch doesn't come with trig functions. This program shows you that it is possible to write your own using a Taylor-series expansion. It's an instructional program for people who want to be able to use cos in their programs. roberth and kevin_karplus have programs that calculate sin and cos in a different way based on a program that jay wrote.
Scratch 1.2.1 comes with sine cosine and tangent (but not secant cosecant or cotangent.)
Scratch doesn't come with trig functions. This program shows you that it is possible to write your own using a Taylor-series expansion. It's an instructional program for people who want to be able to use cos in the programs. roberth and kevin_karplus have programs that calculate sin and cos in a different way based on a program that jay wrote.
I don't get it!
Wow!
Sine can be done in a similar manner with the sin Taylor series. Right now it's really slow because it's using a [ broadcast and wait ] to call the cosine function and the cosine function is doing two [ repeat until ] commands which all kill performance.
cool