Trigonometric functions

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Trigonometric functions

Post by madcyborg » Sun Oct 20, 2019 3:29 pm

Would it be possible to fill out the rest of the trigonometric functions?
Yes, I know that you can calculate some from the others, but I'm only mediocre in mathematics. I'm using formulas.

The purpose here is, I have an application with a radial dial, and I want to calculate offsets by providing the position on the circle. Needs trig. Thanks.

By the way, absolutely love macro scheduler. I had my own rickety scripts for doing smart home stuff (my personal home), but I needed something more powerful that would allow me to glue together all of these different applications and cloud systems. And it's awfully nice writing with a ready to go library. :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Trigonometric functions

Post by Dorian (MJT support) » Mon Oct 21, 2019 10:15 am

I consulted Marcus about this, and he suggests it's a perfect candidate for python. A good starting point would be PyExec
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Trigonometric functions

Post by JRL » Thu Oct 24, 2019 5:17 am

Could just create subroutines for each trig function you want to use. These three usually get me by. You might have to set the function result to a variable then use the variable in your formula similar to the way the result variables are used in the ending message below.

Code: Select all

input>Angle,Angle in Degrees,0


GoSub>Cosine,Angle
GoSub>Sine,Angle
GoSub>Tangent,Angle

SRT>Cosine
  Let>Cos={cos((pi/180)*%Cosine_var_1%)}
END>Cosine

SRT>Sine
  Let>sin={sin((pi/180)*%Sine_var_1%)}
END>Sine

SRT>Tangent
  Let>Tan={(sin((pi/180)*%Tangent_var_1%))/(cos((pi/180)*%Tangent_var_1%))}
END>Tangent


Let>MSG_WIDTH=320
MDL>Cosine of %Angle%=%tab%%Cos%%CRLF%Sine of  %Angle%=%tab%%sin%%CRLF%Tangent of %Angle%=%tab%%Tan%

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts