[GiNaC-list] Simplification in GiNaC

abpetrov abpetrov at ufacom.ru
Fri Jan 6 17:52:32 CET 2017


Hello,
       I recently wrote a simple program to learn some calculations
with GiNaC. This works, But I got some expression which automatically don't become simple. 
The question is:
What is the simplest way to get the expected answer - Ax here?

Best regards Petrov A.B.
--------------------------------------------------------------------
Output for program:

Starting: ./test2
sqrt(m*x^2*A)*sqrt(m^(-1)*A)
*** Exited normally ***

------------------------------------------------------------------

Program:

#include <iostream>
using namespace std;

#include<ginac/ginac.h>
using namespace GiNaC;

void calc_example(){
  realsymbol A("A"),m("m"),x("x");
  ex e = sqrt(A*m*pow(x,2))*sqrt(A/m);
  cout << e  << endl;
}  

int main(int argc, char** argv)
{
	calc_example();
	return 0;
}



More information about the GiNaC-list mailing list