Maple 18 Questions and Posts

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

restart;
H := a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]));
I*(diff(H, z))+diff(H, x, x)+diff(H, t, t)+R*(H+conjugate(H))+R^2*(H+conjugate(H))*H;
value(%);
simplify(%);

restart;

H := a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]));

a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))

I*(diff(H, z))+diff(H, x, x)+diff(H, t, t)+R*(H+conjugate(H))+R^2*(H+conjugate(H))*H;

I*(I*a__1*k[1]*exp(I*(-Omega*t+k*x+z*k[1]))-I*a__2*k[1]*exp(-I*(-Omega*t+k*x+z*k[1])))-a__1*k^2*exp(I*(-Omega*t+k*x+z*k[1]))-a__2*k^2*exp(-I*(-Omega*t+k*x+z*k[1]))-a__1*Omega^2*exp(I*(-Omega*t+k*x+z*k[1]))-a__2*Omega^2*exp(-I*(-Omega*t+k*x+z*k[1]))+R*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))+conjugate(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))))+R^2*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))+conjugate(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))))*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1])))

value(%);

I*(I*a__1*k[1]*exp(I*(-Omega*t+k*x+z*k[1]))-I*a__2*k[1]*exp(-I*(-Omega*t+k*x+z*k[1])))-a__1*k^2*exp(I*(-Omega*t+k*x+z*k[1]))-a__2*k^2*exp(-I*(-Omega*t+k*x+z*k[1]))-a__1*Omega^2*exp(I*(-Omega*t+k*x+z*k[1]))-a__2*Omega^2*exp(-I*(-Omega*t+k*x+z*k[1]))+R*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))+conjugate(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))))+R^2*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))+conjugate(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))))*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1])))

simplify(%);

a__1^2*exp(-(2*I)*(Omega*t-k*x-z*k[1]))*R^2+2*a__1*a__2*R^2+a__2^2*exp((2*I)*(Omega*t-k*x-z*k[1]))*R^2-exp(-I*(Omega*t-k*x-z*k[1]))*a__1*k[1]+a__2*k[1]*exp(I*(Omega*t-k*x-z*k[1]))+a__1*exp(-I*(Omega*t-k*x-z*k[1]))*conjugate(a__1*exp(-I*(Omega*t-k*x-z*k[1]))+a__2*exp(I*(Omega*t-k*x-z*k[1])))*R^2+a__2*exp(I*(Omega*t-k*x-z*k[1]))*conjugate(a__1*exp(-I*(Omega*t-k*x-z*k[1]))+a__2*exp(I*(Omega*t-k*x-z*k[1])))*R^2-a__1*Omega^2*exp(-I*(Omega*t-k*x-z*k[1]))-a__1*k^2*exp(-I*(Omega*t-k*x-z*k[1]))-a__2*Omega^2*exp(I*(Omega*t-k*x-z*k[1]))-a__2*k^2*exp(I*(Omega*t-k*x-z*k[1]))+R*a__1*exp(-I*(Omega*t-k*x-z*k[1]))+R*a__2*exp(I*(Omega*t-k*x-z*k[1]))+R*conjugate(a__1*exp(-I*(Omega*t-k*x-z*k[1]))+a__2*exp(I*(Omega*t-k*x-z*k[1])))

 

Download m18bs.mw

Please, how do I find the minimum of the real part of a complex function? I tried min ( ) function it didn't work. 

Find attached the fileFinding_min_zero.mw
 

Import packages

 

restart: with(ArrayTools): with(Student:-Calculus1): with(LinearAlgebra): with(ListTools):with(RootFinding):with(ListTools):

Parameters

 

gamma1 := .1093:
alpha3 := -0.1104e-2:
k[1] := 6*10^(-12):
d:= 0.2e-3:
xi:= -0.01:
theta0:= 0.1e-3:
eta[1]:= 0.240e-1:
alpha:= 1-alpha3^2/(gamma1*eta[1]):
c:= alpha3*xi*alpha/(eta[1]*(4*k[1]*q^2/d^2-alpha3*xi/eta[1])):
theta_init:= theta0*sin(Pi*z/d):
n:= 10:

``

``

Assign g for q and plot g

 

g := q-(1-alpha)*tan(q)-c*tan(q):
plot(g, q = 0 .. 3*Pi, view = [DEFAULT, -30.. 10]);

 

Set q as a complex

 

Assume q = x+I*y and subsitute the result into g and equate the real and complex part to zero, and solve for x and y.

f := subs(q = x+I*y, g):
b1 := evalc(Re(f)) = 0:
b2 := evalc(Im(f)) = 0:

Compute the Special Asymptotes

 

This asymptote is coming from the c from the definition of "q."

``

qstar := (fsolve(1/c = 0, q = 0 .. infinity)):NULLNULL``

``

``

Compute Odd asymptote

 

First, Since tan*q = sin*q*(1/(cos*q)), then an asymptote occurs at cos*q = 0. In general, we have
"q= ((2 k+1)Pi)/(2). "
Next, we compute the entry of the Oddasymptotes that is close to qstar (special asymptote) as assign it to
ModifiedOaddAsym, and then find the minimum of the ModifiedOaddAsym. Searchall Function returns

the index of an entry in a list.

OddAsymptotes := Vector[row]([seq(evalf((1/2*(2*j+1))*Pi), j = 0 .. n)]);
ModifiedOddAsym := abs(`~`[`-`](OddAsymptotes, qstar));
qstarTemporary := min(ModifiedOddAsym);
indexOfqstar2 := SearchAll(qstarTemporary, ModifiedOddAsym);
qstar2 := OddAsymptotes(indexOfqstar2);

OddAsymptotes := Vector(4, {(1) = ` 1 .. 11 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

ModifiedOddAsym := Vector(4, {(1) = ` 1 .. 11 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

.6952012913

 

1

 

1.570796327

(4.2.1)

Compute x and y

 

Here, we solve for xand y within the min. and max. of qstar2 and qstar, and substitute the results into q.

AreThereComplexRoots := type(true, 'truefalse');
try
   soln1:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = 0 .. infinity});
   soln2:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = -infinity .. 0});
   qcomplex1 := subs(soln1, x+I*y);
   qcomplex2 := subs(soln2, x+I*y);
catch:
   AreThereComplexRoots := type(FAIL, 'truefalse');
end try;

 

true

 

{x = 1.348928550, y = .3589396337}

 

{x = 1.348928550, y = -.3589396337}

 

1.348928550+.3589396337*I

 

1.348928550-.3589396337*I

(4.3.1)

Compute the rest of the Roots

 

In this section we compute the roots between each asymptotes.

OddAsymptotes := Vector[row]([seq(evalf((1/2)*(2*j+1)*Pi), j = 0 .. n)]);
AllAsymptotes := sort(Vector[row]([OddAsymptotes, qstar]));
if AreThereComplexRoots then
gg := [qcomplex1, qcomplex2, op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)];
elif not AreThereComplexRoots then
gg := [op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)];
end if:

OddAsymptotes := Vector(4, {(1) = ` 1 .. 11 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

AllAsymptotes := Vector(4, {(1) = ` 1 .. 12 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(4.4.1)

``

Remove the repeated roots if any

 

qq := MakeUnique(gg):

``

Redefine n

 

m := numelems(qq):

``

Compute the `τ_n`time constants

 

for i to m do
p[i] := gamma1*alpha/(4*k[1]*qq[i]^2/d^2-alpha3*xi/eta[1]);
end do;

93.91209918-98.41042341*I

 

93.91209918+98.41042341*I

 

8.521555786

 

2.990232721

 

1.515805379

 

.9145981009

 

.6114591994

 

.4374663448

 

.3284338129

 

.2556221851

 

.2045951722

(4.7.1)

``

Minimum of the Re(`τ_n`)

 

for i to m do
p[i] := min(Re(gamma1*alpha/(4*k[1]*qq[i]^2/d^2-alpha3*xi/eta[1])));
end do;

93.91209918

 

93.91209918

 

8.521555786

 

2.990232721

 

1.515805379

 

.9145981009

 

.6114591994

 

.4374663448

 

.3284338129

 

.2556221851

 

.2045951722

(4.7.1.1)

## I expected 0.20459 but return all the entries in the list.

``

Download Finding_min_zero.mw

I try to simplify the expression by putting exponential function into equation but the maple shows error which I can't fix it.simplification.mw

I am trying to find the solution (\Psi) as approaches zero. However, after applying the limit the solution becomes zero. See the attached .mw file.limit.mw

I have tried a code in python for Francis QR algorithm but didn't desire the result. I don't know if it is possible to code in maple.

Given that A^0 = [[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]].

1. Write a little program that computes 1 step of Francis QR and test your program by starting from

A^0 = [[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]]  and compute A^1, A^2 ...A^6.

I expected to get:

A^0 = [[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]], 

A^1 = [[3.5,  -4.264, 0.2688], [-9.206, 1.577, 9.197], [0., -1.41, 1.923]], 

... A^6 = [[8.056,  1.596, 8.584], [0.3596, -2.01, -7.86], [0., 2.576*10^(-16), 0.9542]]. 

But didn't get the same results.

Here is my python code:

# Import packages
import numpy as np
from numpy.linalg import qr # QR from Linear Algebra Library
import scipy.linalg   # SciPy Linear Algebra Library
 

A = np.array([[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]])
p = [1, 2, 3, 4, 5, 6]
for i in range(30):
    q, r = qr(A)
    a = np.dot(r, q)
    if i+1 in p:
        print("Iteration {i+1}")
        print(A)

I would really appreciate your help.

Thank you.

Please, how can I find all the roots  of: (H/(Hc))^2 -(4*q^2)/Pi^2*((tan(q)- q/(1-alpha))/(tan(q)-q)) with q=(i-1)*Pi+Pi/2..i*Pi+Pi/2 for n=20.

See my attempt below:

restart:with(RootFinding):
a[1] := .1093; k[3] := 7.5*10^(-12); k[2] := 3.8*10^(-12); d := 0.2e-3; eta[1] := 0.240e-1; alpha[2] := -.1104; alpha[3] := -0.1104e-2; eta[2] := .1361; xi := 1.219*10^(-6); alpha := 1-alpha[3]^2/(a[1]*eta[1]); theta[0] := 0.5e-1;
Hc := (Pi/d)*sqrt(k[2]/xi):

H := 5.5*Hc;
lambda := a[1]/(xi*H^2);

RootFinding:-NextZero(proc (q) options operator, arrow; (H/(Hc))^2 -(4*q^2)/Pi^2*((tan(q)- q/(1-alpha))/(tan(q)-q)) end proc, 0);

for j to 9 do RootFinding:-NextZero(proc (q) options operator, arrow; H^2/Hc^2-4*q^2*(tan(q)-q/(1-alpha))/(Pi^2*(tan(q)-q)) end proc, %) end do;

Error, invalid input: RootFinding:-NextZero expects its 2nd argument, zz, to be of type numeric, but received FAIL

hallo every body 

please how i do find a real roots for this equation system 

roots.mw

Please see the attached file; I'm attempting to do some calculations with the 'PDETools' package; notice the first term in equation (4), where sqrt(x2+y2) is not canceling in the fraction, despite using the 'simplify' command; why is this happening, and how can I achieve complete simplification?

Ques_Mapleprime.mw

with(PDEtools):

DepVars := [u(x, y, t), U(xi, eta)]; 1; alias(u = u(x, y, t))

[u(x, y, t), U(xi, eta)]

 

u

(1)

xi[1] := 1/2*(x^2+y^2); 1; xi[2] := t; 1; u := (h(t)+(x^2+y^2)*(1/2))*arccos(x/sqrt(x^2+y^2))/t+U(xi[1], xi[2])

(1/2)*x^2+(1/2)*y^2

 

t

 

(h(t)+(1/2)*x^2+(1/2)*y^2)*arccos(x/(x^2+y^2)^(1/2))/t+U((1/2)*x^2+(1/2)*y^2, t)

(2)

(diff(u, x))*(diff(u, y))

(x*arccos(x/(x^2+y^2)^(1/2))/t-(h(t)+(1/2)*x^2+(1/2)*y^2)*(1/(x^2+y^2)^(1/2)-x^2/(x^2+y^2)^(3/2))/((1-x^2/(x^2+y^2))^(1/2)*t)+(D[1](U))((1/2)*x^2+(1/2)*y^2, t)*x)*(y*arccos(x/(x^2+y^2)^(1/2))/t+(h(t)+(1/2)*x^2+(1/2)*y^2)*x*y/((x^2+y^2)^(3/2)*(1-x^2/(x^2+y^2))^(1/2)*t)+(D[1](U))((1/2)*x^2+(1/2)*y^2, t)*y)

(3)

collect(simplify(subs(1/2*(x^2+y^2) = xi, t = eta, (x*arccos(x/(x^2+y^2)^(1/2))/t-(h(t)+(1/2)*x^2+(1/2)*y^2)*(1/(x^2+y^2)^(1/2)-x^2/(x^2+y^2)^(3/2))/((1-x^2/(x^2+y^2))^(1/2)*t)+(D[1](U))((1/2)*x^2+(1/2)*y^2, t)*x)*(y*arccos(x/(x^2+y^2)^(1/2))/t+(h(t)+(1/2)*x^2+(1/2)*y^2)*x*y/((x^2+y^2)^(3/2)*(1-x^2/(x^2+y^2))^(1/2)*t)+(D[1](U))((1/2)*x^2+(1/2)*y^2, t)*y))), D, 'distributed')

(1/4)*(2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*x^3+2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*x*y^2)*(2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*x^2+2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*y^2)*(D[1](U))(xi, eta)^2/(y*(x^2+y^2)^2*eta^2)+(1/4)*((2*arccos(x/(x^2+y^2)^(1/2))*x^3*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)+2*arccos(x/(x^2+y^2)^(1/2))*x*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)*y^2-x^2*y^2-y^4-2*h(eta)*y^2)*(2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*x^2+2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*y^2)+(2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*x^3+2*(y^2/(x^2+y^2))^(1/2)*(x^2+y^2)^(1/2)*eta*x*y^2)*(2*arccos(x/(x^2+y^2)^(1/2))*x^2*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)+2*arccos(x/(x^2+y^2)^(1/2))*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)*y^2+x^3+x*y^2+2*h(eta)*x))*(D[1](U))(xi, eta)/(y*(x^2+y^2)^2*eta^2)+(1/4)*(2*arccos(x/(x^2+y^2)^(1/2))*x^3*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)+2*arccos(x/(x^2+y^2)^(1/2))*x*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)*y^2-x^2*y^2-y^4-2*h(eta)*y^2)*(2*arccos(x/(x^2+y^2)^(1/2))*x^2*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)+2*arccos(x/(x^2+y^2)^(1/2))*(x^2+y^2)^(1/2)*(y^2/(x^2+y^2))^(1/2)*y^2+x^3+x*y^2+2*h(eta)*x)/(y*(x^2+y^2)^2*eta^2)

(4)

``

Download Ques_Mapleprime.mw

Consider matrices A and B below; how one can plot basis vectors of column space in 2d, and plane or line spanned by basis of row space in 3D?

with(LinearAlgebra):
A := Matrix([[2, 3, 5], [1, 2, 7]]);

ColumnSpace(A);
RowSpace(A);
 
B := Matrix([[6, 4, 2], [3, 2, 1]]);
 
ColumnSpace(B);
RowSpace(B);
 

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convODEPlot.mwODEPlot.mwert/ODEPlot.mw .

Hey everyone!

I have a complex function stored in a file (Comp-func.txt). The function is continues everywhere on the real axis (X-axis.txt). However, its log shows a jump somewhere close to x=-1.5. I would like to understand how Maple interprets this "jump" and how to avoid such numerical artifact.

thank you.

 Comp-func.txt

Jump-Log-Func.mw

X-axis.txt

Hi guys,

I can not solve this integral with maple ! I really appreciate if someone can help me! Mathematical gives a solution in terms of hypergeometric function! 

p^2 , m, \epsilon, D > 0 and i is imaginary number 

Thanks 111.mw

I was computing an integral (Running Maple 18 on Windows 10):

The classic lenght of arc Integral of sqrt(1+(dy/dx)^2) dx

In this case, the function was a cartesian circle (x-R)^2+y^2=R^2 isolated as y=sqrt(R^2-(x-R)^2)

When I do the integration, the result of the integral is not correct.
But if I change R for a, the result is correct. Why? This does not make any sense.

R wasn't assigned to any variable. The code was:

Good Integral

[>y:=expand(sqrt(a^2-(x-a)^2));
[>f:=expand(simplify(sqrt(1+diff(y,x)^2)));
[>S:=int(f,x)+K;

Wrong Integral

[>y:=expand(sqrt(R^2-(x-R)^2));
[>f:=expand(simplify(sqrt(1+diff(y,x)^2)));
[>S:=int(f,x)+K;

In fact, any UPPERCASE letter used as the radius gives me the wrong answer whereas any LOWERCASE letter gives me the proper result. Why is this?

Thanks and have a nice day
EDIT: I added a Screenshot

Input:

 a := x^2;
 whattype(x);
 b := x[1]^2;
 whattype(x[1]);
 CodeGeneration[C](a);
 CodeGeneration[C](b);

Output:

Do you know why cg0 =/= x[0]*x[0]?

First 9 10 11 12 13 14 15 Last Page 11 of 87