Skip to content

EOM using Lagrange and least action - #1

Open
GeorgeHanna04 wants to merge 1 commit into
mainfrom
GeorgeHanna04-patch-1
Open

GeorgeHanna04 wants to merge 1 commit into
mainfrom
GeorgeHanna04-patch-1

Conversation

@GeorgeHanna04

@GeorgeHanna04 GeorgeHanna04 commented Feb 24, 2026

Copy link
Copy Markdown

With the assistance of Dr. Cooper’s Copilot Julia Assistant, I defined the system parameters, kinetic and potential energy, and constructed the Lagrangian L=T−V. I then computed the required derivatives and assembled the Euler–Lagrange equation of motion. Finally, I implemented this procedure in Julia using Symbolics.jl and Latexify.jl, obtaining a working script that symbolically derives and outputs the equation of motion in LaTeX.

What hasn't been addressed yet:

  • solve for the motion for a slow rotation speed and a fast rotation speed
  • visualize the solution with plots and animations

*Having Trouble saving my work using pluto's "save notebook" feature as a .jl file as opposed to a .html on my macbook. Any tips are appreciated.

In the meantime my julia code is below:

begin
using Symbolics
using Latexify

@variables t Ω L g w1 h1 m
@variables θ(t)
D = Differential(t)

θdot = D(θ)

x_prime = w1 + L*sin(θ)
z_prime = h1 - L*cos(θ)

T = 0.5*m*(L^2*θdot^2 + Ω^2*x_prime^2)
V = m*g*z_prime
Lag = T - V

dL_dθ    = expand_derivatives(Symbolics.derivative(Lag, θ))
dL_dθdot = expand_derivatives(Symbolics.derivative(Lag, θdot))
eom      = expand_derivatives(D(dL_dθdot) - dL_dθ)

println("LAGRANGIAN:")
println()
println(latexify(Lag))

println("EQUATION OF MOTION:")
println()
println(latexify(eom))


println("SIMPLIFIED FORM (divide by m·L):")
println()
println("L·θ̈ + g·sinθ - Ω²·w₁·cosθ - Ω²·L·sinθ·cosθ = 0")

end

With the assistance of Dr. Cooper’s Copilot Julia Assistant, I defined the system parameters, kinetic and potential energy, and constructed the Lagrangian L=T−V. I then computed the required derivatives and assembled the Euler–Lagrange equation of motion. Finally, I implemented this procedure in Julia using Symbolics.jl and Latexify.jl, obtaining a working script that symbolically derives and outputs the equation of motion in LaTeX.

What hasn't been addressed yet:
- solve for the motion for a slow rotation speed and a fast rotation speed
- visualize the solution with plots and animations
@Hlpred

Hlpred commented Feb 25, 2026

Copy link
Copy Markdown

Thanks for starting the project. I just submitted my own PR that builds off of your code. For my code, I decided to use the built in equation visualization so that I could see what I was working on.

I'm not sure what the issue is with your notebook not saving properly. If you have a local copy of the notebook that you are trying to edit, I think you just have to do ctrl+s.

@GeorgeHanna04

Copy link
Copy Markdown
Author

The visuals look great. Thank you for keeping the flow going!

Still no luck saving the .jl file, I am running Pluto using a local web server via safari. I also just tried the CTRL + S method, but unfortunately it seemed to do nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants