# Math issue

Hi,

Ok, I tried to script:

100 * (sin (2 * pi * (10000 / 23)))

but without success. Whats wrong? Osax_additions do not behave like applications. (e.g. with tell statement)
also
using terms from scriptiong addition “satimage”

Hi,

Restart Script Editor and the script will compile.

Scripting Additions behave like native AppleScript commands, no tell or using terms from blocks

You don’t need a scripting addition at all really. The command line has a tool called bc, and bc can do math. To perform advanced functions in bc use the “-l” switch which uses a math library with bc… for example if you need the sine function s() in bc. The basic way to use bc is to echo the math equation and pipe that to bc. As such the following would work without any scripting additions

``````set theDegrees to 30
set theRadians to theDegrees * pi / 180
set theSine to do shell script "echo \"s(" & (theRadians as text) & ")\" | bc -l"
``````

regulus6633,

thats kind from you: i like it to solve problems without additions, using the tools i own.

You don’t even need to use the shell:

set y to 100 * (getSine(2 * pi * (10000 / 23)))

on getSine(n)
set x to n mod pi
set numerator to x
set denominator to 1
set factor to -(x ^ 2)

``````repeat with i from 3 to 40 by 2
set numerator to numerator * factor
set denominator to denominator * i * (i - 1)
end repeat
if n mod (2 * pi) > pi then