Set precision for sympy multivector coefficients

11 views
Skip to first unread message

Robert Boyles

unread,
Jul 16, 2014, 4:59:12 PM7/16/14
to sy...@googlegroups.com
I am wondering if there is a way to set the precision for sympy objects.

I have two sympy objects (a and q) that when I execute q*a*inv(q), the result is of the form:

ans = 1.0*n_o + x1*e_1 + x2*e_2 + x3*e_3 + x4*n_i + x5*e_1^e_2^n_i

where x5 is on the order of 1E-9.

My problem is that I then want to calculate MV.norm(a), which throws a ValueError that the result is not a scalar, due to the last term. The precision I need to assume something is zero is much less, say 0.001. If that term was assumed to be zero the operation would work as with my other cases. Is there a way to set this at the start of the program and carry throughout all operations?

Thanks,
-Robert

Alan Bromborsky

unread,
Jul 16, 2014, 5:29:05 PM7/16/14
to sy...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1b07ca41-0491-402c-a3c0-491ddf8d710d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Please send me your program so I can look at it
   
    abr...@verizon.net

When I wrote the galgebra modules I was not thinking about numerics.
Also in general I would suggest using my new fork of sympy

https://github.com/brombo/sympy

with detailed documentation in sympy/doc/src/modules/galgebra/pdf/GA.pdf

However, if your use of geometric algebra is mainly numerical and not symbolic you should look at

http://glucat.sourceforge.net/

It is a C++ template class for general Clifford algebras.  The is a python wrapper that comes with the package.  On linux compiling and using the package is relatively simple, on windows you would need to use the cygwin unix environment (If I had a windows machine I would install virtual box and run ubuntu under windows and would do the same if the machine was running OSX).

Meanwhile if I could see the code you are trying to run I would try to implement what you need in my new sympy fork.




Reply all
Reply to author
Forward
0 new messages