[GiNaC-list] ginac 1.6.2-2 on mingw-32.

testhandle testhandle at gmail.com
Wed Aug 7 15:36:38 CEST 2013


(most of this text was written using google translate.
 english is not good at me. so there's a possibility that the meaning
is not transmitted.)

there may be unnecessary operation and defects.
however, it is forced by this operation, but it have confirmed the
operation of the tutorial examples.

* step 0, dependencies.
  gmp           5.0.1
  cln (gmp)     1.3.3
  gcc           4.7.2
  ld            2.23.1
  m4            1.4.16
  autoconf      2.68
  autoreconf    2.68
  automake      1.11
  libtool       2.4
  python        2.7.3
  bison         2.4.2
  flex          2.5.35

* step 1.
  $ git clone git://www.ginac.de/ginac.git

* step 2, modify the 'ginac/config/config.rpath'.
  line 67: replace
    mingw* | pw32* | os2*)
  ->
    pw32* | os2*)

  line 57: insert
    mingw*)
      wl='Wl,'
      ;;

  line 135: replace
    cygwin* | mingw* | pw32*)
  ->
    cygwin* | pw32*)

  line 185: replace
    cygwin* | mingw* | pw32*)
  ->
    cygwin* | pw32*)

  line 199: replace
    linux*)
  ->
    linux* | mingw*)

* step 3.
  $ cd ginac
  $ autoreconf -i

* step 4, modify the 'ginac/configure'.
  line 15539: delete

* step 5, modify the 'ginsh/ginsh_lexer.lpp'.
  line 37: replace
    #include "ginsh_parser.hpp"
  ->
    #include "ginsh_parser.h"

* step 6.
  $ export CLN_LIBS="-L/usr/local/lib -lcln -lgmp"
  $ export CLN_CFLAGS="-I/usr/local/include"
  $ ./configure
  $ make
  $ make install

* test 1.
  // hello.cpp ----------------
  #include <iostream>
  #include <ginac/ginac.h>
  using namespace std;
  using namespace GiNaC;

  int main()
  {
      symbol x("x"), y("y");
      ex poly;

      for (int i=0; i<3; ++i)
          poly += factorial(i+16)*pow(x,i)*pow(y,2-i);

      cout << poly << endl;
      return 0;
  }

  $ g++ -c -O3 -I/usr/local/include -L/usr/local/bin hello.cpp
  $ g++ -o hello hello.o -lginac -lcln -lgmp &> result.txt
  $ ./hello
  355687428096000*x*y+20922789888000*y^2+6402373705728000*x^2


* test 2.
  // hello2.cpp ----------------
  #include <iostream>
  #include <ginac/ginac.h>
  using namespace std;
  using namespace GiNaC;

  ex HermitePoly(const symbol & x, int n)
  {
      ex HKer=exp(-pow(x, 2));
      // uses the identity H_n(x) == (-1)^n exp(x^2) (d/dx)^n exp(-x^2)
       return normal(pow(-1, n) * diff(HKer, x, n) / HKer);
  }

  int main()
  {
      symbol z("z");

      for (int i=0; i<6; ++i)
          cout << "H_" << i << "(z) == " << HermitePoly(z,i) << endl;

      return 0;
  }

  $ g++ -c -O3 -I/usr/local/include -L/usr/local/bin hello2.cpp
  $ g++ -o hello2 hello2.o -lginac -lcln -lgmp &> result.txt
  $ ./hello2
  H_0(z) == 1
  H_1(z) == 2*z
  H_2(z) == -2+4*z^2
  H_3(z) == -12*z+8*z^3
  H_4(z) == 12+16*z^4-48*z^2
  H_5(z) == 120*z+32*z^5-160*z^3


More information about the GiNaC-list mailing list