imparter

165 Reputation

8 Badges

11 years, 241 days

MaplePrimes Activity


These are questions asked by imparter

Can any one help to find the value of sigma(r,z) and theta(r,z) from the differential equations analytically, 

ODEs:= <
      diff(theta(r),r$2) = -(1/r)*diff(theta(r),r) - diff(sigma(r),r)*diff(theta(r),r)-diff(theta(r),r)^2,  
   diff(sigma(r),r$2) = -(1/r)*diff(sigma(r),r) -diff(theta(r),r$2)-(1/r)*diff(theta(r),r)>;
boundary conditions

'diff((theta),r)=0','diff((sigma),r)=0'; # at r=0
and theta=0, sigma=0; #at r=h(z) 

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

 

First 7 8 9 10 11 12 13 Page 9 of 15