Art I Me Tic Evaluator C Sharp
Art I Me Tic Evaluator C Sharp
{
return x*x;
}
public double pow3(double x)
{
return x*x*x;
}
public double p100(double x,double p)
{
return x*(p/100);
}
public double onepx(double x)
{
return 1/x;
}
public double radx(double x)
{
return Math.Sqrt(x);
}
public double exp(double x)
{
return Math.Exp(x);
}
public double exponential(double x)
{
if(difinf(x))
{
return exp(x);
}
else
{
return infinit;
}
}
public double inmultit(double x, double y)
{
if(abs(x)<epsi || abs(y)<epsi) {return 0;}
else if(difinf(x) && difinf(y)){return x*y;}
else {return infinit;}
}
public double inmultitLista(ref List<double> rl)
{
double rez = 1;
int lenlista = rl.Count;
if(lenlista==0){return 0;}
if(lenlista==1){return rl[0];}
for(int i = 0; i < lenlista ; i++)
{
rez = rez* rl[i];
}
return rez;
}
public double opLista(ref List<double> rl, char op)
{
double rez = 0;
int lenlista = rl.Count;
if(lenlista==0){return 0;}
if(lenlista==1){return rl[0];}
//de implementat
public void Copy(){}
public void Insert(){}
public void Inc(){}
public void Dec(){}
public void Chr(){}
public void Ord(){}
//calculeaza expresia
for(int i = 0 ; i< maxstiva ; i++)
opd[i]=0;
op[i]='@';
top1 = 0;
top2 = 1;
op[top2]='(';
i=0;
if(op[top2]=='='){return egal(x1,x2);}
else if(op[top2]=='#'){valo = diferit(x1,x2);}
else if(op[top2]=='<'){valo = maimic(x1,x2);}
else if(op[top2]=='>'){valo = maimare(x1,x2);}
else if(op[top2]=='+'){valo = plus(x1,x2);}
else if(op[top2]=='-'){valo = minus(x1,x2);}
else if(op[top2]=='*'){valo = inmultit(x1,x2);}
else if(op[top2]=='/'){valo = impartit(x1,x2);}
else if(op[top2]=='^'){valo = putere(x1,x2);}
else if(op[top2]=='s'){valo = sinus(x2);}
else if(op[top2]=='c'){valo = cosinus(x2);}
else if(op[top2]=='l'){valo = logaritm(x2);}
else if(op[top2]=='e'){valo = exponential(x2);}
else if(op[top2]=='a'){valo = modul(x2);}
else if(op[top2]=='r'){valo = radical(x2);}
if(isInList(ref operatiibinare,op[top2]){top1--;}
if(isInList(ref operatiiunare,op[top2] && isInList(ref
operatiibinare,op[top2]){opd[top1]=valo;top1--;}
if(top2>0)
{
if(op[top2]!='(' || vector[i]!=')')
{
top2++;
op[top2=vector[i].Substring(0,1);
}
else {top2--;}
}
if(top2==0;
return opd[0];
else return infinit;
}
public void citestefunctie(ref functie E,string expresia, double pa, double pb, int
pn)
{
E.exporesie = expresia;
E.a = pa;
E.b = pb;
E.n = pn;
Lower(ref E.expresie);
punespatiiinexpresie(ref E);
transformainvector(ref E);
for(int i = 0 ; i<E.n-1;i++)
{
x = E.a+ i * (E.b-E.a)/(E.n-a);
y = valoarefuncite(ref E,x);
if(difinf(y){writeln(i+1 + '. ' + x + ' --> ' + y);}
else (difinf(y){writeln(i+1 + '. ' + x + ' --> nedefinit' );}
if( (i+1)%24==0) {ReadKey();}
}