Mathematical functions power
Forums › ProRealTime English forum › ProBuilder support › Mathematical functions power
- This topic has 9 replies, 4 voices, and was last updated 7 years ago by Maz.
-
-
03/31/2017 at 3:06 PM #3053503/31/2017 at 3:23 PM #30539
Unfortunately no, this is a already a query for new instruction in the users wish list: https://www.prorealcode.com/topic/centralization-of-queries-and-suggestions-on-prorealtime/
The best you could do to get the result of this math function is by making a loop like this:
1234567891011121314number=4pow=3result=0i=1while i<pow doif i=1 thenresult=numberendifresult=result*numberi=i+1wendreturn resultLet me know if it’s clear for you.
03/31/2017 at 3:43 PM #30547Hi Nicolas
Thanks for the prompt reply!
I have found a mathematical equivalent if the Prorealtime LOG function (called Napierian log in the manual) is actually the common LN function:
y = x^p = e^(p*LN(x))
This could then be coded as:
y = EXP(p*LOG(x))
This works fine.
W
04/02/2017 at 10:32 AM #3068004/03/2017 at 7:30 AM #3077805/03/2017 at 1:34 PM #3441605/03/2017 at 2:14 PM #34426I have a power function like this?
123456789101112131415161718// n = 2// x = 3// r = n^xonce j = x-1r = nif x > 0 thenfor i = 1 to j dor = (r * n)nextelsefor i = 1 to j dor = (r / n)nextendifreturn r1 user thanked author for this post.
05/03/2017 at 2:15 PM #34428Here’s tanh (subsequently sinh and cosh)
12345678910111213// x = 2// result = tanh(x)once e = exp(1)mx = x * -1eX = CALL fnPower[e, x]eXm = CALL fnPower[e, mx]sinh = 0.5* (eX - eXm)cosh = 0.5* (ex + eXm)tanh = sinh / coshreturn tanhSee above for powers
05/03/2017 at 2:52 PM #3443905/03/2017 at 9:51 PM #34483 -
AuthorPosts
Find exclusive trading pro-tools on