Package cds.healpix.common.math
Class TaylorSeries
java.lang.Object
cds.healpix.common.math.TaylorSeries
Utility class continaing the Taylor expansion of a few trigonometric functions.
We recall that:
arcos(x) = pi/2 - arcsin(x)
- Author:
- F.-X. Pineau
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Constant value equal to 3/40.static final double
Constant value equal to 1/2.static final double
Constant value equal to 1/120 = 1/5!.static final double
Constant value equal to 1/24 = 1/4!.static final double
Constant value equal to 1/5040 = 1/7!.static final double
Constant value equal to 1/720 = 1/6!.static final double
Constant value equal to 1/6 = 1/6.static final double
Constant value equal to 1/3.static final double
Constant value equal to 17/215.static final double
Constant value equal to 3/40.static final double
Constant value equal to 2/15. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final double
asinO1
(double x) static final double
asinO3
(double x) static final double
asinO5
(double x) static final double
asinO7
(double x) static final double
cosO0
(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the 0 order (constant).static final double
cosO2
(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the order of the 2nd degree.static final double
cosO4
(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the order of the 4th degree.static final double
cosO6
(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the order of the 6th degree.static final double
sinO1
(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 1st degree.static final double
sinO3
(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 3rd degree.static final double
sinO5
(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 5th degree.static final double
sinO7
(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 7th degree.static final double
tanO1
(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 1st degree.static final double
tanO3
(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 3rd degree.static final double
tanO5
(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 5th degree.static final double
tanO7
(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 7th degree.
-
Field Details
-
HALF
public static final double HALFConstant value equal to 1/2.- See Also:
-
ONE_THIRD
public static final double ONE_THIRDConstant value equal to 1/3.- See Also:
-
ONE_SIXTH
public static final double ONE_SIXTHConstant value equal to 1/6 = 1/6.- See Also:
-
ONE_OVER_24
public static final double ONE_OVER_24Constant value equal to 1/24 = 1/4!.- See Also:
-
ONE_OVER_120
public static final double ONE_OVER_120Constant value equal to 1/120 = 1/5!.- See Also:
-
ONE_OVER_720
public static final double ONE_OVER_720Constant value equal to 1/720 = 1/6!.- See Also:
-
ONE_OVER_5040
public static final double ONE_OVER_5040Constant value equal to 1/5040 = 1/7!.- See Also:
-
TWO_OVER_15
public static final double TWO_OVER_15Constant value equal to 2/15.- See Also:
-
THREE_OVER_40
public static final double THREE_OVER_40Constant value equal to 3/40.- See Also:
-
FIVE_OVER_112
public static final double FIVE_OVER_112Constant value equal to 3/40.- See Also:
-
Q_17_OVER_315
public static final double Q_17_OVER_315Constant value equal to 17/215.- See Also:
-
-
Constructor Details
-
TaylorSeries
public TaylorSeries()
-
-
Method Details
-
cosO0
public static final double cosO0(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the 0 order (constant). That is:1
. The error on this approximation is no more than|x|^2 / 2
, i.e. ~5e-17 if x = 1e-8. We recall that the erro due to numercial approximation is 1e-16.- Parameters:
a
- angle, in radians- Returns:
- 1, i.e. the Taylor serie of the trigonometric cosine around a = 0 at the 0 order.
-
cosO2
public static final double cosO2(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the order of the 2nd degree. That is:1 - x^2/2
. The error on this approximation is no more than|x|^4 / 4!
, i.e. ~4e-18 if x = 1e-4.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order of the 2nd degree.
-
cosO4
public static final double cosO4(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the order of the 4th degree. That is:1 - x^2/2 + x^4/4!
. The error on this approximation is no more than|x|^6 / 6!
, i.e. ~1.3e-21 if x = 1e-3.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order of the 4th degree.
-
cosO6
public static final double cosO6(double a) Returns the Taylor serie of the trigonometric cosine around a = 0 at the order of the 6th degree. That is:1 - x^2/2 + x^4/4! - x^6/6!
. The error on this approximation is no more than|x|^8 / 8!
, i.e. ~1.7e-20 if x = 1e-2.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order of the 6th degree.
-
sinO1
public static final double sinO1(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 1st degree. That is:x
. The error on this approximation is no more than|x|^3 / 3!
, i.e. ~1.6e-19 if x = 1e-6.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order of the 1st degree.
-
sinO3
public static final double sinO3(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 3rd degree. That is:x - x^3/3!
. The error on this approximation is no more than|x|^5 / 120
, i.e. ~8.3e-18 if x = 1e-3.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order the 3rd degree.
-
sinO5
public static final double sinO5(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 5th degree. That is:x - x^3/3! + x^5/5!
. The error on this approximation is no more than|x|^7 / 7!
, i.e. ~2e-18 if x = 1e-2.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order of the 5th degree.
-
sinO7
public static final double sinO7(double a) Returns the Taylor serie of the trigonometric sine around a = 0 at the order of the 7th degree. That is:x - x^3/3! + x^5/5! - x^7/7!
. The error on this approximation is no more than|x|^9 / 9!
, i.e. ~2.8e-15 if x = 1e-1.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric sine around a = 0 at the order of the 7th degree.
-
tanO1
public static final double tanO1(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 1st degree. That is:x
. The error on this approximation is no more than|x|^3 / 3
, i.e. ~4e-19 if x = 1e-6.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric tan around a = 0 at the order of the 1st degree.
-
tanO3
public static final double tanO3(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 3rd degree. That is:x + x^3/3
. The error on this approximation is no more than2*|x|^5 / 15
, i.e. ~1.3e-21 if x = 1e-4.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric tan around a = 0 at the order of the 3rd degree.
-
tanO5
public static final double tanO5(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 5th degree. That is:x + x^3/3 + 2x^5/15
. The error on this approximation is no more than17|x|^7 / 315
, i.e. ~5.4e-23 if x = 1e-3.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric tan around a = 0 at the order of the 5th degree.
-
tanO7
public static final double tanO7(double a) Returns the Taylor serie of the trigonometric tan around a = 0 at the order of the 7th degree. That is:x + x^3/3 + 2x^5/15 + 17x^7/315
. The error on this approximation is no more than62|x|^9 / 2835
, i.e. ~2.2e-20 if x = 1e-2.- Parameters:
a
- angle, in radians- Returns:
- the Taylor serie of the trigonometric tan around a = 0 at the order of the 7th degree.
-
asinO1
public static final double asinO1(double x) -
asinO3
public static final double asinO3(double x) -
asinO5
public static final double asinO5(double x) -
asinO7
public static final double asinO7(double x)
-