Using the exponential function in NAV

Hi everyone,

I am developping a fuction for the need of a customer. The function involves the mathemathic exponential function (exp(x)).

Is there an inner function to do that in NAV? otherwise,what shall I do???

Did anyone encounter this problem??

Thanks in advance :)

hi,

use the power function.
http://msdn.microsoft.com/en-us/library/dd339086.aspx

have also a look at:
http://www.advanced-business-systems.com/Resources/Blog/tabid/144/EntryId/172/NAV-C-AL-Math-Functions.aspx
http://www.mibuso.com/dlinfo.asp?FileID=745

best regards

Have you looked at the POWER function?

Yes, but that is not what I need…what I need to calculate is the exponential function:

x ↦ ex

hi,

check http://msdn.microsoft.com/en-us/library/dd339086.aspx

try

expXYValue := POWER(2, 4); // = 16

MESSAGE(FORMAT(expXYValue));

expXYValue := POWER(64, 0.5); // = 8

MESSAGE(FORMAT(expXYValue));

best regards

Thank you for your reply but again, that is not what I need…

I need this:

http://en.wikipedia.org/wiki/Exponential_function

then you’ll need that

http://www.mibuso.com/dlinfo.asp?FileID=745

Hi Poppins,

Yes, it’s clear that your requirement is larger than just implementing the POWER function. From the link you cited, the most common form of the computation you’re after looks like POWER(e, x), where e is Euler’s number, a number (approximately 2.718281828) and x is whatever value your business case says it is. Would your feature suffer excessively by using this approximation for e?

I’ve never come across a native NAV function for this calculation. If you’re not able to replicate the expression using NAV functions, perhaps it would be more easily accomplished thru a custom automation control?

Yes Frank, if the constant values for e (2.7182818284590452353603) and Euler (0.5772156649015328606065) supplied in the Math Library you cited are sufficiently precise for the application in which they’ll be used, then yes, that library would work. That being the case, Poppins could also just use these literal constants within his code. So Poppins, what we don’t yet know is how precise do your values for these two numbers need to be for your application to be effective?

so it seems that you not only want the exponential function, but a function plotter/printer like in mathcad. that’s not a standard ability of NAV. but you can calculate the basis for that function and write the values to a table.

create a table with fields x and y (decimals).
write some code (loop) to get x values from 1 to 1000 or something like that.
then with y := power(2.717182818,x) you get the y values.

use then this table as data base for diagrams. that is no big thing in nav 2013.