# Differential equation with polynomial powers

I'm trying to solve the following equation:

Sin[f t] == y[t] + y[t]^3 + y'[t] + (y'[t])^3


Where f is a constant, the frequency of the oscillation. I have tried using DSolve and NDSolve, but I cannot get a solution due to the cube in the equation. With NDSolve I gave initial conditions of

y[-Pi/f] == y[Pi/f]


and domain

{t, Pi/f, -Pi/f}


Does anybody know how this equation can possibly be solved?

• What is f? an expression or a parameter? – zhk Apr 17 at 7:50
• f is a constant. It's the frequency of the oscillation in my problem. Sorry. I edited the question. Thank you! – Step Apr 17 at 7:51

Use ParametricNDSolveValue

ode =  Sin[f Pi t] == \[Gamma][t] + \[Gamma][t]^3 +Derivative[1][\[Gamma]][t] + Derivative[1][\[Gamma]][t]^3
gamma = ParametricNDSolveValue[{ode, \[Gamma][0] == \[Gamma]0}, \[Gamma], {t, -10, 10}, {f, \[Gamma]0}]


to solve your problem for initial condition \[Gamma][0] == \[Gamma]0

What you call "intial condition" is only a restriction to force symmetrie \[Gamma][t]==\[Gamma][-t]

Perhaps you can calculate, for given f, the parameter \[Gamma]0 to restrict the symmetrie?

To force symmetrie at t=10 try ContourPlot

ContourPlot[gamma[f, \[Gamma]0][10] == gamma[f, \[Gamma]0][-10], {f, 1,3}, {\[Gamma]0, -.1, .1}, MaxRecursion -> 3,FrameLabel -> {f, \[Gamma]0}]


• Yes, I wanted to restrict the symmetry of the solution, since I am also expecting symmetry in Gamma (or y after editing). Can you expound on the calculating Gamma0? Apologies, I'm new to Mathematica and still familiarizing a lot of the syntax. – Step Apr 17 at 8:08
• What do you know about the parameters f,\[Gamma]0? – Ulrich Neumann Apr 17 at 8:21
• f is a constant, it's the frequency I use in my experiments. The reason why I restrict the symmetry is because that's the only part of the curve that have values I know for sure, so the value at \[Gamma][0] and \[Gamma]0 itself are unknown to me. Does this make sense? – Step Apr 17 at 8:24
• @Step I edited my answer! – Ulrich Neumann Apr 17 at 9:15
• I ran your suggestion on solving for the \[Gamma][0]==\[Gamma]0 but would you care to explain how the ContourPlot can force the symmetry at t=10? I think I have to keep the symmetry at the endpoints \[Gamma][-t]==\[Gamma][t] – Step Apr 17 at 9:29