Package maths_fns :: Module pseudo_ellipse
[hide private]
[frames] | no frames]

Module pseudo_ellipse

source code

Module for the pseudo-elliptical functions.

Functions [hide private]
int
factorial(n)
Return n!
source code
float
pec(x, y)
The 2D pseudo-elliptic cosine function.
source code
Variables [hide private]
  __package__ = 'maths_fns'

Imports: pi


Function Details [hide private]

factorial(n)

source code 

Return n!

Parameters:
  • n (int) - The number to return the factorial of.
Returns: int
n!

pec(x, y)

source code 

The 2D pseudo-elliptic cosine function.

This is defined as:

   int_-pi^pi (1 - cos(theta_max)).dphi,

where:

   theta_max = 1 / sqrt(cos**2(phi)/x**2 + sin**2(phi)/y**2).

The function is approximated as:

           _inf
           \        (-1)**n
   2*pi*x*y >  ----------------- fn(x, y),
           /___ 4**n * (2n + 2)!
            n=0

and where the individual functions are:

   n: 0; fn(x,y) = 1
   n: 1; fn(x,y) = 2*a + 2*b
   n: 2; fn(x,y) = 6*a^2 + 4*a*b + 6*b^2
   n: 3; fn(x,y) = 20*a^3 + 12*a^2*b + 12*a*b^2 + 20*b^3
   n: 4; fn(x,y) = 70*a^4 + 40*a^3*b + 36*a^2*b^2 + 40*a*b^3 + 70*b^4
   n: 5; fn(x,y) = 252*a^5 + 140*a^4*b + 120*a^3*b^2 + 120*a^2*b^3 + 140*a*b^4 + 252*b^5
   n: 6; fn(x,y) = 924*a^6 + 504*a^5*b + 420*a^4*b^2 + 400*a^3*b^3 + 420*a^2*b^4 + 504*a*b^5 + 924*b^6
   n: 7; fn(x,y) = 3432*a^7 + 1848*a^6*b + 1512*a^5*b^2 + 1400*a^4*b^3 + 1400*a^3*b^4 + 1512*a^2*b^5 + 1848*a*b^6 + 3432*b^7
   n: 8; fn(x,y) = 12870*a^8 + 6864*a^7*b + 5544*a^6*b^2 + 5040*a^5*b^3 + 4900*a^4*b^4 + 5040*a^3*b^5 + 5544*a^2*b^6 + 6864*a*b^7 + 12870*b^8
   n: 9; fn(x,y) = 48620*a^9 + 25740*a^8*b + 20592*a^7*b^2 + 18480*a^6*b^3 + 17640*a^5*b^4 + 17640*a^4*b^5 + 18480*a^3*b^6 + 20592*a^2*b^7 + 25740*a*b^8 + 48620*b^9
   n: 10; fn(x,y) = 184756*a^10 + 97240*a^9*b + 77220*a^8*b^2 + 68640*a^7*b^3 + 64680*a^6*b^4 + 63504*a^5*b^5 + 64680*a^4*b^6 + 68640*a^3*b^7 + 77220*a^2*b^8 + 97240*a*b^9 + 184756*b^10
   n: 11; fn(x,y) = 705432*a^11 + 369512*a^10*b + 291720*a^9*b^2 + 257400*a^8*b^3 + 240240*a^7*b^4 + 232848*a^6*b^5 + 232848*a^5*b^6 + 240240*a^4*b^7 + 257400*a^3*b^8 + 291720*a^2*b^9 + 369512*a*b^10 + 705432*b^11
Parameters:
  • x (float) - The theta_x cone angle (in rad).
  • y (float) - The theta_y cone angle (in rad).
Returns: float
The approximate function value.