Integration over 3D vector variables

24 views
Skip to first unread message

arnyt...@gmail.com

unread,
Oct 12, 2017, 3:40:35 PM10/12/17
to sympy

Is there a way in SymPy to either analytically integrate, or numerically integrate (with some symbolic variables retained), involving vectors?


Integrate over vectors p1p3
( e-i p1 . x (p12 + p32) / ( (p3 - p1)2 (
p32a2 +1)2 )

(with vector , and scalar "a" remaining as free variables after integration)


If absolutely required for numerical integration, i.e. no other way to get SymPy to perform a semi-numerical integration, then vector x, and the scalar variable "a" can also be specified a value, but x should remain a vector. 


Of course, if the integration above can be attempted analytically if possible in SymPy, or even partly analytically (e.g. if the vectors are expressed in spherical polar co-ordinates, and some of the variables like Sin \theta etc. can be integrated over), any suggestions towards such an approach would be very useful as well. 

Max Linke

unread,
Oct 26, 2017, 12:13:34 PM10/26/17
to sympy
Is the value of the function you are trying to integrate a scalar?

If so I have recently done a integration using polar coordinates. Here is a example to calculate the average of v.T * U * v.

```python
phi = Symbol('phi', real=True)
theta = Symbol('theta', real=True)

a = Symbol('a')
b = Symbol('b')
c = Symbol('c')

v = Matrix([cos(phi) * sin(theta), sin(phi)*sin(theta), cos(theta)])
U = Matrix([[a, 0, 0], [b, 0, b], [c, 0, c]])

integrate(integrate(v.T * U * v, (phi, 0, 2*pi)) * sin(theta), (theta, 0, pi)) / (4 * pi)

```
Reply all
Reply to author
Forward
0 new messages