Maple 18 Questions and Posts

These are Posts and Questions associated with the product, Maple 18


 

restart;

with(PDEtools):

with(plot):

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received plot

 

A1:=Matrix([[phi,(chi),conjugate(phi),conjugate(chi)],
          [chi,(phi),conjugate(chi),conjugate(phi)],
          [lambda*phi,-(lambda)*(chi),
           conjugate(lambda)*conjugate(phi),-conjugate(lambda)*conjugate(chi)],
          [lambda*chi,-(lambda)*(phi),
           conjugate(lambda)*conjugate(chi),-conjugate(lambda)*conjugate(phi)]]);

A1 := Matrix(4, 4, {(1, 1) = phi, (1, 2) = chi, (1, 3) = conjugate(phi), (1, 4) = conjugate(chi), (2, 1) = chi, (2, 2) = phi, (2, 3) = conjugate(chi), (2, 4) = conjugate(phi), (3, 1) = lambda*phi, (3, 2) = -lambda*chi, (3, 3) = conjugate(lambda)*conjugate(phi), (3, 4) = -conjugate(lambda)*conjugate(chi), (4, 1) = lambda*chi, (4, 2) = -lambda*phi, (4, 3) = conjugate(lambda)*conjugate(chi), (4, 4) = -conjugate(lambda)*conjugate(phi)})

(1)

d1 := LinearAlgebra:-Determinant(A1):

d1; length(%);

conjugate(lambda)^2*conjugate(phi)^2*chi^2-conjugate(lambda)^2*conjugate(phi)^2*phi^2-conjugate(lambda)^2*conjugate(chi)^2*chi^2+conjugate(lambda)^2*conjugate(chi)^2*phi^2+2*conjugate(lambda)*conjugate(phi)^2*chi^2*lambda+2*conjugate(lambda)*conjugate(phi)^2*lambda*phi^2-8*conjugate(lambda)*conjugate(phi)*conjugate(chi)*chi*lambda*phi+2*conjugate(lambda)*conjugate(chi)^2*chi^2*lambda+2*conjugate(lambda)*conjugate(chi)^2*lambda*phi^2+conjugate(phi)^2*chi^2*lambda^2-conjugate(phi)^2*lambda^2*phi^2-conjugate(chi)^2*chi^2*lambda^2+conjugate(chi)^2*lambda^2*phi^2

 

705

(2)

den:=simplify(d1,size); length(%);

-(-(conjugate(chi)-conjugate(phi))*(chi+phi)*conjugate(lambda)+lambda*(conjugate(chi)+conjugate(phi))*(chi-phi))*(-(conjugate(chi)+conjugate(phi))*(chi-phi)*conjugate(lambda)+lambda*(conjugate(chi)-conjugate(phi))*(chi+phi))

 

333

(3)

 

con1:=phi=exp(I*lambda*(x-t/(4*lambda^2)-w^2)):con2:=chi=exp(-I*lambda*(x-t/(4*lambda^2)-w^2)):

 

den1:=simplify(dsubs({con1,con2},den));

4*conjugate(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2-4*conjugate(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+8*conjugate(lambda)*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda+8*conjugate(lambda)*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda^2-4*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda^2-16*conjugate(lambda)*lambda

(4)

plot3d(subs(Re(lambda)=1, Im(lambda)=.2, w=1, rhs(den1)),x=-6..6, t=-6..6)

Warning, inserted missing semicolon at end of statement

 

Error, invalid input: rhs received 4*conjugate(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2-4*conjugate(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+8*conjugate(lambda)*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda+8*conjugate(lambda)*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*...

 

NULL

``

 

``


 

Download 23May(1).mw


 

``

lambda := .3:

omega := lambda+mu+xi:

alpha := 2*sqrt(lambda*mu)

.9165151390

(1)

``

B[1] := BesselI(k-1, alpha*(u-y))

BesselI(k-1, .9165151390-.9165151390*y)

(2)

B[2] := BesselI(k+1, alpha*(u-y))

BesselI(k+1, .9165151390-.9165151390*y)

(3)

``

F := evalf(Int(sum((B[1]-B[2])*exp(-omega*(u-y)), k = 1 .. infinity), y = 0 .. u))

Int(sum((BesselI(k-1., .9165151390-.9165151390*y)-1.*BesselI(k+1., .9165151390-.9165151390*y))*exp(-1.200000000+1.200000000*y), k = 1 .. infinity), y = 0. .. 1.)

(4)

``

``

``


 

Download int.mw

> den := -(-(conjugate(chi)-conjugate(phi))*(chi+phi)*conjugate(lambda)+lambda*(conjugate(chi)+conjugate(phi))*(chi-phi))*(-(conjugate(chi)+conjugate(phi))*(chi-phi)*conjugate(lambda)+lambda*(conjugate(chi)-conjugate(phi))*(chi+phi));

> phi:=exp(I*lambda*(x-t/(4*lambda^2)-w^2)):chi:=exp(-I*lambda*(x-t/(4*lambda^2)-w^2)):

> den1:=simplify(dsubs({phi,chi},den));

> dsubs({exp((1/4*I)*(4*lambda^2*w^2-4*lambda^2*x+t)/lambda), exp(-(1/4*I)*(4*lambda^2*w^2-4*lambda^2*x+t)/lambda)}, 4*conjugate(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2-4*conjugate(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+8*abs(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2+8*abs(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda^2-4*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda^2-16*abs(lambda)^2)

 

Since "cos(...)" appears in every term in last equation (except a last one), how to common it? 


 

``

restart:

with(PDEtools):

with(LinearAlgebra):

 

alias(f=f(x,t),g=g(x,t));

f, g

(1)

 

 

eq1:=diff(f,x)=-I*eta*f +I*exp(-I*t)*g;

diff(f, x) = -I*eta*f+I*exp(-I*t)*g

(2)

eq2:=diff(g,x)=-I*eta*g +I*exp(I*t)*f;

diff(g, x) = -I*eta*g+I*exp(I*t)*f

(3)

eq3:=diff(f,t)=(I*eta^2-I/2)*f +I*eta*exp(-I*t)*g;

diff(f, t) = (I*eta^2-(1/2)*I)*f+I*eta*exp(-I*t)*g

(4)

eq4:=diff(g,t)=(-I*eta^2+I/2)*g +I*eta*exp(I*t)*f;

diff(g, t) = (-I*eta^2+(1/2)*I)*g+I*eta*exp(I*t)*f

(5)

#### The solution of (2)-(5) is

eq5:=f=I*(c1*exp(A)-c2*exp(-A))*exp(-i*t/2);

f = I*(exp(A)*c1-c2*exp(-A))*exp(-(1/2)*i*t)

(6)

eq6:=g=(c2*exp(A)-c1*exp(-A))*exp(i*t/2);

g = (c2*exp(A)-c1*exp(-A))*exp((1/2)*i*t)

(7)

#### where

c1=sqrt(h-sqrt(h^2-1))/sqrt(h^2-1);c2=sqrt(h+sqrt(h^2-1))/sqrt(h^2-1);A=sqrt(h^2-1)*(x+I*h*t);

c1 = (h-(h^2-1)^(1/2))^(1/2)/(h^2-1)^(1/2)

 

c2 = (h+(h^2-1)^(1/2))^(1/2)/(h^2-1)^(1/2)

 

A = (h^2-1)^(1/2)*(x+I*h*t)

(8)

#### How to verify (6) and (7) is the solution of (2)-(5)?

``


 

Download verification.mw

Dear all

I want if possible to solve the inequation   f(x,y)>0 using maple

positive_function.mw

Thanks for any help

 

Dear maple users,

Greetings.

How to plot this function equation "An" for x=0.0001..1,0.02 with 0..1 range.

Wating for replay.

restart;
A2 := 1.107444364; A4 := 1.124502164; ad := .5; ed := 0.1e-1; pd := 21; ld := .3;
f := unapply(3*x^2-2*x^3-1.238616691*x^2*(x-1)^2-.7382714588*x^2*(x-1)^3+.1921034396*x^2*(x-1)^4+.5253305667*x^2*(x-1)^5+.7364291997*x^2*(x-1)^6+1.032724351*x^2*(x-1)^7+.8058204155*x^2*(x-1)^8+.3290860035*x^2*(x-1)^9, x);
t := unapply(.339997432+1.547096375*x^2-2.488736512*x^3+8.154594212*x^4-15.63643668*x^5+15.85832377*x^6-8.734300202*x^7+1.959461605*x^8, x);
b1 := f(x);
b2 := diff(f(x), x);
b3 := diff(f(x), x, x);
b4 := t(x);
b5 := diff(t(x), x);
An := A4*(1+(4/3)*ad)*(b5^2+b4^2/ld^2)+4*ed*pd*(b2^2/x^2+b1^2/x^4-b1*b2/x^3)/ld;
As := seq(An, x = 0.1e-2 .. 1, 0.5e-1);
L := [seq([x, As], x = 0.1e-2 .. 1, 0.5e-1)];

with(plots);
plots:-display(plot(L, style = point), plot(As, x = 0.1e-2 .. 1), color = blue, linestyle = solid, labels = ["η", "f'"], thickness = 1, labeldirections = [horizontal, vertical], labelfont = ['TIMES', 'BOLDOBLIQUE', 16], size = [450, 450], axes = box);
mp.mw
 

restart

A2 := 1.107444364:

f := unapply(3*x^2-2*x^3-1.238616691*x^2*(x-1)^2-.7382714588*x^2*(x-1)^3+.1921034396*x^2*(x-1)^4+.5253305667*x^2*(x-1)^5+.7364291997*x^2*(x-1)^6+1.032724351*x^2*(x-1)^7+.8058204155*x^2*(x-1)^8+.3290860035*x^2*(x-1)^9, x):

t := unapply(.339997432+1.547096375*x^2-2.488736512*x^3+8.154594212*x^4-15.63643668*x^5+15.85832377*x^6-8.734300202*x^7+1.959461605*x^8, x):

b1 := f(x):

b2 := diff(f(x), x):

b3 := diff(f(x), x, x):

b4 := t(x):

b5 := diff(t(x), x):

An := A4*(1+(4/3)*ad)*(b5^2+b4^2/ld^2)+4*ed*pd*(b2^2/x^2+b1^2/x^4-b1*b2/x^3)/ld:

As := seq(An, x = 0.1e-2 .. 1, 0.5e-1):

L := [seq([x, As], x = 0.1e-2 .. 1, 0.5e-1)]:

``

with(plots):

plots:-display(plot(L, style = point), plot(As, x = 0.1e-2 .. 1), color = blue, linestyle = solid, labels = ["η", "f'"], thickness = 1, labeldirections = [horizontal, vertical], labelfont = ['TIMES', 'BOLDOBLIQUE', 16], size = [450, 450], axes = box)

Error, (in plot) found points with fewer or more than 2 components

 

``


 

Download mp.mw

 

Hi everyone, I have problem solving a given optimization problem using the Karush Khun Tucke conditions. The working is as follows:

restart;
with(linalg);
f := 49*x[1]+94*x[2]+90*x[3]+24*x[4]+6*x[5]+63*x[6]+17*x[7]+65*x[8]+72*x[9]+40*x[10]+67*x[11]+99*x[12]+97*x[13]+53*x[14]+22*x[15]+47*x[16]+60*x[17]+36*x[18]+54*x[19]+67*x[20]+46*x[21]+55*x[22]+42*x[23]+70*x[24];
49 x[1] + 94 x[2] + 90 x[3] + 24 x[4] + 6 x[5] + 63 x[6]

   + 17 x[7] + 65 x[8] + 72 x[9] + 40 x[10] + 67 x[11] + 99 x[12]

   + 97 x[13] + 53 x[14] + 22 x[15] + 47 x[16] + 60 x[17]

   + 36 x[18] + 54 x[19] + 67 x[20] + 46 x[21] + 55 x[22]

   + 42 x[23] + 70 x[24]
g[1] := x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+x[8]+x[9]+x[10]+x[11]+x[12]-475;
  x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9]

     + x[10] + x[11] + x[12] - 475
g[2] := x[13]+x[14]+x[15]+x[16]+x[17]+x[18]+x[19]+x[20]+x[21]+x[22]+x[23]+x[24]-30;
 x[13] + x[14] + x[15] + x[16] + x[17] + x[18] + x[19] + x[20]

    + x[21] + x[22] + x[23] + x[24] - 30
for i from 3 to 26 do g[i] := -x[i] end do;
h[1] := 54-x[1];
                           54 - x[1]
h[2] := 30-x[2];
                           13 - x[2]
h[3] := 13-x[3];
                           13 - x[3]
h[4] := 41-x[4];
                           41 - x[4]
h[5] := 97-x[5];
                           97 - x[5]
h[6] := 11-x[6];
                           11 - x[6]
h[7] := 62-x[7];
                           62 - x[7]
h[8] := 59-x[8];
                           59 - x[8]
h[9] := 35-x[9];
                           35 - x[9]
h[10] := 42-x[10];
                           42 - x[10]
h[11] := 19-x[11];
                           19 - x[11]
h[12] := 12-x[12];
                           12 - x[12]
vars := [x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24]];
[x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], 

  x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], 

  x[20], x[21], x[22], x[23], x[24]]
H := Hessian(f, vars);
Hessian(49 x[1] + 94 x[2] + 90 x[3] + 24 x[4] + 6 x[5] + 63 x[6]

   + 17 x[7] + 65 x[8] + 72 x[9] + 40 x[10] + 67 x[11] + 99 x[12]

   + 97 x[13] + 53 x[14] + 22 x[15] + 47 x[16] + 60 x[17]

   + 36 x[18] + 54 x[19] + 67 x[20] + 46 x[21] + 55 x[22]

   + 42 x[23] + 70 x[24], [x[1], x[2], x[3], x[4], x[5], x[6], 

  x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], 

  x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24]])
grad_f := Del(f, vars);
Del(49 x[1] + 94 x[2] + 90 x[3] + 24 x[4] + 6 x[5] + 63 x[6]

   + 17 x[7] + 65 x[8] + 72 x[9] + 40 x[10] + 67 x[11] + 99 x[12]

   + 97 x[13] + 53 x[14] + 22 x[15] + 47 x[16] + 60 x[17]

   + 36 x[18] + 54 x[19] + 67 x[20] + 46 x[21] + 55 x[22]

   + 42 x[23] + 70 x[24], [x[1], x[2], x[3], x[4], x[5], x[6], 

  x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], 

  x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24]])
for i to 26 do grad_g[i] := Del(g[i], vars) end do;
for i to 12 do grad_h[i] := Del(h[i], vars) end do;
eq[1] := grad_f+sum(mu[i]*g[i], i = 13 .. 26)+sum(lambda[i]*h[j], j = 1 .. 12) = 0;
Error, (in sum) summation variable previously assigned, second argument evaluates to 13 = 13 .. 37
eq[2] := g[i] <= 0;
                          -x[13] <= 0
eq[3] := h[j] <= 0;
                           h[j] <= 0
eq[4] := mu[i] >= 0;
                          0 <= mu[13]
eq[5] := lambda[j] <= 0;
                         lambda[j] <= 0
eq[6] := mu[i]*g[i] = 0;
                       -mu[13] x[13] = 0
eval(solve({eq[1], eq[2], eq[3], eq[4], eq[5], eq[6]}, [vars, lambda[j], mu[i]]));
Error, invalid input: too many and/or wrong type of arguments passed to solve; first unused argument is [[x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24]], lambda[j], mu[13]]
 


 

restart

sigma[1] := 0.1e-5;

0.1e-5

 

3.0

 

1.1

 

0.1e-1

 

0.1e-5

 

4.0

 

0.1e-1

 

.12

 

.2

 

0.2e-1

(1)

"(&PartialD;)/(&PartialD; t) C(t, x)=`sigma__1`*((&DifferentialD;)^2)/((&DifferentialD;)^( )x^2) C(t, x)+alpha[1]*C(t, x)^(`k__1`)+alpha[1]*C(t, x)^(`k__2`)*B(t, x)^(`k__3`)-`beta__1`*C(t, x),  (&PartialD;)/(&PartialD; t) B(t, x)=`sigma__2`*((&DifferentialD;)^2)/((&DifferentialD;)^( )x^2) B(t, x)+alpha[2]*B(t, x)^(`k__3`)+alpha[2]*C(t, x)^(`k__2`)*B(t, x)^(`k__4`)-`beta__2`*B(t, x),    #`with boundary conditions`  (&PartialD;)/(&PartialD; x) C(t, 0)=0,(&PartialD;)/(&PartialD; x) C(t, 1)=0,  (&PartialD;)/(&PartialD; x) B(t, 0)=0,(&PartialD;)/(&PartialD; x) B(t, 1)=0,    #`and initial conditions`   C(0, x) = `C__o`(x) ,  B(0, x)=B[o](x), #`In this model C(0) = 13.0 and B(0) = 300 `    #`I need the numerical solutions of C and B`  #`variations of parameters like sigma`[1], sigma[2, ]beta[1], beta[2]  #thanks    "


 

Download pde_solve.mw

Dear maple users,
Greetings.
Now I'm working on a project "solving ODE with an analytical solution".

So, I need how to find a residual error. 

Here I used the Homotopy Analysis Method(HAM) to solve the ode problem.

A similar HAM problem has solved using the Mathematica BVP2.H package.

Here I have encoded a maple code for my working problem. HAM.mw

CODE:Note(N is order of ittrration)

restart; with(plots)

pr := .5; ec := .5; N := 7; re := 2; ta := .5; H := 1:

dsolve(diff(f(x), `$`(x, 4)))

Rf := x^3*(diff(f[m-1](x), x, x, x, x))-2*x^2*(diff(f[m-1](x), x, x, x))+3*x*(diff(f[m-1](x), x, x))-3*(diff(f[m-1](x), x))-re*x^2*R*(sum((diff(f[m-1-n](x), x, x, x))*(diff(f[n](x), x)), n = 0 .. m-1))-re*x*R*(sum((diff(f[m-1-n](x), x))*(diff(f[n](x), x)), n = 0 .. m-1))+re*x^2*R*(sum((diff(f[m-1-n](x), x, x, x))*f[n](x), n = 0 .. m-1))-3*re*x*R*(sum((diff(f[m-1-n](x), x, x))*f[n](x), n = 0 .. m-1))+3*re*R*(sum((diff(f[m-1-n](x), x))*f[n](x), n = 0 .. m-1))+ta*x^3*(diff(f[m-1](x), x, x))-ta*x^2*(diff(f[m-1](x), x)):

dsolve(diff(f[m](x), x, x, x, x)-CHI[m]*(diff(f[m-1](x), x, x, x, x)) = h*H*Rf, f[m](x)):

f[0](x):=3 *x^(2)-2* x^(3);

for m from 1 by 1 to N do  CHI[m]:=`if`(m>1,1,0);  f[m](x):=int(int(int(int(CHI[m]*(x^(3)* diff(f[m-1](x),x,x,x,x))+h*H*(x^(3)* diff(f[m-1](x),x,x,x,x))-2*h*H*x^(2)*diff(f[m-1](x),x,x,x)+3*h*H*x*diff(f[m-1](x),x,x)-3*h*H*diff(f[m-1](x),x)-re*h*H*x^(2)*sum(diff(f[m-1-n](x),x,x,x)*diff(f[n](x),x),n=0..m-1)-re*h*H*x*sum(diff(f[m-1-n](x),x)*diff(f[n](x),x),n=0..m-1)+re*h*H*x^(2)*sum(diff(f[m-1-n](x),x,x,x)*(f[n](x)),n=0..m-1)-3*re*x*h*H*sum(diff(f[m-1-n](x),x,x)*(f[n](x)),n=0..m-1)+3* re*h*H*sum(diff(f[m-1-n](x),x)*(f[n](x)),n=0..m-1)+ta*x^(3)*h*H*diff(f[m-1](x),x,x)-ta*x^(2)*h*H*diff(f[m-1](x),x),x),x)+_C1*x,x)+_C2*x,x)+_C3*x+_C4;  s1:=evalf(subs(x=0,f[m](x)))=0;  s2:=evalf(subs(x=0,diff(f[m](x),x)))=0;  s3:=evalf(subs(x=1,f[m](x)))=0;  s4:=evalf(subs(x=1,diff(f[m](x),x)))=0;   s:={s1,s2,s3,s4}:  f[m](x):=simplify(subs(solve(s,{_C1,_C2,_C3,_C4}),f[m](x)));  end do:

f(x):=sum(f[l](x),l=0..N):  hh:=evalf(subs(x=1,diff(f(x),x)));

plot(hh, h = -5 .. 5);

 

For Mathematica, code already exist to find a residual error for another problem(Not this) 

which is,

eq:

Bc:

Mathematica code:

waiting for users' responses.

Have a good day

Dear all

I need to display a matrix K defined in the attached maple code.

Thanks for your help

matrix.mw

Dear maple users,
Greetings.
How to plot residual error for BVP.
Here I have enclosed the file.rerror.mw
 

restart; with(plots)

fcns := {f(eta), g(eta)}:

bet := 0.:

eq1 := diff(f(eta), `$`(eta, 3))+(diff(f(eta), `$`(eta, 2)))*f(eta)+be*((diff(g(eta), `$`(eta, 1)))^2-(diff(g(eta), `$`(eta, 2)))*g(eta)) = 0:

eq2 := pr*lam*(diff(g(eta), `$`(eta, 3)))+(diff(g(eta), `$`(eta, 2)))*f(eta)-(diff(f(eta), `$`(eta, 2)))*g(eta) = 0:

bc := f(0) = 0, (D(f))(0) = 0, (D(f))(N) = 1, g(0) = 0, ((D@@2)(g))(0) = 0, (D(g))(N) = 1;

f(0) = 0, (D(f))(0) = 0, (D(f))(5) = 1, g(0) = 0, ((D@@2)(g))(0) = 0, (D(g))(5) = 1

(1)

R := dsolve(eval({bc, eq1, eq2}), fcns, type = numeric, method = bvp[midrich], output = listprocedure):

Sol_exact := dsolve(eval({bc, eq1, eq2}), fcns):

``


 

Download rerror.mw

Have a good day

 

Dear all

I need your help to compute the discrete convolution product. Is there a simple way in maple that hep me to compute the coefficient of the matrix g 

thanks

convolution.mw

 

 

restart;
solve({l*(2*l^2*lambda^4*sigma*w*a[2]+l^2*lambda^2*mu*w*b[1]+6*l*lambda^2*m*sigma*a[0]^2-6*l*lambda^2*m*b[1]^2+6*l*m*mu^2*a[0]^2-l*lambda^2*rho*sigma*a[0]-l*mu^2*rho*a[0]+4*lambda^2*sigma*w*a[0]+4*mu^2*w*a[0]) = 0, l*(2*l^2*lambda^3*sigma*w*a[1]+6*l^2*lambda^2*mu*w*b[2]+2*l^2*lambda*mu^2*w*a[1]+12*l*lambda^2*m*sigma*a[0]*a[1]-12*l*lambda^2*m*b[1]*b[2]-l*lambda^2*rho*sigma*a[1]+12*l*m*mu^2*a[0]*a[1]-l*mu^2*rho*a[1]+4*lambda^2*sigma*w*a[1]+4*mu^2*w*a[1]) = 0, l*(5*l^2*lambda^3*sigma*w*b[2]-3*l^2*lambda^2*mu*sigma*w*a[1]-7*l^2*lambda*mu^2*w*b[2]-3*l^2*mu^3*w*a[1]+12*l*lambda^2*m*sigma*a[0]*b[2]+12*l*lambda^2*m*sigma*a[1]*b[1]-l*lambda^2*rho*sigma*b[2]+24*l*lambda*m*mu*b[1]*b[2]+12*l*m*mu^2*a[0]*b[2]+12*l*m*mu^2*a[1]*b[1]-l*mu^2*rho*b[2]+4*lambda^2*sigma*w*b[2]+4*mu^2*w*b[2]) = 0, l*(8*l^2*lambda^3*sigma*w*a[2]+6*l^2*lambda*mu^2*w*a[2]+12*l*lambda^2*m*sigma*a[0]*a[2]+6*l*lambda^2*m*sigma*a[1]^2+l^2*lambda*mu*w*b[1]-6*l*lambda^2*m*b[2]^2-l*lambda^2*rho*sigma*a[2]+12*l*m*mu^2*a[0]*a[2]+6*l*m*mu^2*a[1]^2-6*l*lambda*m*b[1]^2-l*mu^2*rho*a[2]+4*lambda^2*sigma*w*a[2]+4*mu^2*w*a[2]) = 0, -l*(4*l^2*lambda^3*mu*sigma*w*a[2]-l^2*lambda^3*sigma*w*b[1]+l^2*lambda*mu^2*w*b[1]-12*l*lambda^2*m*sigma*a[0]*b[1]+l*lambda^2*rho*sigma*b[1]-12*l*lambda*m*mu*b[1]^2-12*l*m*mu^2*a[0]*b[1]+l*mu^2*rho*b[1]-4*lambda^2*sigma*w*b[1]-4*mu^2*w*b[1]) = 0, 6*l^2*(l*lambda^2*sigma*w*a[2]+lambda^2*m*sigma*a[2]^2+l*mu^2*w*a[2]+m*mu^2*a[2]^2-lambda*m*b[2]^2) = 0, 2*l^2*(l*lambda^2*sigma*w*a[1]+6*lambda^2*m*sigma*a[1]*a[2]+3*l*lambda*mu*w*b[2]+l*mu^2*w*a[1]+6*m*mu^2*a[1]*a[2]-6*lambda*m*b[1]*b[2]) = 0, -2*l^2*(5*l*lambda^2*mu*sigma*w*a[2]-l*lambda^2*sigma*w*b[1]+5*l*mu^3*w*a[2]-6*lambda^2*m*sigma*a[1]*b[2]-6*lambda^2*m*sigma*a[2]*b[1]-l*mu^2*w*b[1]-6*lambda*m*mu*b[2]^2-6*m*mu^2*a[1]*b[2]-6*m*mu^2*a[2]*b[1]) = 0, 6*l^2*b[2]*(l*w+2*m*a[2]) = 0}, {a[0], a[1], a[2], b[1], b[2]});
Warning, solutions may have been lost
{a[0] = 0, a[1] = 0, a[2] = 0, b[1] = 0, b[2] = 0}, 

   /       l rho - 4 w                                        \ 
  { a[0] = -----------, a[1] = 0, a[2] = 0, b[1] = 0, b[2] = 0 }
   \          6 l m                                           / 
 

Dear friends, please I would like to ask for your help with the following situation: 

Suppose I have an Array   A:=Array([4]);   and I have to take the element A[i], add 1 to it and then append it to A, with i = 1..3. The result would be, 

A:= [4 5 6 7] 

I do know how to perform the task with a for loop, however I know that for large i it is more advisable to use seq for speed reasons.   I cannot find the right syntax to perform such a task with seq. Could you please advise me how to do so? 

Many thanks for your help. 

Dear all

I have data and a vector d. 
I would like to sum the elements of the vector d corresponding to the index  of the element data <=0.01 

Step 1: we select the index of data that corresponds to data<=0.01

step 2: we select the consecutive index corresponding to data<=0.01

Step 3 : we sum the element of d corresponding to the previous index

step 4: update d=d/number(index) ;

Please see my attached code. It's done by hand how can reformulate the code.

 

 

code_vector.mw

many thanks

 

First 14 15 16 17 18 19 20 Last Page 16 of 83