## 8 Reputation

16 years, 316 days

## Solving nonlinear ODE (nonlinear spring)...

Maple
Hi, I'am trying to solve a nonlinear (spring) ODE like: > ode := A*(diff(x(t), t, t)) + B*(diff(x(t), t)) + R(x(t)) = 1; ...So, I defined a nonlinear (elastic-plastic) resistance function R(x(t)): > xLast := 0; RLast := 0; Rmax := 1; > R := proc (x) > local RR, dx; > global xLast, RLast, Rmax, K; > dx := x-xLast; > RR := RLast+K*dx; > if Rmax <> elif RR <> end if; > xLast := x; RLast := RR; > return RR; > end proc; ...Set up the ODE: > xLast := 0; RLast := 0; > ode := A*(diff(x(t), t, t))+B*(diff(x(t), t))+R(x(t)) = 1;

## Plotting ODE with constants...

Maple
Hello, I'am using Maple 11 and have the following problem concerning plots of ODE: ode := M*(diff(x(t), t, t))+K*x(t) = Force; sol := dsolve({ode, x(0) = 0, (D(x))(0) = 0}, numeric); xx := (t) -> rhs(sol(t)[2]); dx := (t) -> rhs(sol(t)[3]); M := 1; K := 4*Pi^2; test := proc (F, t) global Force; Force := F; xx(t) end proc; When I call test(F,t) directly everything works fine: test(2, 2); -2.49946953367608378 10 ..... However, when I try to plot the test-function vs Force I get an error message: plot(test(pressure, 1), pressure = 1 .. 3); Error, (in sol) global 'Force' must be assigned to a numeric value before obtaining a solution
 Page 1 of 1
﻿