forum.alglib.net
http://forum.alglib.net/

ALGLIB port for AutoIt
http://forum.alglib.net/viewtopic.php?f=2&t=2122
Page 1 of 1

Author:  ValeryVal [ Wed Aug 27, 2014 8:31 am ]
Post subject:  ALGLIB port for AutoIt

Hi, Sergey!

You wrote in FAQ:
X-generator is another tool developed exclusively for ALGLIB. It is a generator of wrappers for the C/C# computational cores. This generator is heavily used by Python and VB.NET releases of ALGLIB. It is also used to generate doctests - code snippets, which are used as both examples (doc) and test suite (tests).

Both technologies are kept private, but result we've got with these tools - ALGLIB - is freely available under GPL.


Recently I've manually rewritten function ExponentialIntegralEN from ALGLIB (alglib-2.6.0.vb6.zip) into AutoIt. It works fine. Thanks.

Image
About AutoIt scripting language read here, please:www.autoitscript.com
AutoIt v3 is a freeware BASIC-like scripting language.


Would you like to expand the X-generator for AutoIt (v3) code creation?

Cheers,
Valery

Code:
;===========================================
; E1 <= E_n-Function for n = 1
; http://mathworld.wolfram.com/En-Function.html
; It defined as special case of the exponential integral Ei(x)
; E1(x) = -Ei(-x)
; Rewritten from ExponentialIntegralEN (ALGLIB)
Func E1($x)
Local $Result, $r, $t
Local $yk, $xk, $pk, $pkm1, $pkm2, $qk, $qkm1, $qkm2
Local $psi = 0, $z, $i, $k, $big, $EUL
Local Const $MachineEpsilon = 1.11e-16

    $EUL = 0.57721566490153286060
    $big = 1.44115188075855872e17
    If $x<0 Or $x>170 Or $x=0 then return -1

    If $x<=1 then
        $psi = -$EUL-Log($x)
        $z = -$x
        $xk = 0
        $yk = 1
        $pk = 0
        $Result = 0.0
        Do
         $xk += 1
         $yk *= $z/$xk
         $pk += 1
         If $pk<>0 then $Result += $yk/$pk
         If $Result<>0 then
          $t = Abs($yk/$Result)
         Else
          $t = 1
         EndIf
        Until $t<$MachineEpsilon

        $t = 1
        $Result = $psi*$t-$Result
        return $Result
    Else
        $k = 1
        $pkm2 = 1
        $qkm2 = $x
        $pkm1 = 1.0
        $qkm1 = $x+1
        $Result = $pkm1/$qkm1
        Do
            $k += 1
            If Mod($k,2)=1 then
              $yk = 1
              $xk = 1+($k-1)/2
            Else
              $yk = $x
              $xk = $k/2
            Endif
            $pk = $pkm1*$yk+$pkm2*$xk
            $qk = $qkm1*$yk+$qkm2*$xk
            If $qk<>0 then
                $r = $pk/$qk
                $t = Abs(($Result-$r)/$r)
                $Result = $r
            Else
                $t = 1
            EndIf
            $pkm2 = $pkm1
            $pkm1 = $pk
            $qkm2 = $qkm1
            $qkm1 = $qk
            If Abs($pk) > $big then
                $pkm2 /= $big
                $pkm1 /= $big
                $qkm2 /= $big
                $qkm1 /= $big
            EndIf
        Until $t<$MachineEpsilon
        $Result *= exp(-$x)
    EndIf
    return $Result
EndFunc

Author:  Sergey.Bochkanov [ Fri Aug 29, 2014 7:22 am ]
Post subject:  Re: ALGLIB port for AutoIt

Hello!

Because AutoIt is a scripting language, I don't think that there will be large demand for scientific functionality. From the other side, having one more supported language adds significant amount of work if we want to change something fundamental in the ALGLIB. So, I think that ALGLIB for AutoIt is not really needed.

Author:  ValeryVal [ Fri Aug 29, 2014 7:50 am ]
Post subject:  Re: ALGLIB port for AutoIt

> So, I think that ALGLIB for AutoIt is not really needed.
Maybe you are right, maybe... In any case I have hands and head to rewrite any software for my needs. Thank you for kindly tip.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/