Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix.solve(A, b, method=linear_solver) gives Unsupported method #450

Open
certik opened this issue Sep 16, 2023 · 1 comment
Open

Matrix.solve(A, b, method=linear_solver) gives Unsupported method #450

certik opened this issue Sep 16, 2023 · 1 comment
Labels

Comments

@certik
Copy link
Contributor

certik commented Sep 16, 2023

See here for details: sympy/sympy#25401 (comment)

In [1]: run linear_analysis.py
Defining reference frames.
Defining time varying symbols.
Orienting frames.
Defining constants.
Defining position vectors.
Defining holonomic constraints.
The holonomic constraint is a function of these dynamic variables:
[]
Defining kinematical differential equations.
Defining angular velocities.
Defining linear velocities.
Defining nonholonomic constraints.
Defining inertia.
Defining the rigid bodies.
Defining the forces and torques.
The nonholonomic constraints are a function of these dynamic variables:
[]
Generating Kane's equations.
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
File ~/Manuscripts/bmd2023-stable-low-speed-cargobike/src/linear_analysis.py:5
      1 import numpy as np
      3 from generate_numerical_funcs import get_sym_data
----> 5 sym_data = get_sym_data()
      7 v = 1.0  # m/s
      8 u6 = -v/sym_data.parameter_vals[-1]

File ~/Manuscripts/bmd2023-stable-low-speed-cargobike/src/generate_numerical_funcs.py:15, in get_sym_data()
     12 elif (os.path.getmtime('generate_eom.py') >
     13       os.path.getmtime('symbolics.pkl')):
     14     logging.info("Equation of motion file changed, recalculating.")
---> 15     from generate_eom import sym_data
     16 else:
     17     logging.info("Loading equations of motion from cache.")

File ~/Manuscripts/bmd2023-stable-low-speed-cargobike/src/generate_eom.py:396
    390 ###############
    391 # Kane's Method
    392 ###############
    394 print("Generating Kane's equations.")
--> 396 kane = mec.KanesMethod(
    397     N,
    398     q_ind,
    399     u_ind,
    400     kd_eqs=kinematical,
    401     q_dependent=q_dep,
    402     configuration_constraints=holonomic,
    403     u_dependent=u_dep,
    404     velocity_constraints=nonholonomic,
    405     constraint_solver='CRAMER',
    406 )
    408 Fr, Frs = kane.kanes_equations(bodies, loads=loads)
    410 r = sm.Matrix([T4, T6, T7, T9, T10])

File ~/src/sympy/sympy/physics/mechanics/kane.py:235, in KanesMethod.__init__(self, frame, q_ind, u_ind, kd_eqs, q_dependent, configuration_constraints, u_dependent, velocity_constraints, acceleration_constraints, u_auxiliary, bodies, forcelist, explicit_kinematics, kd_eqs_solver, constraint_solver)
    233 _validate_coordinates(self.q, self.u)
    234 self._initialize_kindiffeq_matrices(kd_eqs, kd_eqs_solver)
--> 235 self._initialize_constraint_matrices(
    236     configuration_constraints, velocity_constraints,
    237     acceleration_constraints, constraint_solver)

File ~/src/sympy/sympy/physics/mechanics/kane.py:326, in KanesMethod._initialize_constraint_matrices(self, config, vel, acc, linear_solver)
    324     B_ind = self._k_nh[:, :p]
    325     B_dep = self._k_nh[:, p:o]
--> 326     self._Ars = -linear_solver(B_dep, B_ind)
    327 else:
    328     self._f_nh = Matrix()

File ~/src/sympy/sympy/physics/mechanics/functions.py:713, in _parse_linear_solver.<locals>.<lambda>(A, b)
    711 if callable(linear_solver):
    712     return linear_solver
--> 713 return lambda A, b: Matrix.solve(A, b, method=linear_solver)

File symengine_wrapper.pyx:3860, in symengine.lib.symengine_wrapper.DenseMatrixBase.solve()

Exception: Unsupported method.
> /home/moorepants/Manuscripts/bmd2023-stable-low-speed-cargobike/src/symengine_wrapper.pyx(3860)symengine.lib.symengine_wrapper.DenseMatrixBase.solve()
@certik certik added the PyDy label Sep 16, 2023
@isuruf
Copy link
Member

isuruf commented Sep 16, 2023

This requests CRAMER and we only support LU, FFLU, GJ (LU factorization, Fraction-free LU factorization, Gauss-Jordan).
So, this should be moved to C++ library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants