# Question:How to plot the error function figures

## Question:How to plot the error function figures

Thanks for your attention firstly. I want to plot the error function between the exact solution and numerical

solution. However, there are some errors. Here is my procedure. would do you like help for this procedure?

restart:
with(plots):
Digits:= 32;
u := 1;
w1 := 10;
w2 := 5;
ode := diff(y(t), `\$`(t, 2)) = u*(1 - y(t)* y(t))*diff(y(t), `\$`(t, 1)) - y(t) + t*exp(I*2*w1*t) + t^2*exp(I*2*w2*t):
ics := y(0) = 1:
dics:= D(y)(0)= 0:
p1 := dsolve({ics, dics, ode}, y(t)):
f := unapply(rhs(p1), t):
p2 := dsolve({ics, dics, ode}, numeric, method = classical[rk4]):
with(linalg):
v1t := Vector(629):
v2R := Vector(629):
v2I := Vector(629):
m:= 1:
for x from 0 by 0.1e-1 to 6.28 do :
v1t[m] := x :
v2R[m] := Re(f(x)-rhs(p2(x)[2])) :
v2I[m] := Im(f(x)-rhs(p2(x)[2])) :
m := m+1:
end do :
plot(v1t, v2R, style = line, symbol = asterisk);
plot(v1t, v2I, style = line, symbol = asterisk, color = blue);

﻿