This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-06-02 08:35:28

daviep
Scratcher
Registered: 2007-06-02
Posts: 1

Exponent and trig functions

We are considering using Scratch in 2nd grade through high school. Currently we teach Visual Basic to all high schoolers as part of an integrated Math/Science/Technology curriculum. The major drawback to using Scratch in the upper grades is the lack of some of the high school math functions. Do other feel the lack? I assume it that they would be easy add-ons.

Offline

 

#2 2007-06-02 18:40:06

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Exponent and trig functions

See my RPN calculator for trig functions and sqrt.
http://scratch.mit.edu/projects/kevin_karplus/2164

It *would* be a lot faster (and the functions could be used in games) if the functions were built in.

Offline

 

#3 2007-06-08 21:11:39

jimmit
Scratcher
Registered: 2007-06-08
Posts: 2

Re: Exponent and trig functions

I compute the sine and cosine in my mathlib project.  I use the Taylor polynomial to approximate the value.  It's a very accurate method but Scratch cuts the value down to one decimal place.  Kevin's calculator moves a sprite to the angle you want to use, travels 1 unit and then gives the x for cos and y for sin, effectively going to a coordinate on the unit circle.  I thought that was a really cool method of doing it.  However, I would suggest having high schoolers create their own math functions.

http://scratch.mit.edu/projects/jimmit/8200

Offline

 

#4 2007-06-09 03:11:21

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Exponent and trig functions

Actually, scratch computes to (reasonably) high precision, it just doesn't display to high precision.  (It also has extremely buggy display of very large numbers.)

You could use something like my print_decimal routine to print the numbers actually computed:
http://scratch.mit.edu/projects/kevin_karplus/2951

Using the sprites to get atan does have limited accuracy on the squeak implementation, which foolishly rounds direction.

Offline

 

#5 2007-06-09 04:35:36

sjhalasz
Scratcher
Registered: 2007-05-26
Posts: 6

Re: Exponent and trig functions

Thanks to jimmit for how to do the trig.  It's enabled me to add a tilt-floor to my basketball which I've added to the Teaching Resources gallery.

Offline

 

Board footer