ginac库代数展开式

2020-10-13  本文已影响0人  一路向后

1.程序源码

#include <iostream>
#include <ginac/ginac.h>

using namespace std;
using namespace GiNaC;

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

        poly = pow(x+y, 2);

        cout << poly.expand() << endl;

        return 0;
}

2.编译源码

$ g++ -o example example.c -lginac -lcln -I/usr/local/include -L/usr/local/lib64

3.运行结果

./example
x^2+y^2+2*x*y
上一篇 下一篇

猜你喜欢

热点阅读