You may want to look at the following link -
https://github.com/pygae/galgebra
Also these docs -
https://galgebra.readthedocs.io/en/latest/galgebra_guide.html#Basic-Multilinear-Function-Class-Functions
On 4/24/20 2:43 PM, Alexander Lindsay wrote:
I've been using the capabilities in sympy.vector for generating MMS
solutions for verifying FEM in MOOSE. I'm curious whether sympy
supports calculation of the gradient of a vector field (e.g. with the
result being a tensor)? It doesn't appear to me that it does, but I'm
hoping I overlooked something. Below is the sample code I'd like to be
able to execute and the corresponding backtrace. If the ability to
take the gradient of a vector doesn't exist, I'm curious whether it
would be difficult to add? If it's not too much anticipated work, I'd
be willing to take a stab at it.
from sympy.vector import gradient, CoordSys3D
R = CoordSys3D('R')
u = R.x*R.y * (R.i + R.j)
gradient(u)
|
---------------------------------------------------------------------------ValueErrorTraceback(most
recent call last)<ipython-input-49-c095794df196>in<module>5u =R.x*R.y
*(R.i
+R.j)6---->7gradient(u)~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/vector/operators.pyingradient(scalar_field,coord_sys,doit)317318ifdoit:-->319return(vx
*i +vy *j +vz *k).doit()320returnvx *i +vy *j +vz *k
321else:~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/vector/basisdependent.pyindoit(self,**hints)169"""Calls
.doit() on each term in the Dyadic"""170 doit_components
=[self.components[x].doit(**hints)*x -->171forx
inself.components]172returnself._add_func(*doit_components)173~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/vector/basisdependent.pyin<listcomp>(.0)169"""Calls
.doit() on each term in the Dyadic"""170 doit_components
=[self.components[x].doit(**hints)*x -->171forx
inself.components]172returnself._add_func(*doit_components)173~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/core/decorators.pyin__sympifyit_wrapper(a,b)89ifnothasattr(b,'_op_priority'):90
b
=sympify(b,strict=True)--->91returnfunc(a,b)92exceptSympifyError:93returnretval
~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/core/decorators.pyinbinary_op_wrapper(self,other)127iff
isnotNone:128returnf(self)-->129returnfunc(self,other)130returnbinary_op_wrapper
131returnpriority_decorator
~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/vector/basisdependent.pyin__mul__(self,other)34@call_highest_priority('__rmul__')35def__mul__(self,other):--->36returnself._mul_func(self,other)3738@_sympifyit('other',NotImplemented)~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/vector/vector.pyin__new__(cls,*args,**options)412413def__new__(cls,*args,**options):-->414obj
=BasisDependentMul.__new__(cls,*args,**options)415returnobj
416~/miniconda3/envs/moose-boost/lib/python3.7/site-packages/sympy/vector/basisdependent.pyin__new__(cls,*args,**options)257#
Make sure incompatible types weren't multiplied258ifcount
>1:-->259raiseValueError("Invalid multiplication")260elifcount
==0:261returnMul(*args,**options)ValueError:Invalidmultiplication
|
--
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+unsubscr...@googlegroups.com
<mailto:sympy+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/29c041d5-1bab-4d54-9bea-fe5ba0d4a02a%40googlegroups.com
<https://groups.google.com/d/msgid/sympy/29c041d5-1bab-4d54-9bea-fe5ba0d4a02a%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/51bde975-44fc-94cb-c5be-dbcae9f0f4d8%40gmail.com.