-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Duffing Spring Simulation #26625
Comments
This looks nice. My suggestion is that we add the example in the documentation. We can use numpy, scipy, and matplotlib in the docs. If we create an explanatory page about actuators in the prose documentation, then you can place it there. Whether you put it "tutorials", "how-to guides", or "explanations" depends on how you present the material. I don't really understand the difference in the three, but maybe you can make a judgement. Eventually we need to move all of the prose documentation in the physics.vector and physics.mechanics sections into one of these top level sections, so you can be the first to establish where these things go. I'm guessing this is a little long of an example to belong in the docstring. @tjstienstra thoughts? |
This is indeed a really nice example, where you show that we can reproduce the results with a simulation. I agree that it would be best not to put it in the docstring, but in another location. Previously, I would have put examples in physics/mechanics/examples, but I think that "tutorials" is probably the place we should start moving our examples to. |
Thanks for the feedback! How about creating two directories: |
In the tutorials directory: https://github.com/sympy/sympy/tree/master/doc/src/tutorials we should probably follow the directory structure of the sympy subpackages. For example there is a |
If you go about moving any examples from the old location, then you will need to set up link redirects. We have a sphinx plugin that reasonably automates that. |
Hi, As part of implementing the DuffingSpring class in
sympy.mechanics
, I've tried to simulate and verify its functionality. In the DuffingSpring Simulation.ipynb.zip (I attached a zip file because GitHub doesn't support ipynb files. Sorry for any inconvenience), I first define the problem by deriving the equation of motion for the Duffing system, numerically solve the equation usingsolve_ivp
fromscipy.integrate
, and then visualise the system. The plots include:To explore the behaviour of the equation with various alpha and beta values, I simulate different combinations of parameters. I also extend the time span for a longer simulation and add a plot for total mechanical energy.
The plot of the Duffing oscillator's restoring force validates its functionality and accuracy since the resulting plots align well with expectations and reference literature.
Additionally, I consider adding examples in the docstring as follows:
I would be glad to hear any feedback or suggestions to improve this simulation!
@tjstienstra
The text was updated successfully, but these errors were encountered: