NonlinearOscillations / HarmonicBalance.jl

A Julia package for solving nonlinear differential equations using the harmonic balance method.
https://NonlinearOscillations.github.io/HarmonicBalance.jl/
BSD 3-Clause "New" or "Revised" License
55 stars 8 forks source link

function get_harmonic_equations does not take into account hyperbolic sine #8

Closed emanuelcruvinel closed 2 years ago

emanuelcruvinel commented 2 years ago

Hi,

While solving a set of differential equations:

free_eq = [m1(d(x1,t,2)) + k1x1 + (k2/alpha)sinh(alpha(x1-x2)), m2(d(x2,t,2)) - (k2/alpha)sinh(alpha*(x1-x2))]

The function get_harmonic_equations basically ignores the hyperbolic sine as we can see below:

A set of 4 harmonic equations Variables: u1(T), v1(T), u2(T), v2(T) Parameters: k1, ω, m1, k2, alpha, F, m2

Harmonic ansatz: x1(t) = u1cos(ωt) + v1sin(ωt) x2(t) = u2cos(ωt) + v2sin(ωt)

Harmonic equations:

k1u1(T) + (2//1)m1ωDifferential(T)(v1(T)) - F - m1(ω^2)u1(T) ~ 0

k1v1(T) - m1(ω^2)v1(T) - (2//1)m1ωDifferential(T)(u1(T)) ~ 0

(2//1)m2ωDifferential(T)(v2(T)) - m2(ω^2)*u2(T) ~ 0

(-2//1)m2ωDifferential(T)(u2(T)) - m2(ω^2)*v2(T) ~ 0

I had to linearize sinh to get the correct answer haha.

jdelpino commented 2 years ago

Thanks for your inquiry Emanuel!

Currently, we only support nonlinear polynomial equations, since those are the ones for which homotopic continuation techniques are developed (to the best of our knowledge). You can find more information in out preprint https://arxiv.org/abs/2202.00571 and https://www.juliahomotopycontinuation.org. We could add a warning to prevent nonlinear non polynomial systems to be input.

Have you tried to get converged results by adding successive higher powers of sinh(x)? That would be a really interesting example too!