Recent

Author Topic: Wolfgang Ehrhard's lib: hypergeometric https://github.com/chadilukito/www.wolfga  (Read 1058 times)

sedsil

  • New Member
  • *
  • Posts: 11
I am interested in the Hypergeometric2F1 functions(unit sfHyperG) of "Wolfgang Ehrhard's lib: hypergeometric https://github.com/chadilukito/www.wolfgang-ehrhardt.de/blob/master/src/misc/amath/sfhyperg.pas". I have downloaded it, but it could not be compiled by Lazarus 4.0 Pascal. So, I tried to compile it step by step to overcome some lines, and saved ( save as) it. Today, I see that it is the same as the previous, not saved. Here, The Unit "sfHyperG" uses Amath unit.  It is the Amath unit that I can not compile. This is my principal problem. Is there anyone to help me?. If you want to know what happened, please download the unit sfHyperG from the concerned website and try to compile it. I hope someone is interested in it

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12893
  • FPC developer.
Quote
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling sfhyperg.pas
Compiling amath.pas
amath.pas(2863,14) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(3841,6) Note: Call to subroutine "function IsNaNorInf(x:Extended):Boolean;" marked as inline is not inlined
amath.pas(3841,23) Note: Call to subroutine "function IsNaNorInf(x:Extended):Boolean;" marked as inline is not inlined
amath.pas(3857,21) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(3869,21) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(4066,5) Note: Call to subroutine "procedure xxto2x(a:Extended;b:Extended;var x:ext2);" marked as inline is not inlined
amath.pas(4136,3) Note: Call to subroutine "procedure xxto2x(a:Extended;b:Extended;var x:ext2);" marked as inline is not inlined
amath.pas(4151,5) Note: Call to subroutine "procedure xxto2x(a:Extended;b:Extended;var x:ext2);" marked as inline is not inlined
amath.pas(4155,5) Note: Call to subroutine "procedure sub2x(const a:ext2;const b:ext2;var x:ext2);" marked as inline is not inlined
amath.pas(4750,10) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(4886,10) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
Compiling sfbasic.pas
Compiling amtools.pas
Compiling memh.pas
Compiling sfgamma.pas
Compiling sfzeta.pas
Compiling sfpoly.pas
Compiling sfellint.pas
Compiling sfmisc.pas
Compiling sfgamma2.pas
Compiling sfexpint.pas
Compiling sferf.pas
Compiling sfbessel.pas
49957 lines compiled, 0.3 sec
11 note(s) issued

Compiles fine.  Probably needs default mode, because lazarus forces -S2. Set the mode in the compiler options, or adds {$mode fpc} to the {$ifdef fpc} in std.inc

tetrastes

  • Hero Member
  • *****
  • Posts: 766
First of all it needs i386/387:
Quote
AMath is designed for the 80-bit extended data type, and therefore
cannot be used with 64-bit code on 64-bit system (for these use the
corresponding DAMath package).
I suppose that OP compiles for other arch.

sedsil

  • New Member
  • *
  • Posts: 11
Quote
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling sfhyperg.pas
Compiling amath.pas
amath.pas(2863,14) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(3841,6) Note: Call to subroutine "function IsNaNorInf(x:Extended):Boolean;" marked as inline is not inlined
amath.pas(3841,23) Note: Call to subroutine "function IsNaNorInf(x:Extended):Boolean;" marked as inline is not inlined
amath.pas(3857,21) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(3869,21) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(4066,5) Note: Call to subroutine "procedure xxto2x(a:Extended;b:Extended;var x:ext2);" marked as inline is not inlined
amath.pas(4136,3) Note: Call to subroutine "procedure xxto2x(a:Extended;b:Extended;var x:ext2);" marked as inline is not inlined
amath.pas(4151,5) Note: Call to subroutine "procedure xxto2x(a:Extended;b:Extended;var x:ext2);" marked as inline is not inlined
amath.pas(4155,5) Note: Call to subroutine "procedure sub2x(const a:ext2;const b:ext2;var x:ext2);" marked as inline is not inlined
amath.pas(4750,10) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
amath.pas(4886,10) Note: Call to subroutine "function copysign(x:Extended;y:Extended):Extended;" marked as inline is not inlined
Compiling sfbasic.pas
Compiling amtools.pas
Compiling memh.pas
Compiling sfgamma.pas
Compiling sfzeta.pas
Compiling sfpoly.pas
Compiling sfellint.pas
Compiling sfmisc.pas
Compiling sfgamma2.pas
Compiling sfexpint.pas
Compiling sferf.pas
Compiling sfbessel.pas
49957 lines compiled, 0.3 sec
11 note(s) issued

Compiles fine.  Probably needs default mode, because lazarus forces -S2. Set the mode in the compiler options, or adds {$mode fpc} to the {$ifdef fpc} in std.inc
I did what you said me in the std.inc :

{$ifdef FPC}
  {$mode fpc}
  {$define FPC_ProcVar}
  {$define ABSTRACT}
  {$define HAS_XTYPES}
  {$define HAS_OVERLOAD}
  {$define HAS_FP_CAST}
  {$undef N_OPT}
  {$ifdef VER1}
    {$undef  J_OPT}
    {$define HAS_INT64}
    {$define HAS_CARD32}
    {$define HAS_MSG}
    {$define HAS_ASSERT}
    {$ifndef VER1_0}
      {FPC 1.9.x}
      {$define StrictLong}
    {$else}
      {$define LoadArgs}
    {$endif}
when compiling, it gives me the error message for the Amath.pas (unit file) :Compile Project, Target: C:\PASCAL\hfr2025MKL_V1.exe: Exit code 1, Errors: 50, Warnings: 6
amath.pas(1610,7) Error: Assembler syntax error in operand
amath.pas(1610,9) Error: Assembler syntax error in operand
amath.pas(1620,11) Error: Assembler syntax error in operand
amath.pas(1620,13) Error: Assembler syntax error in operand
amath.pas(1716,11) Error: Assembler syntax error in operand
amath.pas(1716,13) Error: Assembler syntax error in operand
amath.pas(1718,11) Error: Unknown identifier "ST"
amath.pas(1718,14) Error: Unknown identifier "ST"
amath.pas(1718,18) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
amath.pas(1720,11) Error: Unknown identifier "QWORD"
amath.pas(1720,21) Error: Assembler syntax error in operand
amath.pas(1720,28) Error: Assembler syntax error in operand
amath.pas(1721,11) Error: Unknown identifier "ST"
amath.pas(1721,14) Error: Unknown identifier "ST"
amath.pas(1721,18) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
amath.pas(1722,11) Error: Unknown identifier "ST"
amath.pas(1722,17) Error: Unknown identifier "ST"
amath.pas(1722,17) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
amath.pas(1723,11) Error: Unknown identifier "QWORD"
amath.pas(1723,21) Error: Assembler syntax error in operand
amath.pas(1723,28) Error: Assembler syntax error in operand
amath.pas(1724,11) Error: Unknown identifier "ST"
amath.pas(1724,15) Error: Unknown identifier "ST"
amath.pas(1724,19) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
amath.pas(1725,11) Error: Unknown identifier "ST"
amath.pas(1725,17) Error: Unknown identifier "ST"
amath.pas(1725,17) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
amath.pas(1726,11) Error: Unknown identifier "ST"
amath.pas(1728,11) Error: Unknown identifier "ST"
amath.pas(1728,17) Error: Unknown identifier "ST"
amath.pas(1728,17) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
amath.pas(1736,11) Error: Unknown identifier "ST"
amath.pas(1740,11) Error: Unknown identifier "AX"
amath.pas(1742,11) Error: Assembler syntax error in operand
amath.pas(1742,12) Error: Assembler syntax error in operand
amath.pas(1742,13) Error: Invalid reference syntax
amath.pas(1743,11) Error: Unknown identifier "ST"
amath.pas(1745,11) Error: Assembler syntax error in operand
amath.pas(1745,16) Error: Assembler syntax error in operand
amath.pas(1746,11) Error: Unknown identifier "AX"
amath.pas(1748,11) Error: Assembler syntax error in operand
amath.pas(1748,12) Error: Assembler syntax error in operand
amath.pas(1748,13) Error: Invalid reference syntax
amath.pas(1749,11) Error: Unknown identifier "ST"
amath.pas(1749,14) Error: Unknown identifier "ST"
amath.pas(1750,11) Error: Assembler syntax error in operand
amath.pas(1750,12) Error: Assembler syntax error in operand
amath.pas(1750,13) Error: Invalid reference syntax
amath.pas(1751,1) Error: Unrecognized opcode
amath.pas(1751,1) Error: Assembler syntax error
amath.pas(1754,11) Error: Unknown identifier "DWORD"
amath.pas(1754,21) Error: Assembler syntax error in operand
amath.pas(1754,26) Error: Assembler syntax error in operand
amath.pas(1756,11) Error: Unknown identifier "ST"
amath.pas(1757,11) Error: Unknown identifier "DWORD"
amath.pas(1757,21) Error: Assembler syntax error in operand
Probably, I am making an important mistake, but I will not find it in case you don't direct meI am making a mistake, but I can not find it in case you dont direct me

tetrastes

  • Hero Member
  • *****
  • Posts: 766
You compile for x86_64. Once more:

First of all it needs i386/387:
Quote
AMath is designed for the 80-bit extended data type, and therefore
cannot be used with 64-bit code on 64-bit system (for these use the
corresponding DAMath package).
I suppose that OP compiles for other arch.

wp

  • Hero Member
  • *****
  • Posts: 13544
Looking at the folder structure in the repository I see that there is a folder damath parallel zu amath. While amath contains "high-precision" routines, double-precision routines are contained in dmath. And there is also a hypergeometric unit, named sdhyperg.pas containing
Code: Pascal  [Select][+][-]
  1. function sfd_1f1(a,b,x: double): double;
  2.   {-Return the confluent hypergeometric function 1F1(a,b,x); Kummer's function M(a,b,x)}
  3.  
  4. function sfd_1f1r(a,b,x: double): double;
  5.   {-Return the regularized Kummer hypergeometric function 1F1(a,b,x)/Gamma(b)}
  6.  
  7. function sfd_2f1(a,b,c,x: double): double;
  8.   {-Return the Gauss hypergeometric function 2F1(a,b;c;x)}
  9.  
  10. function sfd_2f1r(a,b,c,x: double): double;
  11.   {-Return the regularized Gauss hypergeometric function 2F1(a,b,c,x)/Gamma(c)}
  12.  
  13. function sfd_chu(a,b,x: double): double;
  14.   {-Return Tricomi's confluent hypergeometric function U(a,b,x). If}
  15.   { x<0, then a must be an integer and a<0 or 1+a-b an integer < 0.}
  16.  
  17. function sfd_whitm(k,m,x: double): double;
  18.   {-Return the Whittaker M function = exp(-x/2)*x^(0.5+m) * 1F1(m-k-0.5,2m+1,x)}
  19.  
  20. function sfd_whitw(k,m,x: double): double;
  21.   {-Return the Whittaker W function = exp(-x/2)*x^(0.5+m) * U(m-k-0.5,2m+1,x)}
  22.  
  23. function sfd_0f1(b,x: double): double;
  24.   {-Return the confluent hypergeometric limit function 0F1(;b;x)}
  25.  
  26. function sfd_0f1r(b,x: double): double;
  27.   {-Return the regularized confluent hypergeometric limit function 0F1(;b;x)/Gamma(b)}
  28.  
  29. function sfd_2f0(a,b,x: double): double;
  30.   {-Return 2F0(a,b,x), if x>0 then a or b must be a negative integer}
  31.  
  32. function sfd_pcfd(v,x: double): double;
  33.   {-Return Whittaker's parabolic cylinder function D_v(x)}
  34.  
  35. function sfd_pcfu(a,x: double): double;
  36.   {-Return the parabolic cylinder function U(a,x)}
  37.  
  38. function sfd_pcfv(a,x: double): double;
  39.   {-Return the parabolic cylinder function V(a,x) with 2a integer}
  40.  
  41. function sfd_pcfhh(v,x: double): double;
  42.   {-Return the Hermite function H_v(x) of degree v}
  43.  
This should compile an 32bit and 64bit. (At least, I was able to compile and run the t_tamall demo test in src/misc/damath/tests in a 32-bit and a 64-bit IDE on Windows 11).
« Last Edit: August 04, 2025, 02:01:43 pm by wp »

LV

  • Sr. Member
  • ****
  • Posts: 427
Simply unzip the attached project, compile, and run (32-bit or 64-bit). Enjoy  ;)

Code: Pascal  [Select][+][-]
  1. program TestHyperG;
  2.  
  3. uses
  4.   SysUtils, sdHyperG;
  5.  
  6. var
  7.   a, b, c, z, res: double;
  8.  
  9. begin
  10.   a := 1.0;
  11.   b := 1.0;
  12.   c := 2.0;
  13.   z := 0.5;
  14.  
  15.   res := sfd_2f1(a, b, c, z);
  16.  
  17.   Writeln('2F1(', a:0:2, ', ', b:0:2, '; ', c:0:2, '; ', z:0:2, ') = ', res:0:10);
  18.   Readln;
  19. end.
  20.  

Output:

Code: Text  [Select][+][-]
  1. 2F1(1.00, 1.00; 2.00; 0.50) = 1.3862943611
  2.  

« Last Edit: August 04, 2025, 02:40:49 pm by LV »

 

TinyPortal © 2005-2018