Skip to content
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

MethodError forgot fixed #217

Closed
oameye opened this issue Aug 20, 2024 · 0 comments · Fixed by #282
Closed

MethodError forgot fixed #217

oameye opened this issue Aug 20, 2024 · 0 comments · Fixed by #282
Labels
bug Something isn't working

Comments

@oameye
Copy link
Member

oameye commented Aug 20, 2024

When one forget to add the fixed variable one gets a MethodError. However does should be an AssertationError.

@variables ω1, ω2, ωₘ, t, ω, F, γ, λ, x(t), y(t);
eqs = [d(x, t, 2) + (ω1^2 - λ * cos(ωₘ * t)) * x + γ * d(x, t) - λ * cos(ωₘ * t) * y,
    d(y, t, 2) + (ω2^2 - λ * cos(ωₘ * t))y + γ * d(y, t) - λ * cos(ωₘ * t) * x] - [F * cos* t), 0.0]

diff_eq = DifferentialEquation(eqs, [x, y])

add_harmonic!(diff_eq, x, ω) # drive frequency, close to ω1
add_harmonic!(diff_eq, y, ω) # ωₘ will be close ω2 - ω1 to response at the upper sideband
add_harmonic!(diff_eq, x, ω + ωₘ) # ωₘ will be close ω2 - ω1 to response at the upper sideband
add_harmonic!(diff_eq, x, ω - ωₘ)
add_harmonic!(diff_eq, y, ω + ωₘ)
add_harmonic!(diff_eq, y, ω - ωₘ)
add_harmonic!(diff_eq, x, ω + 2 * ωₘ)
add_harmonic!(diff_eq, x, ω - 2 * ωₘ)
add_harmonic!(diff_eq, y, ω + 2 * ωₘ)
add_harmonic!(diff_eq, y, ω - 2 * ωₘ)
add_harmonic!(diff_eq, x, ω + 3 * ωₘ)
add_harmonic!(diff_eq, x, ω - 3 * ωₘ)
add_harmonic!(diff_eq, y, ω + 3 * ωₘ)
add_harmonic!(diff_eq, y, ω - 3 * ωₘ)
add_harmonic!(diff_eq, x, ω + 4 * ωₘ)
add_harmonic!(diff_eq, x, ω - 4 * ωₘ)
add_harmonic!(diff_eq, y, ω + 4 * ωₘ)
add_harmonic!(diff_eq, y, ω - 4 * ωₘ)


fixed = (ω1 => 0.95, ω2 => 1.05, ωₘ => 0.1, γ => 0.005, λ => 0.0, F => 1e-4)   # fixed parameters
varied = ω => range(0.7, 1.3, 100)           # range of parameter values
result = get_steady_states(harmonic_eq, varied, threading=true)
MethodError: no method matching filter(::HarmonicBalance.var"#91#93", ::Pair{Symbolics.Num, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}})
The function `filter` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  filter(::Function, ::DataStructures.LinkedList{T}) where T
   @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/list.jl:81
  filter(::Function, ::DataStructures.MutableLinkedList{T}) where T
   @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/mutable_list.jl:92
  filter(::Any, ::AbstractSet)
   @ Base abstractset.jl:624
  ...


Stacktrace:
 [1] get_steady_states(p::HarmonicEquation, pairs::Pair{Symbolics.Num, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}; kwargs::@Kwargs{threading::Bool})
   @ HarmonicBalance ~/.julia/packages/HarmonicBalance/0J1i1/src/solve_homotopy.jl:180
 [2] top-level scope
   @ In[20]:3
@oameye oameye added the bug Something isn't working label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant