I saw this 
https://stackoverflow.com/questions/46993819/how-to-create-a-vector-function-in-sympy
 
which uses Matrix() as a workaround to create a vector. The author says, 
that it can not be transformed between coordinate systems, like real 
vectors, though.

I need to transform my input and output vector from one coordinate system 
to another (and back). How are vector functions done in that case? My 
function is simple:

def B_el(r_vec, I):
mu_0 = 4 * np.pi * 1e-7
a1 = -0.05
a2 = 0.0
C = mu_0 * I / np.pi
r1 = r_vec.i
r2 = r_vec.j
u = (2 * C * r2 * (a1 * r1 + a2 * r2)) / np.square(r1*r1 + r2*r2) - (C * 
a2) / (r1*r1 + r2*r2)
v = (C * a1) / (r1*r1 + r2*r2) - (2 * C * r1 * (a1 * r1 + a2 * r2)) / 
np.square(r1*r1 + r2*r2)
return Matrix([u, v, 0])

-- 
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/8db840a8-20f9-47ac-a1c3-11b6658f00bfn%40googlegroups.com.

Reply via email to