Skip to content

Commit

Permalink
fix: update polynomial functions and fix function call
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte authored and Utkarsh Gupta committed Mar 7, 2024
1 parent bb3e47f commit be018c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"@stdlib/constants/float64/half-pi",
"@stdlib/constants/float64/pinf",
"@stdlib/math/base/special/sqrt",
"@stdlib/math/base/special/ln"
"@stdlib/math/base/special/ln",
"@stdlib/math/base/special/ellipk"
]
},
{
Expand All @@ -57,7 +58,8 @@
"@stdlib/constants/float64/half-pi",
"@stdlib/constants/float64/pinf",
"@stdlib/math/base/special/sqrt",
"@stdlib/math/base/special/ln"
"@stdlib/math/base/special/ln",
"@stdlib/math/base/special/ellipk"
]
},
{
Expand All @@ -74,7 +76,8 @@
"@stdlib/constants/float64/half-pi",
"@stdlib/constants/float64/pinf",
"@stdlib/math/base/special/sqrt",
"@stdlib/math/base/special/ln"
"@stdlib/math/base/special/ln",
"@stdlib/math/base/special/ellipk"
]
}
]
Expand Down
27 changes: 14 additions & 13 deletions lib/node_modules/@stdlib/math/base/special/ellipe/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*/

#include "stdlib/math/base/special/ellipe.h"
#include "stdlib/math/base/special/ellipk.h"
#include "stdlib/math/base/special/sqrt.h"
#include "stdlib/math/base/special/ln.h"
#include "stdlib/constants/float64/pinf.h"
Expand All @@ -71,7 +72,7 @@
* @return evaluated polynomial
*/
static double poly_p1( const double x ) {
return 1.5910034537907922 + (x * (0.41600074399178694 + (x * (0.24579151426410342 + (x * (0.17948148291490615 + (x * (0.14455605708755515 + (x * (0.12320099331242772 + (x * (0.10893881157429353 + (x * (0.09885340987159291 + (x * (0.09143962920174975 + (x * (0.0858425915954139 + (x * 0.08154111871830322)))))))))))))))))));
return 1.5509733517804722 + (x * (-0.4003010201031985 + (x * (-0.07849861944294194 + (x * (-0.034318853117591995 + (x * (-0.0197180433173655 + (x * (-0.01305950773199331 + (x * (-0.009442372874146548 + (x * (-0.007246728512402157 + (x * (-0.00580742401295609 + (x * -0.004809187786009338)))))))))))))))));
}

// END: poly_p1
Expand All @@ -91,7 +92,7 @@ static double poly_p1( const double x ) {
* @return evaluated polynomial
*/
static double poly_p2( const double x ) {
return 1.63525673226458 + (x * (0.4711906261487323 + (x * (0.3097284108314996 + (x * (0.2522083117731357 + (x * (0.22672562321968465 + (x * (0.21577444672958598 + (x * (0.21310877187734892 + (x * (0.21602912460518828 + (x * (0.2232558316330579 + (x * (0.23418050129420992 + (x * (0.24855768297226408 + (x * 0.26636380989261754)))))))))))))))))))));
return 1.5101218320928198 + (x * (-0.41711633390586755 + (x * (-0.09012382040477457 + (x * (-0.04372994401908431 + (x * (-0.027965493064761784 + (x * (-0.020644781177568104 + (x * (-0.016650786739707237 + (x * (-0.01426196082884252 + (x * (-0.012759847429264804 + (x * (-0.011799303775587354 + (x * -0.011197445703074968)))))))))))))))))));
}

// END: poly_p2
Expand All @@ -111,7 +112,7 @@ static double poly_p2( const double x ) {
* @return evaluated polynomial
*/
static double poly_p3( const double x ) {
return 1.685750354812596 + (x * (0.5417318486132803 + (x * (0.40152443839069024 + (x * (0.3696424734208891 + (x * (0.37606071535458363 + (x * (0.4052358870851259 + (x * (0.45329438175399905 + (x * (0.5205189476511842 + (x * (0.609426039204995 + (x * (0.7242635222829089 + (x * (0.8710138477098124 + (x * 1.057652872753547)))))))))))))))))))));
return 1.4674622093394272 + (x * (-0.43657629094633776 + (x * (-0.10515555766694255 + (x * (-0.05737184359324173 + (x * (-0.04139162772734022 + (x * (-0.03452772850528084 + (x * (-0.031495443512532785 + (x * (-0.030527000890325277 + (x * (-0.0309169840192389 + (x * (-0.03237139531475812 + (x * -0.03478996038640416)))))))))))))))))));
}

// END: poly_p3
Expand All @@ -131,7 +132,7 @@ static double poly_p3( const double x ) {
* @return evaluated polynomial
*/
static double poly_p4( const double x ) {
return 1.7443505972256133 + (x * (0.6348642753719353 + (x * (0.5398425641644455 + (x * (0.5718927051937874 + (x * (0.6702951362654062 + (x * (0.8325865900109772 + (x * (1.0738574482479333 + (x * (1.4220914606754977 + (x * (1.9203871834023047 + (x * (2.6325525483316543 + (x * (3.6521097473190394 + (x * (5.115867135558866 + (x * 7.224080007363877)))))))))))))))))))))));
return 1.4226911334908792 + (x * (-0.4595135196210487 + (x * (-0.12525053982206188 + (x * (-0.07813854509440948 + (x * (-0.06471427847205 + (x * (-0.06208433913173031 + (x * (-0.06519703281557247 + (x * (-0.07279389536257878 + (x * (-0.084959075171781 + (x * (-0.102539850131046 + (x * (-0.12705358515769605 + (x * -0.1607911206912746)))))))))))))))))))));
}

// END: poly_p4
Expand All @@ -151,7 +152,7 @@ static double poly_p4( const double x ) {
* @return evaluated polynomial
*/
static double poly_p5( const double x ) {
return 1.8138839368169826 + (x * (0.7631632457005573 + (x * (0.7619286053215958 + (x * (0.9510746536684279 + (x * (1.315180671703161 + (x * (1.9285606934774109 + (x * (2.9375093425313787 + (x * (4.594894405442878 + (x * (7.33007122188172 + (x * (11.871512597425301 + (x * (19.45851374822938 + (x * (32.20638657246427 + (x * (53.73749198700555 + (x * 90.27388602941)))))))))))))))))))))))));
return 1.3754019718711163 + (x * (-0.4872021832731848 + (x * (-0.15331170134854022 + (x * (-0.11184944491702783 + (x * (-0.10884095252313576 + (x * (-0.12295422312026907 + (x * (-0.15221716396203505 + (x * (-0.20049532364269734 + (x * (-0.27617433306775174 + (x * (-0.39351311430437586 + (x * (-0.5757544060278792 + (x * (-0.8605232357272398 + (x * -1.3088332057585401)))))))))))))))))))))));
}

// END: poly_p5
Expand All @@ -171,7 +172,7 @@ static double poly_p5( const double x ) {
* @return evaluated polynomial
*/
static double poly_p6( const double x ) {
return 1.8989249102715535 + (x * (0.9505217946182445 + (x * (1.1510775899590158 + (x * (1.7502391069863006 + (x * (2.952676812636875 + (x * (5.285800396121451 + (x * (9.83248571665998 + (x * (18.787148683275596 + (x * (36.61468615273698 + (x * (72.45292395127771 + (x * (145.1079577347069 + (x * (293.4786396308497 + (x * (598.385181505501 + (x * (1228.4200130758634 + (x * 2536.5297553827645)))))))))))))))))))))))))));
return 1.3250244979582302 + (x * (-0.5217276475575667 + (x * (-0.19490643048212622 + (x * (-0.17162372682201127 + (x * (-0.20275465292641914 + (x * (-0.27879895311853475 + (x * (-0.42069845728100574 + (x * (-0.675948400853106 + (x * (-1.1363431218392293 + (x * (-1.9767211439543984 + (x * (-3.5316967730957227 + (x * (-6.446753640156048 + (x * -11.97703130208884)))))))))))))))))))))));
}

// END: poly_p6
Expand All @@ -191,7 +192,7 @@ static double poly_p6( const double x ) {
* @return evaluated polynomial
*/
static double poly_p7( const double x ) {
return 2.0075983984243764 + (x * (1.2484572312123474 + (x * (1.9262346570764797 + (x * (3.7512896400875877 + (x * (8.119944554932045 + (x * (18.665721308735552 + (x * (44.603924842914374 + (x * (109.50920543094983 + (x * (274.2779548232414 + (x * (697.5598008606327 + (x * (1795.7160145002472 + (x * (4668.38171679039 + (x * (12235.762468136643 + (x * (32290.17809718321 + (x * (85713.07608195965 + (x * (228672.1890493117 + (x * 612757.2711915852)))))))))))))))))))))))))))))));
return 1.2707074796501499 + (x * (-0.5668391682878666 + (x * (-0.2621607934324926 + (x * (-0.2922441735330774 + (x * (-0.4403978408504232 + (x * (-0.7749476413813975 + (x * (-1.498870837987561 + (x * (-3.089708310445187 + (x * (-6.6675959033810015 + (x * (-14.89436036517319 + (x * (-34.18120574251449 + (x * (-80.15895841905397 + (x * (-191.34894807629848 + (x * (-463.5938853480342 + (x * -1137.38082216936)))))))))))))))))))))))))));
}

// END: poly_p7
Expand All @@ -211,7 +212,7 @@ static double poly_p7( const double x ) {
* @return evaluated polynomial
*/
static double poly_p8( const double x ) {
return 2.1565156474996434 + (x * (1.7918056418494632 + (x * (3.8267512874657132 + (x * (10.386724683637972 + (x * (31.403314054680703 + (x * (100.92370394986955 + (x * (337.3268282632273 + (x * (1158.7079305678278 + (x * (4060.9907421936323 + (x * (14454.001840343448 + (x * (52076.661075994045 + (x * (189493.65914621568 + (x * (695184.5762413896 + (x * (2567994.048255285 + (x * (9541921.966748387 + (x * (35634927.44218076 + (x * (133669298.46120408 + (x * (503352186.68662846 + (x * (1901975729.53866 + (x * 7208915015.330104)))))))))))))))))))))))))))))))))))));
return 1.2110560275684594 + (x * (-0.6303064132874558 + (x * (-0.38716640952066916 + (x * (-0.5922782353119346 + (x * (-1.23755558451305 + (x * (-3.0320566617452474 + (x * (-8.18168822157359 + (x * (-23.55507217389693 + (x * (-71.04099935893065 + (x * (-221.879685319235 + (x * (-712.1364793277636 + (x * (-2336.1253314403966 + (x * (-7801.945954775964 + (x * (-26448.19586059192 + (x * (-90799.48341621365 + (x * (-315126.04064491636 + (x * -1104011.3443115912)))))))))))))))))))))))))))))));
}

// END: poly_p8
Expand All @@ -231,7 +232,7 @@ static double poly_p8( const double x ) {
* @return evaluated polynomial
*/
static double poly_p9( const double x ) {
return 2.3181226217125106 + (x * (2.6169201502912327 + (x * (7.897935075731356 + (x * (30.502397154466724 + (x * (131.48693655235286 + (x * (602.9847637356492 + (x * (2877.024617809973 + (x * (14110.519919151804 + (x * (70621.4408815654 + (x * (358977.266582531 + (x * (1847238.2637239718 + (x * (9600515.416049214 + (x * (50307677.08502367 + (x * (265444188.6527128 + (x * (1408862325.0287027 + (x * 7515687935.373775)))))))))))))))))))))))))))));
return 1.1613071521962828 + (x * (-0.7011002845552895 + (x * (-0.5805514744654373 + (x * (-1.2436930610777865 + (x * (-3.679383613496635 + (x * (-12.815909243378957 + (x * (-49.25672530759985 + (x * (-202.18187354340904 + (x * (-869.8602699308701 + (x * (-3877.0058473132895 + (x * (-17761.7071017094 + (x * (-83182.69029154233 + (x * (-396650.4505013548 + (x * -1920033.4136826345)))))))))))))))))))))))));
}

// END: poly_p9
Expand All @@ -251,7 +252,7 @@ static double poly_p9( const double x ) {
* @return evaluated polynomial
*/
static double poly_p10( const double x ) {
return 2.473596173751344 + (x * (3.727624244118099 + (x * (15.607393035549306 + (x * (84.12850842805888 + (x * (506.98181970406137 + (x * (3252.2770581451236 + (x * (21713.242419574344 + (x * (149037.04518909327 + (x * (1043999.3310899908 + (x * (7427974.817042039 + (x * (53503839.67558661 + (x * (389249886.99487084 + (x * (2855288351.1008105 + (x * (21090077038.76684 + (x * (156699833947.7902 + (x * (1170222242422.44 + (x * (8777948323668.9375 + (x * (66101242752484.95 + (x * (499488053713388.8 + (x * 37859743397240296.0)))))))))))))))))))))))))))))))))))));
return 1.1246173251197522 + (x * (-0.7708450563609095 + (x * (-0.8447940536449113 + (x * (-2.4900973094503946 + (x * (-10.239717411543843 + (x * (-49.7490054655148 + (x * (-267.09866751957054 + (x * (-1532.66588382523 + (x * (-9222.313478526092 + (x * (-57502.51612140314 + (x * (-368596.11674161063 + (x * (-2415611.0887010912 + (x * (-16120097.815816568 + (x * (-109209938.52030899 + (x * (-749380758.1942496 + (x * (-5198725846.725541 + (x * -36409256888.1214)))))))))))))))))))))))))))))));
}

// END: poly_p10
Expand All @@ -271,7 +272,7 @@ static double poly_p10( const double x ) {
* @return evaluated polynomial
*/
static double poly_p11( const double x ) {
return 0.0 + (x * (0.0625 + (x * (0.03125 + (x * (0.0205078125 + (x * (0.01513671875 + (x * (0.011934280395507812 + (x * (0.009816169738769531 + (x * (0.008315593004226685 + (x * (0.007199153304100037 + (x * (0.00633745662344154 + (x * (0.00565311038371874 + (x * (0.005097046040418718 + (x * (0.004636680381850056 + (x * (0.004249547423822886 + (x * 0.003919665602267974)))))))))))))))))))))))))));
return 1.5910034537907922 + (x * (0.41600074399178694 + (x * (0.24579151426410342 + (x * (0.17948148291490615 + (x * (0.14455605708755515 + (x * (0.12320099331242772 + (x * (0.10893881157429353 + (x * (0.09885340987159291 + (x * (0.09143962920174975 + (x * (0.0858425915954139 + (x * 0.08154111871830322)))))))))))))))))));
}

// END: poly_p11
Expand All @@ -291,7 +292,7 @@ static double poly_p11( const double x ) {
* @return evaluated polynomial
*/
static double poly_p12( const double x ) {
return 1.5910034537907922 + (x * (0.41600074399178694 + (x * (0.24579151426410342 + (x * (0.17948148291490615 + (x * (0.14455605708755515 + (x * (0.12320099331242772 + (x * (0.10893881157429353 + (x * (0.09885340987159291 + (x * (0.09143962920174975 + (x * (0.0858425915954139 + (x * 0.08154111871830322)))))))))))))))))));
return 1.5509733517804722 + (x * (-0.4003010201031985 + (x * (-0.07849861944294194 + (x * (-0.034318853117591995 + (x * (-0.0197180433173655 + (x * (-0.01305950773199331 + (x * (-0.009442372874146548 + (x * (-0.007246728512402157 + (x * (-0.00580742401295609 + (x * -0.004809187786009338)))))))))))))))));
}

// END: poly_p12
Expand Down Expand Up @@ -356,7 +357,7 @@ double stdlib_base_ellipe( const double m ) {
td = 0.95 - x;
kdm = poly_p11( td );
edm = poly_p12( td );
km = stdlib_base_ellipe( x );
km = stdlib_base_ellipk( x );

// To avoid precision loss near 1, we use Eq. 33 from Fukushima (2009):
t = ( STDLIB_CONSTANT_FLOAT64_HALF_PI + ( km * (kdm - edm) ) ) / kdm;
Expand Down

0 comments on commit be018c2

Please sign in to comment.