Commit c7c3a213 authored by Christophe Geuzaine's avatar Christophe Geuzaine

Merge branch 'addSphericalBesselFunctions' into 'master'

add spherical Bessel for use in .pro

See merge request !46
parents 6fc30e19 f721e340
Pipeline #1865 passed with stage
in 22 minutes and 47 seconds
......@@ -955,6 +955,10 @@ struct StringXFunction2Nbr F_Function[] = { /* #Par #Arg */
{"Yn" , (CAST)F_Yn , 0, 2 },
{"dJn" , (CAST)F_dJn , 0, 2 },
{"dYn" , (CAST)F_dYn , 0, 2 },
{"JnSph" , (CAST)F_JnSph , 0, 2 },
{"YnSph" , (CAST)F_YnSph , 0, 2 },
{"dJnSph" , (CAST)F_dJnSph , 0, 2 },
{"dYnSph" , (CAST)F_dYnSph , 0, 2 },
// F_ExtMath
{"Hypot" , (CAST)F_Hypot , 0, 2 },
......
......@@ -133,6 +133,10 @@ void F_JnComplex (F_ARG) ;
void F_Yn (F_ARG) ;
void F_dJn (F_ARG) ;
void F_dYn (F_ARG) ;
void F_JnSph (F_ARG) ;
void F_YnSph (F_ARG) ;
void F_dJnSph (F_ARG) ;
void F_dYnSph (F_ARG) ;
/* F_ExtMath */
......
......@@ -302,3 +302,55 @@ void F_dYn(F_ARG)
}
V->Type = SCALAR;
}
/* ------------------------------------------------------------------------ */
/* Spherical Bessel functions jn, yn and their derivatives */
/* ------------------------------------------------------------------------ */
void F_JnSph(F_ARG)
{
if(A->Type != SCALAR || (A+1)->Type != SCALAR)
Message::Error("Non scalar argument(s) for function 'JnSph' (spherical Bessel function)");
int n = (int)A->Val[0];
double x = (A+1)->Val[0];
V->Type = SCALAR;
V->Val[0] = Spherical_j_n(n, x);
}
void F_YnSph(F_ARG)
{
if(A->Type != SCALAR || (A+1)->Type != SCALAR)
Message::Error("Non scalar argument(s) for function 'YnSph' (spherical Bessel function)");
int n = (int)A->Val[0];
double x = (A+1)->Val[0];
V->Type = SCALAR;
V->Val[0] = Spherical_y_n(n, x);
}
void F_dJnSph(F_ARG)
{
if(A->Type != SCALAR || (A+1)->Type != SCALAR)
Message::Error("Non scalar argument(s) for function 'dJnSph' (derivative of spherical Bessel function)");
int n = (int)A->Val[0];
double x = (A+1)->Val[0];
V->Type = SCALAR;
V->Val[0] = (n/x) * Spherical_j_n(n, x) - Spherical_j_n(n+1, x);
}
void F_dYnSph(F_ARG)
{
if(A->Type != SCALAR || (A+1)->Type != SCALAR)
Message::Error("Non scalar argument(s) for function 'dYnSph' (derivative of spherical Bessel function)");
int n = (int)A->Val[0];
double x = (A+1)->Val[0];
V->Type = SCALAR;
V->Val[0] = (n/x) * Spherical_y_n(n, x) - Spherical_y_n(n+1, x);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment