C ++中的符号计算 [英] symbolic computation in C++
问题描述
我需要在C ++中进行分析集成.例如,我应该集成这样的表达式:exp[I(x-y)]
,I
是一个虚数.
I need to do analytical integration in C++. For example, I should integrate expressions like this: exp[I(x-y)]
, I
is an imaginary number.
如何在C ++中做到这一点?
How can I do this in C++?
我尝试了 GiNaC ,但是它可以集成多项式.我还尝试了 SymbolicC ++ .它可以集成sine
,cosine
或exp(x)
和ln(x)
之类的功能,但是功能不是很强大.例如,它不能集成x*ln(x)
,而可以通过使用Mathematica或通过零件集成轻松获得x*ln(x)
.
I tried GiNaC but it can just integrate polynomials. I also tried SymbolicC++. It can integrate functions like sine
, cosine
or exp(x)
and ln(x)
, but it is not very powerful. For example, it can not integrate x*ln(x)
which can be easily obtained by use of Mathematica or by integration by parts.
是否还有其他能够进行符号计算的工具或库,例如C ++中的分析集成?
Are there any other tools or libraries which are able to do symbolic computation like analytical integration in C++?
推荐答案
如果您需要进行符号积分,那么可能不会比在mathematica或maxima中运行它更快地得到任何东西-它们已经被编写了(类似)C ++.因此,除非您的方程式有一个非常具体的公式,您可以用Mathematica或Maxima不能利用的方式,否则您可能会不走运-至少,您不会从这种方法中获得这种自定义操作现成的库.
If you need to do symbolic integration, then you're probably not going to get anything faster than running it in mathematica or maxima - they're already written in (something like) C++. So unless your equations have a very specific formulae that you can exploit in a way that Mathematica or Maxima can not then you're probably out of luck -- and at very least you're not going to get that kind of custom manipulation from an off-the-shelf library.
如果需要进行数值解,那么编写自己的代码以提高速度可能是有道理的. (我知道我是为生成PDE的数值解而做的.)
You may be justified in writing your own code to get a speed boost if you needed to do numerical solutions. ( I know that I did for generating numerical solutions to PDEs).
这篇关于C ++中的符号计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!