Table of Contents
- Introduction
- How to Start / Basic Usage
- ODESystem Class Usage
- Custom styles
- Simulation Engine
- Data Handling
- Dynamic Modeling
- Installation & Setup (Optional, for Local Development)
- Licensing Information
Introduction
1. What is DynPi?
DynPi is a Python module designed for engineering calculations on dynamical systems. It provides a comprehensive framework for modeling, simulating, and analyzing dynamic mechanical systems. DynPy is the first tool of its kind to simplify performing scientific activities and enginnering calculations! It’s ready-to-use code that generates reports in engineering mechanics. You can create your own mechanical simulations, use tools for modeling mechanical systems and their dynamics, and take advantage of a built-in solver for ordinary differential equations (ODEs). All of this is available in just 10 code cells – with every step and hint clearly described below and within the code itself (marked with #). We’re also including an instructional video showing how to create a sample report: Writing your own diploma still looking for tools to use? Word, DynPy and .... ChatGPt. These tools have its pros and cons - all depends on how do you use it and how do u like to work. Word it's classic - everyone knows and can use it. Starter for wrtining, formatting, adding adnotations and commentaries. Good for theory, literature reviews, humanities papers. However, when it comes to simulations and calculations, then sorry you're obliged to open other programs. DynPy is an engineering combine. Simulations, calculations and modelling it's hard and DynPy is superior in this especailly if you are into mechanics and automation. DynPy allows you to create professional looking raports. Moreover they are created in PDF format. Cons? You must pick up a little coding. Once you learn it, it works wonders. ChatGPT? It's your go-to buddy for everything – it'll sometimes help write an introduction, check your spelling, suggest how to calculate something, or explain what a given piece of code does. However, it won't always be accurate, it won't substitute DynPy for simulations and reporting.
2. Key Features
- Dynamics Module: Tools for modeling mechanical systems and their dynamics.
- Mechanical Models: A collection of predefined mechanical models developed by experts.
- Symbolic and Numeric Solvers: Tools for solving Ordinary Differential Equations (ODEs) using symbolic and numerical methods.
- Reporting Module: A structured reporting system for generating and exporting reports.
3. Getting Started on CoCalc
To begin working with DynPi, you need an account on CoCalc.
- Create an account on CoCalc.
- Accept the project invitation using this link.
- Open the README file.
- Follow the instructions in the introductory guide.
How to Start / Basic Usage
1. Example Scripts
To view exemplary capabilities of dynpy, run the following example script:
from dynpy.models.mechanics.pendulum import Pendulum
Pendulum().interactive_preview()
2. Creating First Document / Report
from dynpy.utilities.report import *
from dynpy.utilities.documents.document import Report
SympyFormula._break_mode = 'eq'
doc = Report('./output/sample_report', title="Sample Report")
section = Section('Exemplary section name')
CurrentContainer(section)
display(Markdown(''' Exemplary Markdown text in the section '''))
display(ReportText(' Exemplary text appended into section '))
doc.append(section)
doc.generate_pdf(clean_tex=False)
3. Looking for some help
Documentclasses with generic content of exemplary document:
from dynpy.utilities.documents.document import *
Report.base_setup()
BeamerPresentation.base_setup()
Guide.base_setup()
WutThesis.base_setup()
Guides that provides step by step instructions:
from dynpy.utilities.creators import list_of_guides
list_of_guides()
Defining Report Content
Creating a section of document
section = Section('Sample section name')
Creating a subsection of document
subsection = Subsection('Sample subsection name');
</code></pre>
<h4><a href="#user-content-selecting-a-section-or-subsection-to-add-content-to" aria-hidden="true" class="anchor" id="user-content-selecting-a-section-or-subsection-to-add-content-to"></a>Selecting a section or subsection to add content to</h4>
<pre><code class="language-python">section = Section('Sample section name')
CurrentContainer(section);
Adding text to section via ReportText
from dynpy.utilities.report import *
display(ReportText('Sample text'));
Adding text to section via Markdown
from dynpy.utilities.report import *
display(Markdown(
'''
Sample text
'''
))
Adding an image into the section
Picture('./images_folder/image_name.PNG', caption = 'Sample caption') # './images_folder/image_name.PNG' is certain '/route/to/file' path
Appending sections and subsections into the document
doc.append(sample_section_name)
Incorporating Simulation Results
# Add simulated data here
Adding Formulas, Data Tables and Visualizations
Adding formula to the document
from dynpy.utilities.report import *
from sympy import *
d, r, fib, fia, = symbols('d r varphi_B varphi_A') #many symbols at once
thetaa = Symbol('thetaa') #separate definition of the symbol
thetab = Symbol('thetab') #separate definition of the symbol
harvestine_formula = Eq(d, 2 * r * asin(sqrt(sin((fib - fia) / 2)**2 + (cos(fia) * cos(fib) * sin((thetab - thetaa) / 2)**2))))
display(SympyFormula(harvestine_formula))
Creating table and adding it to document
from dynpy.utilities.report import *
from dynpy.utilities.adaptable import *
predicted_travel_time = Subsection('Predicted Travel Time');
CurrentContainer(predicted_travel_time)
time_s = Symbol('t_s', positive=True)
time_h = Symbol('t_h')
length = Symbol('l', positive=True)
velocity = Symbol('v', positive=True)
dane = {
'Start': ['NYC', 'Albany', 'Syracuse', 'Buffalo', 'Cleveland', 'Toledo', 'Total line'],
'Stop': ['Albany', 'Syracuse', 'Buffalo', 'Cleveland', 'Toledo', 'Chicago', ''],
time_s: [3348, 3386, 2782, 4362, 2606, 4824, 21308],
time_h: ['00:55:48', '00:56:26', '00:46:22', '01:12:42', '00:43:26', '01:20:24', '05:55:08'],
length: [215.981, 219.844, 225.822, 295.54, 172.905, 369.093, 1499.185],
velocity: [232.24, 233.74, 292.22, 243.91, 238.86, 275.44, 253.29]
}
unit_dict = {
time_s: ureg.second,
time_h: ureg.hour,
length: ureg.kilometer,
velocity: ureg.kilometer / ureg.hour
}
LatexDataFrame.set_default_units(unit_dict)
report_table = LatexDataFrame.formatted(
data = dane)
display(report_table.reported(caption="Travel Time Data Table"))
Creating plot and adding it to document
import matplotlib.pyplot as plt
from dynpy.utilities.report import PltPlot
plt.plot([0, 1, 2], [0, 1, 4],label='linear')
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('Sample Plot')
plt.legend()
data_plot=PltPlot(caption='Sample plot')
display(data_plot)
from dynpy.utilities.report import *
from dynpy.utilities.adaptable import *
LatexDataFrame.set_default_units(unit_dict)
results_df = LatexDataFrame.formatted(
data = dane)
#METHOD #1 (optional way) - via matplotlib
results_df.to_latex_dataframe.plot()
dataplot_plt=PltPlot(caption='Sample plot')
display(dataplot_plt)
#METHOD #2 (preferred way) - via matplotlib
dataplot_tikz=results_df.to_pylatex_tikz(height=8).in_figure(caption='Sample plot 2')#comment for preview
display(dataplot_tikz)#comment for preview
There is a possibility of providing analitycal solution
from dynpy.solvers.linear import AnalyticalSolution
from sympy import *
import numpy as np
t =Symbol('t')
x = Function('x')(t)
results_df=AnalyticalSolution.from_vars_and_rhs([x],[cos(t)+sin(t)**2]).compute_solution(np.linspace(0,100,10001))#.plot()
#METHOD #1 (optional way) - via matplotlib
results_df.to_latex_dataframe.plot()
dataplot_plt=PltPlot(caption='Sample plot')
display(dataplot_plt)
#METHOD #1 (preferred way) - via matplotlib
dataplot_tikz=results_df.to_pylatex_tikz(height=8).in_figure(caption='Sample plot 2')#comment for preview
display(dataplot_tikz)#comment for preview
There is a possibility of providing analitycal solution
from dynpy.solvers.linear import AnalyticalSolution
from sympy import *
import numpy as np
t =Symbol('t')
x = Function('x')(t)
y = Function('y')(t)
results_signals_df=AnalyticalSolution.from_vars_and_rhs([x,y],[cos(t)+sin(t)**2,1+exp(cos(t/2)+sin(t/2)**2)]).compute_solution(np.linspace(0,100,10001))#.plot()
### PREVIEW
#results_signals_df.plot(title='Sample plot', xlabel='Time [s]', ylabel='Value', figsize=(14, 3))#uncomment for preview, !!!!DON"T USE IN RAPORT!!!!
data_plot=results_signals_df.to_pylatex_tikz(height=8).in_figure(caption='Time history of the process')#comment for preview
display(data_plot)
3. Exporting Reports
Supported Formats
- LaTeX
- Markdown
Exporting Procedures
#for LaTeX report (only LaTeX distribution is needed)
from dynpy.utilities.creators import PdfLatexGenerator
PdfLatexGenerator(doc).generate_file()
#for LaTeX report (LaTeX distribution and perl are needed)
doc.generate_pdf(clean_tex=False)
#for `.docx` file
import pypandoc
doc.generate_tex('./output/sample_report')
pypandoc.convert_file('./output/sample_report.tex',to='docx',format='tex',outputfile="./output/sample_report.docx")
4. Practical Examples
Generating a Simple Report
from dynpy.utilities.report import *
from dynpy.utilities.documents.document import Report
doc = Report('./output/sample-report')
sample_section = Section('Sample Section')
CurrentContainer(sample_section)
display(ReportText('Sample text'));
second_sample_section = Section('Second Sample Section')
CurrentContainer(second_sample_section)
display(ReportText('Sample text'));
sample_subsection = Subsection('Sample Subsection');
CurrentContainer(sample_subsection);
display(ReportText('Sample text'));
second_sample_subsection = Subsection('Second sample Subsection');
CurrentContainer(second_sample_subsection);
display(ReportText('Sample text'));
doc.append(sample_section)
doc.append(second_sample_section)
doc.append(sample_subsection)
doc.append(second_sample_subsection)
doc.generate_pdf(clean_tex=False)
ODESystem Class Usage
ODESystem class usage preview based on a damped mehanical oscillator
from sympy import *
from dynpy.solvers.linear import ODESystem
from sympy.physics.mechanics import dynamicsymbols
m = Symbol('m',positive = True)
c = Symbol('c',positive = True)
k = Symbol('k',positive = True)
t=Symbol('t')
x=dynamicsymbols('x')
eq1 = Eq(m*x.diff(t,2)+c*x.diff(t)+k*x,0)
odesys = ODESystem(odes = Matrix([eq1.lhs-eq1.rhs]),dvars =Matrix([x],ode_order=2))
odesys.solution
ODESystem operations on dynamical systems
from dynpy.models.mechanics.trolley import ForcedSpringMassSystem
import numpy as np
from sympy import *
dsys =ForcedSpringMassSystem()
t =dsys.ivar
z = dsys.z
k=dsys.k
F=dsys.F
g=dsys.g
m=dsys.m
dane={
k:1,
m:1,
F:0,
g:9.81,
}
t_span=np.linspace(0.0,10,1000)
ode=dsys.eoms
ode.subs(dane).numerized().compute_solution(t_span, [0.1, 0.0]).plot()
ode.solution.with_ics([0.1,0]).subs(dane).numerized().compute_solution(t_span).plot()
More information about ODESystem class:
from dynpy.utilities.documents.guides import BasicsOfODESystemGuide
BasicsOfODESystemGuide()
</code></pre>
<h2><a href="#user-content-5-customization-options-advanced" aria-hidden="true" class="anchor" id="user-content-5-customization-options-advanced"></a>5. Customization Options (Advanced)</h2>
<h3><a href="#user-content-formatting-text-and-equations" aria-hidden="true" class="anchor" id="user-content-formatting-text-and-equations"></a>Formatting Text and Equations</h3>
<pre><code class="language-python">///
Customizing Layout and Styles
///
Custom styles
Utilizing Templates for Consistency
///
Use predefined templates
///
Simulation Engine
///
Data Handling
///
Dynamic Modeling
///
Installation & Setup (Optional, for Local Development)
Requirements
Python Version: Python 3.8+. Required Libraries:
- numpy
- pylatex
- sympy
- pandas
- matplotlib
- scipy
- pint
- pypandoc
- pygithub
- wand
- pymupdf
Manual Installation
pip install numpy pylatex sympy pandas matplotlib scipy pint pypandoc wand pymupdf
pip install dynpi
Installing the Development Environment for Engineering Analysis
- Install Python (Microsoft Store)
- Install Visual Studio Code (Microsoft Store) 2.5 Install Git
- Install the DynPy library (https://github.com/bogumilchilinski/dynpy) Git clone command https://github.com/bogumilchilinski/dynpy
- Install the library - instructions on GitHub - bogumilchilinski/dynpy (https://github.com/bogumilchilinski/dynpy?tab=readme-ov-file#manual-installation) 4.5 Installing the plugin in VS Code (git extension package + latex workshop)
- Creating a virtual environment in VSCode Working folder on the main drive + subfolders (output, images) Set the kernel and Jupyter Notebook environment Set Git Autofetch: True in VSCode settings
Support LaTeX: 6. Install a separate Latex distribution - e.g., MikaTex (https://miktex.org/download#dok) 7. (optional) Strawberry Pearl environment Installation: https://strawberryperl.com/ + remaining steps to obtain the PDF (admin required)
Licensing Information
DynPy is distributed under an open-source license. Refer to the LICENSE file for details.
Metadata
Release files for Dyn4py 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dyn4py-1.0.7.tar.gz | 65.8 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dyn4py-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.8 MB
Release files / dyn4py-1.0.7.tar.gz
| Download URL | dyn4py-1.0.7.tar.gz |
|---|---|
| Size | 65.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2654a0b9c0661ae8c44a414d6fc168402d1464ec2ae68387fad528aee664dccb
|
|
BLAKE2b-256 checksum How to use checksums |
5bb40d242082dc1bc249cd8f3b5392b4657de4c24f9aacec21e6fd6b7803bae4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2025.
Transparency logRelease files / dyn4py-1.0.7-py3-none-any.whl
| Download URL | dyn4py-1.0.7-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4fd696579c647301f9478935283840125da36e3482de7fb3ec12de58fa7e268
|
|
BLAKE2b-256 checksum How to use checksums |
b62e3a215fe5a3586fd7f4f5ac6f230f9b532a6f95685167d2196ba3bb903f2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2025.
Transparency logSecurity for Dyn4py 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for dyn4py-1.0.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.