-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
Trying to get started with this code generation thing, I simply copied an example given in the codegen section of the introduction, see below.
- The result given in the documentation is [2., -7.], I get [2., -1.3333333], maybe no big deal.
- As I see it, the system is a simple mass oscillator with parameters c0, k0, m0. and generalized coordinates/speeds x0, v0
In the linerhs(array([1.0, 2.0]), 0.0, array([1.0, 2.0, 3.0]))I do not understand why the first argument is an array[1.0, 2.0]. does this not correspond to x0(t), like the second entry corresponds to v0(t)?
Thanks
from numpy import array
from pydy.models import multi_mass_spring_damper
from pydy.codegen.ode_function_generators import generate_ode_function
sys = multi_mass_spring_damper()
sym_rhs = sys.eom_method.rhs()
q = sys.coordinates
u = sys.speeds
p = sys.constants_symbols
print(q, u, p)
print(sym_rhs)
rhs = generate_ode_function(sym_rhs, q, u, p, generator='cython')
rhs(array([1.0, 2.0]), 0.0, array([1.0, 2.0, 3.0]))
Metadata
Metadata
Assignees
Labels
No labels