imparter

155 Reputation

8 Badges

12 years, 199 days

MaplePrimes Activity


These are questions asked by imparter

help required to find the value of u analytically

 

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);
 

 

i want to write the code for picewise polynomial :

if i take h=10 ,interval [0,1] takes the values j =0,0.1,0.2,     so on up to 1 and the polynomial it should take 

(x-xj+1)/0.1,when x<0.1,

(x-xj+2)/0.1  when x<0.2

..... 

(x-xj+9)/0.1   when x<1

Hellow,

how to write the codes for linear Lagranges piecewise polynomial in the interval x=[0,1] by taking h=0.1. 

if we fix h=0.1 automatically it should take the polynomial like these sample

x<0.1,(x-1)/0.2,x<0.2,(x^2-3x)/0.2,..... so on

 

Dear sir,

I want to plot the graph of Differential Equation numerically and other equation by changing the parameter values beta=2,2.5,5 . i am writing an sample codes and graph. the range of x is 0,..0.1

Eq1:=diff(y(x), x, x)+beta*y(x) = 0, y(1) = sin(1), (D(y))(1) = cos(1):
Eq2:=y=beta*e^x+sin(2*x)+x^2:

 

First 6 7 8 9 10 11 12 Page 8 of 14