[GiNaC-devel] Simplifying powers

Vladimir V. Kisil kisilv at maths.leeds.ac.uk
Sat Jul 27 00:51:56 CEST 2013


	Dear All,

	The method power::eval() contains the following rules:

// ^(*(...,x;c1),c2) -> *(^(*(...,x;1),c2),c1^c2)  (c1, c2 numeric(), c1>0)
// ^(*(...,x;c1),c2) -> *(^(*(...,x;-1),c2),(-c1)^c2)  (c1, c2 numeric(), c1<0)

  Is there a good reason why c1 here shall be numeric? Cannot we simply check the
  positive/negative info flag for c1 for that simplification? 
  Shall I prepare a patch for this?

  Currently we have:

  possymbol  n("n"), m("m");
  cout << "e=" << pow(pow(n,2),half) << endl;  
  // -> n
  cout << "e=" << pow(pow(n*m,2),half) << endl;  
  // -> sqrt(m^2*n^2)

  Best wishes,
  Vladimir
-- 
Vladimir V. Kisil     email: kisilv at maths.leeds.ac.uk
                        www: http://www.maths.leeds.ac.uk/~kisilv/
Book: Geometry of Mobius Transformations
http://www.worldscientific.com/worldscibooks/10.1142/p835


More information about the GiNaC-devel mailing list