Question: code for ODE Plot need some help

Hellow sir, I am unable to plot the graph of ode , i am writing the sample code , please remove the errors

 

restart:
ode:=-diff(y(x),x,x)+(1/4)*y(x)-4*exp(-x)=0:
init:=y(0)=0,y(1)=0:
exact:=dsolve({ode,init},y(x)):
N:=8:
trial:=sum(c[i]*x^i,i=1..N):
residual:=lhs(subs(y(x)=trial,ode)):
R:=simplify(residual):
sys:=[]:
for i from 1 to N  do sys:=[op(sys),int(R*x^i,x=0..1)=0];    
od:
sys:
vars:=seq(c[i],i=1..N):
A,b:=LinearAlgebra[GenerateMatrix](sys,[vars]):
sol:=solve({op(sys)},{vars}):
assign(sol):
trial:

# if i am plotting the graph exact and trial i am getting the error, separately if i am plotting the graph of exact i am getting the plot, similarly exact - trial error
trial_fun:=unapply(trial,x):
exact_fun:=unapply(rhs(exact),x):
evalf(trial_fun(1)-exact_fun(1)):
plot(exact,trial,x=0..1):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct
plot(trial,x=0..1,legend['trial']):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct



#error calculation

plot(exact-trial,x=0..1):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct


restart:

restart:

Eqn:=-diff(y(x),x,x)+(1/4)*y(x)-4*exp(-x)=0:
BCs:=y(0)=0,y(1)=0:
dsolve({Eqn,BCs},y(x)):
assign(%):y:=unapply(y(x),x):
plot(y(x),x=0..1);
 

 

Please Wait...