1#ifndef CLASSIC_TpsMath_HH
2#define CLASSIC_TpsMath_HH
80 while(y-- > 0) z = z * x;
83 while(y++ < 0) z = z * t;
93 if(aZero <= 0.0)
throw DomainError(
"sqrt(const Tps &)");
97 T *series =
new T[cut+1];
98 series[0] =
sqrt(aZero);
100 for(
int i = 1; i <= cut; i++) {
101 series[i] = (series[i-1] * double(3 - 2 * i)) / (aZero *
double(2 * i));
114 T *series =
new T[cut+1];
115 series[0] =
sin(aZero);
116 series[1] =
cos(aZero);
118 for(
int i = 2; i <= cut; i++) {
119 series[i] = - series[i-2] / double(i * (i - 1));
132 T *series =
new T[cut+1];
133 series[0] =
cos(aZero);
134 series[1] = -
sin(aZero);
136 for(
int i = 2; i <= cut; i++) {
137 series[i] = - series[i-2] / double(i * (i - 1));
154 return cos(x).inverse();
160 return sin(x).inverse();
168 T *series =
new T[cut+1];
169 series[0] =
exp(aZero);
171 for(
int i = 1; i <= cut; i++) {
172 series[i] = series[i-1] / double(i);
184 if(aZero <= 0)
throw DomainError(
"log(const Tps &)");
188 T *series =
new T[cut+1];
189 series[0] =
log(aZero);
190 series[1] = power =
T(1) / aZero;
192 for(
int i = 2; i <= cut; i++) {
193 power = - power / aZero;
194 series[i] = power / double(i);
207 T *series =
new T[cut+1];
208 series[0] =
sinh(aZero);
209 series[1] =
cosh(aZero);
211 for(
int i = 2; i <= cut; i++) {
212 series[i] = series[i-2] / double(i * (i - 1));
225 T *series =
new T[cut+1];;
226 series[0] =
cosh(aZero);
227 series[1] =
sinh(aZero);
229 for(
int i = 2; i <= cut; i++) {
230 series[i] = series[i-2] / double(i * (i - 1));
Tps< T > log(const Tps< T > &x)
Natural logarithm.
Tps< T > sec(const Tps< T > &x)
Secant.
Tps< T > cos(const Tps< T > &x)
Cosine.
Tps< T > cot(const Tps< T > &x)
Cotangent.
Tps< T > cosh(const Tps< T > &x)
Hyperbolic cosine.
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
Tps< T > csc(const Tps< T > &x)
Cosecant.
Tps< T > tan(const Tps< T > &x)
Tangent.
Tps< T > exp(const Tps< T > &x)
Exponential.
Tps< T > sinh(const Tps< T > &x)
Hyperbolic sine.
Tps< T > tanh(const Tps< T > &x)
Hyperbolic tangent.
Tps< T > sin(const Tps< T > &x)
Sine.
Tps< T > sqrt(const Tps< T > &x)
Square root.
Tps< T > inverse(int order=truncOrder) const
Reciprocal value.
Tps< T > Taylor(const T series[], int n) const
Taylor series.
int getTruncOrder() const
Get truncation order.