## Why Maple is not plotting the solution?...

 > restart;
 > with(PDEtools):
 > with(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)]]);
 (1)
 > d1 := LinearAlgebra:-Determinant(A1):
 > d1; length(%);
 (2)
 > den:=simplify(d1,size); length(%);
 (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)
 > plot3d(subs(Re(lambda)=1, Im(lambda)=.2, w=1, rhs(den1)),x=-6..6, t=-6..6)
 >
 >

 >
 >
 >
 (1)
 >
 >
 (2)
 >
 (3)
 >
 >
 (4)
 >
 >

## How to common a factor appears in many terms in th...

> 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?

## How to verify the solution of PDEs?...

 > restart:
 > with(PDEtools):
 > with(LinearAlgebra):
 >
 > alias(f=f(x,t),g=g(x,t));
 (1)
 >
 >
 > eq1:=diff(f,x)=-I*eta*f +I*exp(-I*t)*g;
 (2)
 > eq2:=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;
 (4)
 > eq4:=diff(g,t)=(-I*eta^2+I/2)*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);
 (6)
 > eq6:=g=(c2*exp(A)-c1*exp(-A))*exp(i*t/2);
 (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);
 (8)
 > #### How to verify (6) and (7) is the solution of (2)-(5)?

## Find domain to get positive function ...

Dear all

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

positive_function.mw

Thanks for any help

## How to plot this functions...

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);
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 = ["&eta;", "f'"], thickness = 1, labeldirections = [horizontal, vertical], labelfont = ['TIMES', 'BOLDOBLIQUE', 16], size = [450, 450], axes = box);
mp.mw

 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >

## Solving Optimization problem using the Karush Khun...

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

 >
 >
 (1)
 >

## solving ODE with analytical solution...

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

## matrix defined using an exponential ...

Dear all

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

matrix.mw

## How to plot residual error...

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

 >
 >
 >
 >
 >
 >
 (1)
 >
 >
 >

Have a good day

## convoluation discrete two dimensional funciton ...

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

## fix the problem to solve polynomial...

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                                           /

## Problem with the application of seq command...

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?

## sum of element of a given vector ...

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
﻿