Sympy will not solve vector equations and the vector module seems to be an after thought.  Convert the vector equations to systems of non-linear scalar equations and hold your breath for the solver to give and answer -

https://docs.sympy.org/latest/modules/solvers/solvers.html

Part of the problem is that sympy is not a rule based computer algebra system.  Everything is hardcoded

On 10/30/21 9:33 AM, Andreas Schuldei wrote:

Obviously you looked at the code. Thank you! So you didn't see any obvious type screwups, either? Do you have other tips or remarks?
[email protected] schrieb am Samstag, 30. Oktober 2021 um 14:23:41 UTC+2:

    I do not know solve well but I suspect that it cannot handle
    vector equations. There should probably be separate equations for
    the components.

    Kalevi Suominen
    On Saturday, October 30, 2021 at 9:28:06 AM UTC+3 Andreas Schuldei
    wrote:

        I have a system of longish equations and when calling .solve()
        on it, I get this traceback:

        Traceback (most recent call last):
          File "C:/Users/Andreas
        
Schuldei/PycharmProjects/lissajous-achse/hgü-kabel-detektion-symbolic.py",
        line 109, in <module>
            result = solve(equations, (CM0, theta_i, theta_j, theta_k,
        i, a, B_earth))
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\solvers\solvers.py",
        line 1096, in solve
            solution = _solve_system(f, symbols, **flags)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\solvers\solvers.py",
        line 1730, in _solve_system
            i, d = _invert(g, *symbols)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\solvers\solvers.py",
        line 3118, in _invert
            rhs -= indep
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\numbers.py",
        line 2194, in __sub__
            return Rational.__sub__(self, other)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\decorators.py",
        line 89, in __sympifyit_wrapper
            return func(a, b)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\numbers.py",
        line 1725, in __sub__
            return Number.__sub__(self, other)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\decorators.py",
        line 89, in __sympifyit_wrapper
            return func(a, b)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\numbers.py",
        line 733, in __sub__
            return AtomicExpr.__sub__(self, other)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\decorators.py",
        line 251, in _func
            return func(self, other)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\decorators.py",
        line 126, in binary_op_wrapper
            return f(self)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\core\decorators.py",
        line 127, in binary_op_wrapper
            return func(self, other)
          File "C:\Users\Andreas
        
Schuldei\PycharmProjects\lissajous-achse\venv\lib\site-packages\sympy\vector\basisdependent.py",
        line 352, in __rsub__
            raise TypeError("Invalid argument types for subtraction")
        TypeError: Invalid argument types for subtraction

        Process finished with exit code 1

        I stared at my code long and hard, and fixed all instances of
        wrong types that i could think of. Also, in order to catch the
        error earlier, I tried insterting .simplify() calls in places
        that might benefit from them - but the process ran for hours,
        doing the simplyfy() without even reaching the solve() call.

        So I am asking for tricks to investigate the types and them
        fitting together, earlier. You can find my code attached.
        (please critique it, I want to learn!).

--
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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/3fd7fbd3-9dc9-47d0-9ed8-e1f92adfcfbfn%40googlegroups.com <https://groups.google.com/d/msgid/sympy/3fd7fbd3-9dc9-47d0-9ed8-e1f92adfcfbfn%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/b912efa3-16d3-b2c0-c31b-939710eff5e9%40gmail.com.

Reply via email to