Re: [sympy] How to create a vector function in sympy with actual vectors, that can be transformed between coordinate systems?

2021-10-25 Thread Chris Smith
You might have copied `a**2 + b**2 + c**2` and called them `p`? You can check by typing `type(p)`. If it is an Add then that is what happened somehow. It's always best to show the actual self-verifying code snippet. Here is what I used and everything work for me: ``` >>> from sympy.vector

Re: [sympy] How to create a vector function in sympy with actual vectors, that can be transformed between coordinate systems?

2021-10-25 Thread Andreas Schuldei
p.dot(p) a**2 + b**2 + c**2 dot(p,p) Traceback (most recent call last): File "", line 1, in File "C:\Users\Andreas Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\physics\vector\functions.py", line 31, in dot raise TypeError('Dot product is between two vectors')

Re: [sympy] How to create a vector function in sympy with actual vectors, that can be transformed between coordinate systems?

2021-10-25 Thread Oscar Benjamin
I don't see the exception that you showed: In [9]: O = CoordSys3D('O') ...: r = O.x*O.i + O.y*O.j + O.z*O.k ...: dot(r,r) # this works ...: O.x**2 + O.y**2 + O.z**2 ...: from sympy import symbols ...: a, b, c = symbols("a, b, c") ...: p = a*O.i +b*O.j + c*O.k ...: p ...: