Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Search for

# line_ex1.cpp

Go to the documentation of this file.

    00001 #include <SyFi.h>
    00002
    00003 using namespace GiNaC;
    00004
    00005 int main() {
    00006
    00007
    00008   ex p0 = lst(0.0,0.0,0.0);
    00009   ex p1 = lst(1.0,1.0,1.0);
    00010
    00011   Line line(p0,p1);
    00012
    00013   // show usage of repr
    00014   symbol t("t");
    00015   ex l_repr = line.repr(t);
    00016   cout <<"l.repr "<<l_repr<<endl;
    00017   EQUAL_OR_DIE(l_repr, "{x==t,y==t,z==t,{t,0,1}}");
    00018
    00019   for (int i=0; i< l_repr.nops(); i++) {
    00020     cout <<"l_repr.op(" <<i<<"):  "<<l_repr.op(i)<<endl;
    00021   }
    00022
    00023   // compute the integral of a function along the line
    00024   ex f = x*x + y*y*y + z;
    00025   ex intf = line.integrate(f);
    00026   cout <<"intf "<<intf<<endl;
    00027   EQUAL_OR_DIE(intf, "13/12*sqrt(3)");
    00028
    00029
    00030
    00031   return 0;
    00032
    00033 }
    00034