diff --git a/mathpad/mech.py b/mathpad/mech.py index 54c2427..fd7bf6b 100644 --- a/mathpad/mech.py +++ b/mathpad/mech.py @@ -1,4 +1,3 @@ -from typing import Type, cast from mathpad import * @@ -15,10 +14,10 @@ def kinetic_energy(*, m: X[Mass], v: X[Velocity]) -> Energy: Kinetic energy of the particle in joules Example: - >>> kinetic_energy(m=1 * kg, v=2 * m/s) - 2 joules >>> kinetic_energy(m="m" * kg, v="v" * m/s) 0.5*mv**2 joules + >>> kinetic_energy(m=1 * kg, v=2 * m/s) + 2 joules """ return (m * v ** 2 / 2).in_units(joules) # type: ignore @@ -46,11 +45,10 @@ def euler_lagrange( Euler-Lagrange equation for a system of particles. Arguments: - sum_KE: sum of kinetic energies of particles - sum_PE: sum of potential energies of particles - sum_NCF: sum of net contact forces on particles + KE: sum of kinetic energies of particles + PE: sum of potential energies of particles + NCF: sum of net contact forces on particles var: variable you are interested in finding the dynamics for - """ L = KE - PE return diff(diff(L, wrt=diff(var)), wrt=t) - diff(L, wrt=var) == NCF # type: ignore @@ -62,7 +60,7 @@ def impulse_momentum( m: X[Mass], # mass v1: X[Velocity], # initial velocity F: X[Force], # impulse force required - t: X[Time], # impulse duration in seconds + t: X[Time], # impulse duration v2: X[Velocity], # final velocity ) -> Equation: "The force required during an instant to change an object's velocity" diff --git a/mathpad/simulate_dynamic_system.py b/mathpad/simulate_dynamic_system.py index 3921f8f..17ee3fd 100644 --- a/mathpad/simulate_dynamic_system.py +++ b/mathpad/simulate_dynamic_system.py @@ -190,7 +190,7 @@ def simulate_dynamic_system( ] # outputs are highest of input derviatives plus recorded data - # ie [dddx, record[0], record[1]] + # ie [ddx, ddy, record[0], record[1]] lambdified = lambdify([x_axis.expr, inputs], solution_vec, 'numpy') data = [] @@ -285,7 +285,7 @@ def step(x: float, state: np.ndarray): "yanchor": "top", }, }, - ).show("svg" if plot_static else None) + ).show("svg" if plot_static else None) # type: ignore all_data.extend(data)