## How to return y=2+0*I as y = 2...

I want to  return {x = 0., y = 1.158748796 + 0. I}  as  {x = 0., y = 1.158748796 }.  The solution is coming from:

soln3:= fsolve({b1, b2}, {x = 0 .. infinity, y = 0 .. infinity});

and the second solution is coming from:
soln4:= fsolve({b1, b2}, {x = -infinity ..0, y = -infinity .. 0});

See my code below

restart:

Procedure

doCalc:= proc( xi )

# Import Packages
uses ArrayTools, Student:-Calculus1, LinearAlgebra,
ListTools, RootFinding, plots, ListTools:
local gamma__1:= .1093,
alpha__3:= -0.1104e-2,
k__1:= 6*10^(-12),
d:= 0.2e-3,
theta0:= 0.0001,
eta__1:= 0.240e-1,
alpha:= 1-alpha__3^2/(gamma__1*eta__1),
c:= alpha__3*xi*alpha/(eta__1*(4*k__1*q^2/d^2-alpha__3*xi/eta__1)),
theta_init:= theta0*sin(Pi*z/d),
n:= 30,
g, f, b1, b2, qstar, OddAsymptotes, ModifiedOddAsym,
qstarTemporary, indexOfqstar2, qstar2, AreThereComplexRoots,
soln1, soln2, qcomplex1, qcomplex2, gg, qq, m, pp, j, i,
AllAsymptotes, p, Efun, b, aa, F, A, B, Ainv, r, theta_sol, v, Vfun, v_sol,minp,nstar,
soln3, soln4, Imagroot1, Imagroot2;

# Assign g for q and plot g, Set q as a complex and Compute the Special Asymptotes

g:= q-(1-alpha)*tan(q)+ c*tan(q):
f:= subs(q = x+I*y, g):
b1:= evalc(Re(f)) = 0:
b2:= y-(1-alpha)*tanh(y) -(alpha__3*xi*alpha/(eta__1*(4*k__1*y^2/d^2+alpha__3*xi/eta__1)))*tanh(y) = 0:
qstar:= (fsolve(1/c = 0, q = 0 .. infinity)):
OddAsymptotes:= Vector[row]([seq(evalf(1/2*(2*j + 1)*Pi), j = 0 .. n)]);

# Compute Odd asymptote

ModifiedOddAsym:= abs(`-`~(OddAsymptotes, qstar));
qstarTemporary:= min(ModifiedOddAsym);
indexOfqstar2:= SearchAll(qstarTemporary, ModifiedOddAsym);
qstar2:= OddAsymptotes(indexOfqstar2);

# Compute complex roots

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;

# Compute the rest of the Roots
soln3:= fsolve({b1, b2}, {x = 0 .. infinity, y = 0 .. 10});
soln4:= fsolve({b1, b2}, {x = -infinity ..0, y = -infinity .. 0});
Imagroot1:=subs(soln3, I*y);
Imagroot2:= subs(soln4, I*y);
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:

# Remove the repeated roots if any & Redefine n

qq:= MakeUnique(gg):
m:= numelems(qq):

## Return all the plots
return qq, Imagroot1,Imagroot2, p, soln3, soln4;
end proc:

ans:=[doCalc(0.06)]:
ans[5];
{x = 0., y = 1.158748796 + 0. I}
ans[6];
{x = 0., y = -1.158748796}

## How to write a_{01} in maple...

How to write a_{01} in Maple

 (1)

a[01] makes a_1. It mates a[01] - a[1] =0. However, a[0] becomes a_0. What to do? I want to write in maple in such that LaTeX conversion works good.

## Outout not return when using proc...

I'm using a procedure but the out is not returned. Please why?

restart:

Procedure

doCalc:= proc( xi )

# Import Packages
uses ArrayTools, Student:-Calculus1, LinearAlgebra,
ListTools, RootFinding, plots, ListTools:
local gamma__1:= .1093,
alpha__3:= -0.1104e-2,
k__1:= 6*10^(-12),
d:= 0.2e-3,
theta0:= 0.0001,
eta__1:= 0.240e-1,
alpha:= 1-alpha__3^2/(gamma__1*eta__1),
c:= alpha__3*xi*alpha/(eta__1*(4*k__1*q^2/d^2-alpha__3*xi/eta__1)),
theta_init:= theta0*sin(Pi*z/d),
n:= 30,
g, f, b1, b2, qstar, OddAsymptotes, ModifiedOddAsym,
qstarTemporary, indexOfqstar2, qstar2, AreThereComplexRoots,
soln1, soln2, qcomplex1, qcomplex2, gg, qq, m, pp, j, i,
AllAsymptotes, w, Efun, b, aa, F, A, B, Ainv, r, theta_sol, v, Vfun, v_sol,minp,nstar,
soln3, soln4, Imagroot1, Imagroot2;

# Assign g for q and plot g, Set q as a complex and Compute the Special Asymptotes

qq := [2.106333379+.6286420119*I, 2.106333379-.6286420119*I, 4.654463885, 7.843624703, 10.99193295,14.13546782, 17.27782732, 20.41978346, 23.56157073, 26.70327712, 29.84494078, 32.98658013,         36.12820481, 39.26982019, 42.41142944, 45.55303453, 48.69463669, 51.83623675, 54.97783528,                     58.11943264, 61.26102914, 64.40262495, 67.54422024, 70.68581510, 73.82740963,                                 76.96900389, 80.11059792, 83.25219177, 86.39378546, 89.53537903, 92.67697249];
m:= numelems(qq):

for i from 1 to m do
w[i] := gamma__1*alpha/(4*k__1*qq[i]^2/d^2-alpha__3*xi/eta__1);
end do;

## Return all the plots
return w;
end proc:

ans:=[doCalc(0.06)]:
ans[1];

## Co-normal products of graphs...

Kind help with Function given two graphs G1 and G2 then co-normal product be the graph G3 given by the function

conormal(G1,G2)

If any other explanation will surely give kind help please will surely acknowlege

## debugger problem using coerce with with object...

This is a much simplified version of a problem I am seeing. I think I have to remove all the coerce code I added as it seems to have problems.

Made an object with constructor that take an optional argument. These optional arguments use coerce to convert different types on one type of list.

I have another proc foo() that is called with these arguments, also same optional ones, and it then creates the object passing these arguments to it.

The problem is that if foo() is called with an optional argument itself, which will default to empty list [], I am not able to create the object now, when doing  ':-ic'=ic  since debugger gives

Error, invalid input: too many and/or wrong type of arguments passed to ModuleCopy; first unused argument is [] = []

Even though I made sure to pass the optional argument using  ':-name'=value.

The strange thing is that this only shows in the debugger. i.e. when typing the command in the debugger window. But in my application, it does not work inside the debugger and outside since it is much more complicated setup.  This is the simplest example I could make to show the same error in the debugger.

A small example will show the problem.

```restart;
A:=module()
option object;
export ode;
export ic;

export ModuleCopy::static:=proc(_self, proto::A, ode::`=`,
{ ic::coerce( (ic::list(`=`))->ic,
(ic::set(`=`))->[ic[]],
`:-NoUserValue`):=[]
},\$)
print("ode=",ode);
print("ic=",ic);
end proc;
end module;

foo:=proc(ode::`=`,{ ic::coerce( (ic::list(`=`))->ic,
(ic::set(`=`))->convert(ic,list),
`:-NoUserValue`):=[]
},\$)
local o;
DEBUG();
o:=Object(A,ode,':-ic'=ic);
end proc:

# and now

foo(diff(y(x),x)=1)
```

Now the debugger window shows at the line above just before calling the object constructor. This is what happens next

But if I click continue it does not produce an error and actually works. (in my main application, with similar setup, it gives an exception).

If I can figure why debugger gives this error, may be that will help me figure my more complicated setup.  I know if I do not use coerce, the debugger error goes away. Here is a version without coerce, and it works

```restart;
A:=module()
option object;
export ode,ic;
export ModuleCopy::static:=proc(_self, proto::A, ode::`=`, { ic::list(`=`):=[] })
print("ode=",ode);
print("ic=",ic);
end proc;
end module;
A := Object<<2457889631168>>

foo:=proc(ode::`=`, { ic::list(`=`):=[]})
local o;
DEBUG();
o:=Object(A,ode,':-ic'=ic);
end proc:

#now do
foo(diff(y(x),x)=1)
```

Now the debugger window comes up, but now see the difference:

No error!  even though  `ic` was [] in this case also, like the first example.

So for now, I will remove all the coerce code just to get my application to work again even though I like it, but it seems to cause a problem.

question: What the first example above given an error in the debugger?

Notice this error only shows up when using a module of type object

Update

This is just to confirm that removing the coerce API and replacing it back as it was with traditional optional arguments as in the second example above the exception went away.  My code is way too large to post here, but that is the only difference I have.  I think there is a problem using coerce with Object constructor calling somewhere.  But I am OK now, and able to continue work.

## Packing in power...

Given a graph G say and a positive integer k

I am in look out how to remove

edge-disjoint copies of G in G^k

That is edge disjoint copies of G into its power graph all possible ways

Again it is the maximum number of copies I means

Keeping this particular way can someone help kind help please

I will surely acknowledge it

G into to GraphPower(G,k)

## permute into a list of sums...

I was wondering if there was a way to permute a list to get a list of sums of permutations.
for example,

list:=[a,b,c]
permute(list,2) gives me ([a,b] [b,c] [c,a])

I would like to get this instead: ([a+b],[b+c],[c+d])

## Test post of worksheet with underscores...

 the quick brown fox jumps over the lazy dog

## Problem with long description in a procedure...

I have a long description that contains some Maple commands.
I dont want to use # as the lines dont show up when i use

```Isee:=proc(a)
interface(verboseproc = 3);
printf("%P", eval(a));
end proc
```

The long description is. Any way around the problem?

```Test:=proc(A,B,C)  description  "Computes projective line through 2 projective points or intersert of 2 projective lines as a projective point or coincidence of piont  line
Does some checking on validity of inputs.
Mobposn:- Global Variable, must = 1 or 3.
Points are returned as <1,x,y> or <x,y,1>
Lines are returned as <z,x,y> or <x,y,z>,
normalgpt :- Global Variable must be 0 or 1.
Points with algecraic elements are not reduced to <1,x,y> or <x,y,1> if 0
Points are defined as row vectors and  lines as column `vectors"`;

print(A,B,A-C);

end proc;```

## Roots of a function complex...

Hi, please how do I return the roots of a function in the form of I*y. The roots are [-.2381948477, -0.1434221912e-3, 0., 0.1434221912e-3, .2381948477] and I want to return them as [-.2381948477*I, -0.1434221912e-3*I, 0., 0.1434221912e-3*I, .2381948477*I]. I tried to use subs () function but couldn't work.

with(Student[Calculus1]):

soln := Roots(y-0.4646295e-3*tanh(y)+0.1839145082e-2*tanh(y)/(0.6000000000e-3*y^2-0.1840000000e-2), y);

subs(soln, I*y);

## Can Maple calculate the entropy of a discrete prob...

I don't have Maple yet, but if it can solve this problem for me then I'm ready to purchase!

I have a probability mass function pmf(in) to define a discrete probability distribution, based on a combinatoric analysis of an object of size n. So I don't have a drv X, I have a formula to generate Xn for 0 <= n, where n + 1 is then the size of the outcome alphabet.

In other words,
Xn = {0 <= i <= n : p(xi) = pmf(i, n)}

Where pmf(i, n) is 'well behaved' in the sense that it's not producing arbitrary results. As n increases, Xn has the same distribution simply with more detail.

So my question is, can Maple calculate the entropy, usually written H(X), of this distribution at, dare I say it, the limit, X?

Can it calculate it symbolically, or can it 'only' approximate it by a Taylor series or something?

Thanks in advance, this problem really has me stumped!

## Shaded area between three LineCharts...

Is it possible to create a shaded area between a set of three LineChats in Maple?

## How LinearSolve a square matrix (434160,434160) wi...

Hi,

I want to LinearSolve a square matrix (434160,434160) with sparse storage.

When I use SparseIterative with levelfill = 1, the commande gives a solution with very bad precision. I used many other options to get better precision without succes.

When I use SparseDirect (which I want to use), my PC (with 16G RAM) is bloqued and I must shut down it.

Is any advices to use SparseDirect for matrix with high dimensions and sparse storage.

Or, I must use another PC or another type of storage.

## How do I solve this equation?...

Dear power users, could someone be so kind to help me out with this file and give me some explanation on what I did wrong?

QuestionMaplePrimes.mw Thank you for you time and help