
8.1. NONLINEAR ODES: EXACT METHODS 297
8.1.3 Not As Hard As It Seems
Often, the less there is to justify a traditional custom,
the harder it is to get rid of it.
Mark Twain, American author, Tom Sawyer, ch. 5, 1876
When a spring is stretched from its equilibrium length by an amount x which
is no longer small, Hooke’s law must be modified so as to include nonlinear or
anharmonic terms in x. For symmetric oscillations of a nonlinear spring about
equilibrium, the next terms retained in the Taylor expansion of the force must
be cubic in x. In this case, the force F required to stretch the nonlinear spring
will be of the form F =k
1
x + k
2
x
3
=k
1
(x + ax
3
), with k
1
> 0anda ≡ k
2
/k
1
.
If a>0, one has a hard spring because it is harder to stretch than a linear
spring (a = 0). If a<0, one has a soft spring. Inthisrecipe,wewillsolvethe
equation of motion for the oscillations of a mass m attached to a (light) hard
spring allowed to move horizontally on a smooth horizontal surface. Applying
Newton’s second law, the equation of motion of m at arbitrary time τ is
m ¨x(τ)+k
1
(x(τ)+ax(τ )
3
)= 0 (8.2)
or, on introducing a new time variable t=
k
1
/m τ ,
¨x(t)+x(t)+ax(t)
3
=0. (8.3)
Unlike the situation for the linear spring where the solution is in terms of ele-
mentary functions (sine or cosine), the solution for the hard spring will involve
another “special” function, the Jacobian elliptic function. As you will see, by
using computer algebra, deriving the solution is not as hard as it seems.
Taking, say, a=1, the equation of motion (8.3) is entered in ode .
>
restart: a:=1:
>
ode:=diff(x(t),t,t)+x(t)+a*x(t)ˆ3=0;
ode := (
d
2
dt
2
x(t)) + x (t)+x (t)
3
=0
The dsolve command is applied to ode .Twoimplicit solutions are generated,
with the time t giveninintegralform(
a is the integration variable) and two
arbitrary constants,
C1 and C2 , present. The positive square root solution
must be selected in order to produce a positive period for the oscillatory motion.
>
sol:=dsolve(ode,x(t)); #choose positive root
sol :=
x (t)
2
√
−4 a
2
− 2 a
4
+4 C1
d
a − t − C2 =0,
x (t)
−
2
√
−4 a
2
− 2 a
4
+4 C1
d
a − t − C2 =0
The positive square root solution (the first one here) is selected and differenti-
ated with respect to t. This removes the constant
C2 .
>
eq1:=diff(sol[1],t);