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

2021-11-04 Thread Chris Smith
Not sure if the following might be of any help, but it allows for work in 4 coordinate systems: https://github.com/DocNan/SymFields /c On Tuesday, October 26, 2021 at 12:40:32 AM UTC-5 Chris Smith wrote: > You might have copied `a**2 + b**2 + c**2` and called them `p`? You can > check by

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 ...:

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

2021-10-24 Thread Andreas Schuldei
I managed to install GAlgebra, and after a bit of tweaking, I managed to get some lovely output on windows. Thank you for doing this! You are correct, I also did the cylindrical form first, just because this is a cable geometry, and it is kind of obvious to do it that way. But the geometry of

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

2021-10-23 Thread Chris Smith
This is beyond what I am involved with regularly, but I wonder if this would be good in a tutorial for a pertinent module. Thanks @brombo /c On Saturday, October 23, 2021 at 8:33:38 PM UTC-5 brombo wrote: > Attached is the code and pdf output for all three cases. > On 10/23/21 2:11 AM, Andreas

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

2021-10-23 Thread Alan Bromborsky
Attached is the code and pdf output for all three cases. On 10/23/21 2:11 AM, Andreas Schuldei wrote: I am putting together the components of a vector field (a magnetic field, caused by a current in several conductors) in cartesian coordinates. The field is derived from calculating the

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

2021-10-23 Thread Alan Bromborsky
I realized you want 'a' to be a constant vector which my definition of 'a' in cylindrical coordinates is not.  I will develop a solution for a constant 'a'. On 10/23/21 11:23 AM, Alan Bromborsky wrote: I don't know if this would help but you problem cried out for cylindrical coordinates.  I

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

2021-10-23 Thread Alan Bromborsky
I don't know if this would help but you problem cried out for cylindrical coordinates.  I assumed the vectors a and R were from the origin and had no theta component (if not let me know and I will run that case) then this code (snippet) - def vector_potential_in_cylindrical_coordinates():    

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

2021-10-23 Thread Oscar Benjamin
A SymPy Vector is constructed algebraically from the unit vectors i, j and k of the coordinate system. For a vector field you also use the coordinate system base scalars x, y and z. In [11]: from sympy.vector import CoordSys3D, dot In [12]: O = CoordSys3D('O') In [13]: r = O.x*O.i + O.y*O.j +

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

2021-10-23 Thread Andreas Schuldei
I am putting together the components of a vector field (a magnetic field, caused by a current in several conductors) in cartesian coordinates. The field is derived from calculating the rotation of its magnetic vector potential, which can be expressed as A_z = -Const * dot(r,a)(dot(r,r) A

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

2021-10-22 Thread Alan Bromborsky
You might want to look at this link - https://galgebra.readthedocs.io/en/latest/ Also if you could show me symbolically (not code) what you are doing perhaps I could give you an example of how to do it in galgebra. On 10/22/21 3:15 AM, Andreas Schuldei wrote: I saw this

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

2021-10-22 Thread Andreas Schuldei
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