00001 #include <SyFi.h>
00002
00003 using namespace GiNaC;
00004
00005 int main() {
00006 int order = 2;
00007 int nsd = 2;
00008
00009 ex polynom_space = legendre(order,nsd, "a");
00010 cout <<"polynom_space "<<polynom_space<<endl;
00011
00012 ex p = polynom_space.op(0);
00013 cout <<"polynom p = "<<p<<endl;
00014
00015 ex dpdx = diff(p,x);
00016 cout <<"dpdx = "<<dpdx<<endl;
00017
00018 ex p0 = lst(-1,-1);
00019 ex p1 = lst(1,1);
00020
00021 Rectangle rectangle(p0,p1) ;
00022 ex basis = polynom_space.op(2);
00023 for (int i=0; i< basis.nops(); i++) {
00024 cout <<"i "<<i<<endl;
00025 ex integrand = p*basis.op(i);
00026 ex ai = rectangle.integrate(integrand);
00027 cout <<"ai "<<ai<<endl;
00028 }
00029 }
00030
00031
00032