how can I add trig function calculator with taifun math extension?

Can anyone help me to show how to add trig function to the calculator app?

an example from the documentation App Inventor Extensions: Math Parser | Pura Vida Apps

Unbenannt

See the details of the mXparser built-in math collection here...

Taifun

2 Likes

how can I calculate sin 45 on my calculator? can you please tell me the code for that?

In the math drawer, find the sin block.

image


I am trying to make this calculator. I cannot add sin cos and tan calculation. The value of sin 45 is 0.707. But this is showing 0.85. Can you please help me about that?

I have still not learned sin and cos in math class, but I did an online calculation.

image

The returned result is a 4-decimal-digit approximation.

However, I also saw this in a Google result:

1/√2

FAQs on Sin 45 Degrees

Sin 45 degrees is the value of sine trigonometric function for an angle equal to 45 degrees. The value of sin 45° is 1/√2 or 0.7071 (approx).

Probably, App Inventor has calculated sin(45 radians).

So, what about this?

image

Thank you so much. it is calculating the radian value. I don't know why but I get something right

does the log function work by using taifun math expression?

You could simply use convert radians to degrees block form math drawer

image

As for log, block returns the natural logarithm of a given number, that is, the logarithm to the base e
If you wish to use log10
See

1 Like

yes of course
and the App Inventor blocks also work fine in case this is the question... however remember the difference between natural log and log base 10...

Taifun

If you are in doubt as to the details of a math block, hover your cursor over it in the Blocks Editor to see its tool tip.

http://ai2.appinventor.mit.edu/reference/blocks/math.html#sin

My log function is working by using taifun extension. But, I am getting sin(x), cos(x), tan(x) radian value. Is there any way to get degree result with taifun extension?

For example: cos(45) = 0.52532 but I wanna see cos(45) = 0.707

try to find the answer yourself by reading the documentration of the library here Math Collection | mXparser – Math Expressions Parser for JAVA Android C# Kotlin .NET/MONO/Xamarin – Mathematical Formula Parser / Evaluator Library

and you always can use this solution

Taifun

that is not a useful solution when i use the text string parser function.
i see in C there are settings like setDegreesMode
how can i do that in ai2?

i tried all permutations without success
please help

Unfortunately the extension does not offer this feature

You can check the clones of this extension

Or

Alternatively see this answer

Taifun

Taifun,
thanks for the quick and helpful answer. it is very unfortunate that this feature is not in there because adding it externally is very hard to control in my environment.
any chance this could be added in the future?

erhard

Show an example of your calculation.

What is "special" about your "environment" ?