#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <complex>
#include <float.h>
Go to the source code of this file.
Classes | |
class | CVar |
class | COperation |
class | CFunction |
Defines | |
#define | double_complex std::complex<double> |
#define | atanl atan |
#define | asinl asin |
#define | acosl acos |
#define | expl exp |
#define | logl log |
#define | powl pow |
#define | pow10l(x) pow(10,x) |
#define | fabsl fabs |
#define | cosl cos |
#define | sinl sin |
#define | tanl tan |
#define | fmodl fmod |
#define | sqrtl sqrt |
Typedefs | |
typedef CVar * | PCVar |
typedef COperation * | PCOperation |
typedef CFunction * | PCFunction |
Enumerations | |
enum | COperator { ErrOp, Juxt, Num, Var, Add, Sub, Opp, Mult, Div, Pow, Sqrt, NthRoot, Real, Imag, Conj, Abs, Arg, Sin, Cos, Tg, Ln, Exp, Acos, Asin, Atan, E10, Fun } |
Functions | |
double_complex | tan (double_complex) |
double_complex | acos (double_complex) |
double_complex | asin (double_complex) |
double_complex | atan (double_complex) |
typedef | void ((*pfoncld)(double_complex *&)) |
char * | PrettyPrint (double_complex) |
char * | MidStr (const char *s, int i1, int i2) |
char * | CopyStr (const char *s) |
char * | InsStr (const char *s, int n, const char c) |
signed char | EqStr (const char *s, const char *s2) |
signed char | CompStr (const char *s, int n, const char *s2) |
char * | DelStr (const char *s, int n) |
Variables | |
const double_complex | ErrVal = double_complex(DBL_MAX,0) |
#define acosl acos |
Definition at line 42 of file mathexpr_c.h.
#define asinl asin |
Definition at line 41 of file mathexpr_c.h.
#define atanl atan |
Definition at line 40 of file mathexpr_c.h.
#define cosl cos |
Definition at line 48 of file mathexpr_c.h.
#define double_complex std::complex<double> |
Definition at line 32 of file mathexpr_c.h.
Referenced by acos(), ArcCosinus(), asin(), atan(), BCDouble(), BCFun(), BCSimple(), COperation::BuildCode(), COperation::COperation(), CVar::CVar(), COperation::Diff(), COperation::DiffConj(), main(), operator/(), PrettyPrint(), Puiss10(), Puissance(), RacineN(), and COperation::Val().
#define expl exp |
Definition at line 43 of file mathexpr_c.h.
#define fabsl fabs |
Definition at line 47 of file mathexpr_c.h.
#define fmodl fmod |
Definition at line 51 of file mathexpr_c.h.
#define logl log |
Definition at line 44 of file mathexpr_c.h.
Definition at line 46 of file mathexpr_c.h.
#define powl pow |
Definition at line 45 of file mathexpr_c.h.
#define sinl sin |
Definition at line 49 of file mathexpr_c.h.
#define sqrtl sqrt |
Definition at line 52 of file mathexpr_c.h.
#define tanl tan |
Definition at line 50 of file mathexpr_c.h.
typedef CFunction* PCFunction |
Definition at line 79 of file mathexpr_c.h.
typedef COperation* PCOperation |
Definition at line 77 of file mathexpr_c.h.
Definition at line 70 of file mathexpr_c.h.
enum COperator |
ErrOp | |
Juxt | |
Num | |
Var | |
Add | |
Sub | |
Opp | |
Mult | |
Div | |
Pow | |
Sqrt | |
NthRoot | |
Real | |
Imag | |
Conj | |
Abs | |
Arg | |
Sin | |
Cos | |
Tg | |
Ln | |
Exp | |
Acos | |
Asin | |
Atan | |
E10 | |
Fun |
Definition at line 72 of file mathexpr_c.h.
00072 {ErrOp,Juxt,Num,Var,Add,Sub,Opp,Mult,Div,Pow,Sqrt, 00073 NthRoot,Real,Imag,Conj,Abs,Arg,Sin,Cos,Tg,Ln,Exp,Acos,Asin,Atan,E10,Fun};
double_complex acos | ( | double_complex | ) |
Definition at line 27 of file mathexpr_c.cpp.
References double_complex, log(), and sqrt().
00028 {return -double_complex(0,1)*log(z+double_complex(0,1)*sqrt(double_complex(1,0)-z*z));}
double_complex asin | ( | double_complex | ) |
Definition at line 29 of file mathexpr_c.cpp.
References double_complex, log(), and sqrt().
00030 {return -double_complex(0,1)*log(double_complex(0,1)*z+sqrt(double_complex(1,0)-z*z));}
double_complex atan | ( | double_complex | ) |
Definition at line 31 of file mathexpr_c.cpp.
References double_complex, log(), and sqrt().
00032 {return -double_complex(0,1)*log((double_complex(1,0)+double_complex(0,1)*z)/sqrt(double_complex(1,0)+z*z));}
signed char CompStr | ( | const char * | s, | |
int | n, | |||
const char * | s2 | |||
) |
Definition at line 59 of file mathexpr.cpp.
Referenced by COperation::COperation(), IsFunction(), IsolateVars(), IsVar(), and ROperation::ROperation().
00060 {if(n<0||n>=(int)strlen(s)||n+(int)strlen(s2)>(int)strlen(s))return 0; 00061 int i; 00062 for(i=0;s2[i];i++)if(s[i+n]!=s2[i])return 0; 00063 return 1; 00064 }
char* CopyStr | ( | const char * | s | ) |
Definition at line 38 of file mathexpr.cpp.
Referenced by CFunction::CFunction(), COperation::COperation(), CVar::CVar(), COperation::Expr(), ROperation::Expr(), CFunction::operator=(), RFunction::operator=(), RFunction::RFunction(), ROperation::ROperation(), RVar::RVar(), CFunction::SetName(), RFunction::SetName(), and SimplifyStr().
00039 {char*s1=new char[strlen(s)+1];char*s12=s1;const char*s2=s; 00040 while((*s12++=*s2++));return s1;}
char* DelStr | ( | const char * | s, | |
int | n | |||
) |
signed char EqStr | ( | const char * | s, | |
const char * | s2 | |||
) |
Definition at line 52 of file mathexpr.cpp.
Referenced by COperation::ContainVar(), ROperation::ContainVar(), COperation::COperation(), operator==(), and ROperation::ROperation().
00053 {if(strlen(s)!=strlen(s2))return 0; 00054 int i; 00055 for(i=0;s[i];i++)if(s[i]!=s2[i])return 0; 00056 return 1; 00057 }
char* InsStr | ( | const char * | s, | |
int | n, | |||
const char | c | |||
) |
char* MidStr | ( | const char * | s, | |
int | i1, | |||
int | i2 | |||
) |
Definition at line 25 of file mathexpr.cpp.
Referenced by COperation::COperation(), and ROperation::ROperation().
00026 { 00027 if(i1<0||i2>=(int)strlen(s)||i1>i2){ 00028 char* cp = new char[1]; 00029 cp[0] = '\0'; 00030 return cp; 00031 } 00032 char*s1=new char[i2-i1+2]; 00033 int i; 00034 for(i=i1;i<=i2;i++)s1[i-i1]=s[i]; 00035 s1[i2-i1+1]=0;return s1; 00036 }
char* PrettyPrint | ( | double_complex | ) |
Definition at line 1010 of file mathexpr_c.cpp.
References double_complex, formatimag(), formatreal(), COperation::imag, and COperation::real.
Referenced by COperation::Expr(), and main().
01011 { 01012 char*s=new char[30],*s1=formatreal(real(x)),*s2=formatimag(imag(x)); 01013 if(!strlen(s1)&&!strlen(s2))sprintf(s,"0"); 01014 else if(x==double_complex(0,1))sprintf(s,"i"); 01015 else if(!strlen(s1))sprintf(s,"(%s)",s2); 01016 else if(!strlen(s2))sprintf(s,"%s",s1); 01017 else if(imag(x)>0)sprintf(s,"(%s+%s)",s1,s2); 01018 else sprintf(s,"(%s%s)",s1,s2); 01019 delete s1, delete s2; 01020 return s; 01021 }
double_complex tan | ( | double_complex | ) |
typedef void | ( | (*)(double_complex *&) | pfoncld | ) |
const double_complex ErrVal = double_complex(DBL_MAX,0) |
Definition at line 57 of file mathexpr_c.h.