Hello, I wrote some program to do some calculations with GiNaC. But I can see program makes some unwanted transformations of expressions automatically. Below is simple example. Can I avoid that transformations? Wanted output is sqrt(m/2). Best regards Petrov A.B. -------------------------------------------------------------------- Output for program: Starting: ./test2 1/2*sqrt(2)*sqrt(m) *** Exited normally *** ------------------------------------------------------------------ Program: #include <iostream> using namespace std; #include<ginac/ginac.h> using namespace GiNaC; void calc_example(){ possymbol m("m"); ex e = sqrt(m/2); cout << e << endl; } int main(int argc, char** argv) { calc_example(); return 0; }
On Thu, 12 Jan 2017 00:30:54 +0500, abpetrov <abpetrov@ufacom.ru> said:
ABP> Hello, I wrote some program to do some calculations with ABP> GiNaC. But I can see program makes some unwanted ABP> transformations of expressions automatically. Below is simple ABP> example. Can I avoid that transformations? Wanted output is ABP> sqrt(m/2). You get this with ex e = power(m/2,numeric(1,2)).setflag(status_flags::evaluated); Yet, it can be again broken into factors at any use of e in other expressions. -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Transformations http://goo.gl/EaG2Vu Software: Geometry of cycles http://moebinv.sourceforge.net/
Thank you for your answer Best regards Petrov A.B. On 01/12/2017 12:58 AM, Vladimir V. Kisil wrote:
On Thu, 12 Jan 2017 00:30:54 +0500, abpetrov <abpetrov@ufacom.ru> said: ABP> Hello, I wrote some program to do some calculations with ABP> GiNaC. But I can see program makes some unwanted ABP> transformations of expressions automatically. Below is simple ABP> example. Can I avoid that transformations? Wanted output is ABP> sqrt(m/2).
You get this with
ex e = power(m/2,numeric(1,2)).setflag(status_flags::evaluated);
Yet, it can be again broken into factors at any use of e in other expressions.
participants (2)
-
abpetrov
-
Vladimir V. Kisil