Question: How to find the minimum value of the real part of a complex function

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

Please Wait...