APP Lab: Add Trig Functions

Hello,

App lab really needs some trig functions for drawing ( sin() & cos() functions) and modeling. I really feel that without these, there is a missed opportunity to blend in some math and physics topics with this computer science tool. These extra functions would be located in in math menu.

1 Like

Hey Sean,

You actually can use trig functions they just don’t appear in the toolbox. For example you could write

console.log(Math.sin(Math.PI/2));

which outputs

0

Both the sin function and PI need to begin with “Math dot”. You can read more about it here http://www.w3schools.com/jsref/jsref_sin.asp if you like.

We support a lot of JavaScript that doesn’t appear in the blocks because it would quickly make the toolbox unmanageable. There’s a few exceptions to this rule, but in general I’d look up what you want to do in JavaScript and then just try it out. Worst case it doesn’t work and you can bug us and we might even add it but for a lot of language constructs it will work as you expect.

Hope that helps!

2 Likes