help-jel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-jel] Factorial


From: Konstantin L. Metlov
Subject: Re: [Help-jel] Factorial
Date: Mon, 8 Aug 2016 14:52:31 +0300
User-agent: SquirrelMail/1.4.20

Yes, it is best to create an own function and export it to JEL namespace
via one of the "static library" classes.

Otherwise, since expressions have no syntax for looping, it is impossible
to code the integer factorial directly following its definition. However,
one can express in JEL a number of approximate formulas for it. Such as
Stirling formula:

round((sqrt(2*PI*n)*pow(n/E,n)))

, or even more precise Ramanujan formula:

round((sqrt(PI)*pow(n/E,n))*pow(((8*n + 4)*n + 1)*n + 1/30.,1./6.0))

. Both these formulas assume that java.lang.Math is exported to JEL
namespace as one of the static library classes.

With the best regards,
                            Konstantin.

> Hi,
> There is any possibility to calculate factorial function in JEL, i.e.:
> int x;int y;
> x = 5;y = "fact(x)";
> I have to create my own function ?
>
> Best,
> Ebtc
>
> _______________________________________________
> Help-jel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-jel
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]