-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (33 loc) · 1.63 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "DExpr.hpp"
#include "DExprIdentity.hpp"
#include "evaluate.hpp"
#include "operator_sum.hpp"
#include "operator_mult.hpp"
#include "operator_div.hpp"
#include "operator_math_fun.hpp"
#include <iostream>
int main()
{
ET::DExpr<ET::DExprIdentity> x;
std::cout<<ET::evaluate(1.,3.)<<" "<<1<<std::endl;
std::cout<<ET::evaluate(x,3.)<<" "<<3<<std::endl;
std::cout<<ET::evaluate(x+x,3.)<<" "<<5<<std::endl;
std::cout<<ET::evaluate(x+1.,3.)<<" "<<4<<std::endl;
std::cout<<ET::evaluate(1.+x,3.)<<" "<<4<<std::endl;
std::cout<<ET::evaluate(1./x,2.)<<" "<<0.5<<std::endl;
std::cout<<ET::evaluate(x/2.,3.)<<" "<<1.5<<std::endl;
std::cout<<ET::evaluate(x/x,3.)<<" "<<1<<std::endl;
std::cout<<ET::evaluate((x+1.)/x,2.)<<" "<<1.5<<std::endl;
std::cout<<ET::evaluate(x/(x+1.),3.)<<" "<<0.75<<std::endl;
std::cout<<ET::evaluate((1.+x)/x,2.)<<" "<<1.5<<std::endl;
std::cout<<ET::evaluate(x/(1.+x),3.)<<" "<<0.75<<std::endl;
std::cout<<ET::evaluate(ET::exp(x),3.)<<" "<<std::exp(3.)<<std::endl;
std::cout<<ET::evaluate(ET::exp(3.),3.)<<" "<<std::exp(3.)<<std::endl;
std::cout<<ET::evaluate(ET::log(x),3.)<<" "<<std::log(3.)<<std::endl;
std::cout<<ET::evaluate(ET::log(3.),3.)<<" "<<std::log(3.)<<std::endl;
std::cout<<ET::evaluate(ET::log(ET::exp(x)),3.)<<" "<<std::log(std::exp(3.))<<std::endl;
std::cout<<ET::evaluate(ET::exp(ET::log(x)),3.)<<" "<<std::exp(std::log(3.))<<std::endl;
std::cout<<ET::evaluate(ET::exp(x/(x+1.)),3.)<<" "<<std::exp(0.75)<<std::endl;
std::cout<<ET::evaluate(x+2.*x*ET::exp(x/(x+1.)),3.)<<" "<<3.+2.*3.*std::exp(0.75)<<std::endl;
return 0;
}