[GiNaC-list] casting
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Tue May 7 12:05:58 CEST 2019
>>>>> On Tue, 7 May 2019 09:50:23 +0000 (UTC), Pedro Sosa via GiNaC-list <ginac-list at ginac.de> said:
PS> Hello, I'm a begginer and I don't find how to convert from ex to
PS> double in the tutorialSomebody can help me? Thanks
See "4.6.3 Converting numbers" in tutorial. Note that you may need
to cast your ex to numeric first, e.g.:
ex A = 2;
double Ad = ex_to<numeric>(A).to_double();
Sometimes evalf() may be needed as well:
ex B = cos(Pi/5);
double Bd = ex_to<numeric>(B.evalf()).to_double();
Best wishes,
--
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/
More information about the GiNaC-list
mailing list