## How do I solve a in-equation in form of single var...

> solve({lambda[2]*mu[2]^2*(lambda[2]+mu[2])*lambda[1]/(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)+lambda[2]*mu[2]*(mu[2]^2+mu[2]*lambda[2]+lambda[2]^2)*lambda[1]/(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)+mu[2]^4*lambda[2]*lambda[1]/((lambda[1]+mu[2])*(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4))+(1/2)*(mu[2]^3*lambda[1]+mu[2]^3*lambda[2]+lambda[1]*lambda[2]*mu[2]^2+mu[2]^2*lambda[2]^2+mu[2]*lambda[2]^3+mu[2]*lambda[1]*lambda[2]^2+lambda[1]*lambda[2]^3)*lambda[2]*lambda[1]/((lambda[1]+mu[2])*(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4))+3*mu[2]^4*lambda[1]/(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)+mu[1]*mu[2]^4*lambda[1]/((4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)*(lambda[2]+mu[1]))+mu[2]^4*lambda[2]*lambda[1]/((4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)*(lambda[2]+mu[1]))+mu[2]^3*lambda[2]*lambda[1]/(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)+(1/2)*(mu[2]^3*lambda[1]+mu[2]^3*lambda[2]+lambda[1]*lambda[2]*mu[2]^2+mu[2]^2*lambda[2]^2+mu[2]*lambda[2]^3+mu[2]*lambda[1]*lambda[2]^2+lambda[1]*lambda[2]^3)*lambda[2]*lambda[1]/(4*mu[2]^5+4*mu[2]^4*lambda[1]+4*mu[2]^4*lambda[2]+4*mu[2]^3*lambda[1]*lambda[2]+3*mu[2]^3*lambda[2]^2+3*lambda[1]*lambda[2]^2*mu[2]^2+2*mu[2]^2*lambda[2]^3+2*lambda[1]*lambda[2]^3*mu[2]+mu[2]*lambda[2]^4+lambda[1]*lambda[2]^4)-3*mu[1]*mu[2]^4/(4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)+mu[1]*mu[2]^4*lambda[2]/((4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)*(lambda[2]+mu[1]))+mu[1]^2*mu[2]^4/((4*mu[2]^4+4*mu[2]^3*lambda[2]+3*mu[2]^2*lambda[2]^2+2*mu[2]*lambda[2]^3+lambda[2]^4)*(lambda[2]+mu[1])) < 0}, [lambda[1]]);
Warning, solutions may have been lost

## How to build your own random variable?...

Hi,

Here's a problem that's been bothering me for a long time:

The Statistics[Distribution] help page describes the way to construct one's own Random Variable (RV).
All the examples construct a distribution foo := Distribution(...) next used to define the RV X by typing
X := RandomVariable(foo)

On the other way, constructing a RV Y from predefined Maple's distributions writes
Y := RandomVariable(bar(sequence of parameters))

The "user defined RV feature" (MyRV := RandomVariable(foo)) seems to be restricted to distributions where all the parameters are numerically instanciated, contrary to "Maple's defined distributions" where these parameters can be kept formal).
So my question: Is it possible to define your own Distribution (module foo) in such a way that the definition of the RV X writes
X := RandomVariable(foo(sequence of parameters))

The attached file contains an example for the Levy distribution (the second part is just a workaround where a substitution is used to balance my inability to define a RV the way above)

 > restart:
 > with(Statistics):

A particular Levy distribution

Levy Distribution  Levy(m=0, s=1)
m : location parameter
s := dispersion parameter

 > m := 0: s := 1: pdf := unapply(piecewise(x<0, 0, sqrt(s/2/Pi)*exp(-s/2/(x-m))/(x-m)^(3/2)), x); cdf := unapply(erfc(sqrt(s/2/(x-m))), x); samplingMethod := proc(N)                      m +~ s /~ ( Quantile~(Normal(0, 1), Sample(Uniform(1/2, 1), N)) )^~2                   end proc;
 (1)
 > Levy := Distribution(                       PDF=(x->pdf(x)),                       CDF= (x->cdf(x)),                       RandomSample = (N->samplingMethod(N))                     );
 (2)
 > X := RandomVariable(Levy): PDF(X, x); Sample(X, 5);
 (3)

How should I define a formal Levy distribution in such a way that, as for any predefined RV in Maple,
a particular instance is defined by  X := RandomVariable(Levy(M, S))
where M and S are numerical values?

 > m := 'm': s := 's':
 > pdf := unapply(piecewise(x<0, 0, sqrt(s/2/Pi)*exp(-s/2/(x-m))/(x-m)^(3/2)), x); cdf := unapply(erfc(sqrt(s/2/(x-m))), x); samplingMethod := proc(N)                      m +~ s /~ ( Quantile~(Normal(0, 1), Sample(Uniform(1/2, 1), N)) )^~2                   end proc;
 (4)
 > Levy := Distribution(                       PDF=(x->pdf(x)),                       CDF= (x->cdf(x)),                       RandomSample = (N->samplingMethod(N))                     ):
 > X := RandomVariable(Levy): PDF(X, x); print(); # here is an inelegant workaround ms := {m=0, s=1}; subs(ms, PDF(X, x));
 (5)
 > u := Sample(X, 2); # The substitution doesn't work subs(ms, u);
 (6)
 > # just a copy-paste of lprint(u): the substitution does work lprint(u); subs(ms, Vector[row](2, {1 = m+HFloat(2.49542958430755446)*s, 2 = m+HFloat(4.80772083491271562)*s}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []))
 Vector[row](2, {1 = m+HFloat(.529024707466874800)*s, 2 = m+HFloat(1.50334452451578438)*s}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])
 (7)
 >

## Writing set of differential equations as a matrix ...

```Suppose that we have a set of differential equations as follows
```

and we want to write the above equation as a matrix form  ( for convenience, Let upper limit of summations be 2, not infinity )

QUESTION: How to find the coefficients of Matrix Dif. equations (matrices M, C, K, f, D) by MAPLE? MY TRY: question.mw

We can find the matrices by hand as follows: (But how to derive the matrices directly from the equation in the first picture by Maple)

```restart:with(LinearAlgebra):with(plots):interface(rtablesize=36):
with(Physics): #for KroneckerDelta

N:=2:
p:=2:
A:=Matrix(N,1):
B:=Matrix(N,1):
for n from 1 to N do
end do:
B:=Matrix(N,1):
for n from 1 to N do
end do:
# in order to make ensure, let's look backwards

r:=2:

M:=Matrix(r,r):
C:=Matrix(r,r):
K:=Matrix(r,r):
for n from 1 to r do
for j from 1 to r do
M(n,j):=KroneckerDelta[n,j]+2*gamma*sin(n*Pi*v0*tau)*sin(j*Pi*v0*tau);
C(n,j):=4*gamma*Pi*v0*j*sin(n*Pi*v0*tau)*cos(j*Pi*v0*tau):
K(n,j):=n^4*Pi^2*KroneckerDelta[n,j]-2*gamma*(j*Pi*v0)^2*sin(n*Pi*v0*tau)*sin(j*Pi*v0*tau):
end do:
end do:
f:=Matrix(r,1):
X:=Matrix(r,1):
U:=Matrix(r,1):
for n from 1 to r do
f(n,1):=gamma*Pi^3/2*sin(n*Pi*v0*tau);
X(n,1):=phi[n](tau):
U(n,1):=u[n](tau):
end do:
DD:=Matrix(r,p):
for n from 1 to r do
for i from 1 to p do
DD(n,i):=sin(n*Pi*eta[i]);
end do:
end do:
M*diff(X,tau,tau)+ C*diff(X,tau)+ K*X=f+DD.U;```

quest.mw

## plot error (with proc )...

Why this plot dosen't work ?

 >
 >
 >
 >
 >
 >
 >
 >

 >
 >
 >
 >
 >
 >
 >
 >

## Sorting procedure for lists of integers...

Hi, I'm stuck on how to create a procedure, 'Arrange' that sorts a list of integers so that the numbers go from smallest to largest. So if I have a list such as: [3,6,1,9,0,4] ,

Arrange([3,6,1,9,0,4]) = [0,1,3,4,6,9]

I have a procedure that produces a sequence where we denote 'x' as the first number in the list, and returns: a list of all the numbers in the list less than x, x, a list of all the numbers greater than x.

i.e. returns: [1, 0], 3, [6, 9, 4]

Arrange := proc(L)
local L1,L2,n,x,i;
L1:=[];
L2:=[];
n:=nops(L):
if n=0 then
print('NULL')
elif n=1 then
return L[1];
elif n>1 then
x:= L[1];

for i from 2 to n do
if L[i] < x then
L1:=[L1[],L[i]]:
else
L2:=[L2[],L[i]]:

end if:
end do:
end if:
return L1,x,L2;

end proc:

could anyone help on how I can expand on this to get the procedure that I want?

p.s. I know that there is already an inbuilt 'sort' function in Maple, but I'm trying to create the procedure myself!

## A series of expansion of incomplete elliptic integ...

Good day.

I have a problem with the numerical approximation of incomplete elliptic integrals of the first kind in the case when the argument and the modulus are complex numbers.

Let's consider an incomplete elliptic integral of the first kind EllipticF((a+I*b)*x, c+I*d), where a,b,c,d are arbitrary real numbers and x is very large number. Here is the code:

```restart;
R0 := EllipticF((a+I*b)*x, c+I*d);
with(MultiSeries, series):
R1 := series(R0, x = infinity, 2);
a := .5; b := 1.75; c := 10; d := 12.5; x := 10^6;
evalf(R0); evalf(R1);```

Below you can see that answers are different

```.1680611942+.2058775337*I
-0.4563467782e-1-.3592094173*I+O(1/1000000000000000000)```

While the same code for an incomplete elliptic integral of the second kind gives the correct approximation:

```restart;
R00 := EllipticE((a+I*b)*x, c+I*d);
R11 := series(R00, x = infinity, 2);
a := .5; b := 1.75; c := 10; d := 12.5; x := 10^6;
evalf(R00); evalf(R11);
-1.687498740*10^7+2.374999011*10^7*I
-1.687501260*10^7+2.375000989*10^7*I+O(1/1000000)```

What is the difference?

## How do I plot or map a matrix output with binary e...

I have a question that concerns visualising the output of a simple matrix. For instance, take a 4 x 10 matrix in the example attached (rows are denoted by i and columns, j) with entries either 0 or 1. This gives the on/off relationship between any i and j. Let i and j denote 2-dimensional locations whose coordinates are known. The matrix gives the connections (1's) between both locations; 0's otherwise.

Can Maple output a map that visually represents the connections between nodes?

In the example here, I wish to plot location 2 (in i) connected to location 3 (in j), location 3 (in i) connected to location 1 (in j), and so on. Can I output a plot / map that presents the nodes with radiating / connecting arrows?

I'm hoping someone can help, since the matrix form is not quite appealing for a large number of entries.

 >
 >

 >

## How do I solve a differential equation in Maple?...

Hello dear freinds

when i solve the ode i found exponential solutions.i want to find trignometric solutions of an ode.

I am attaching maple file..

Thanks for ur cooperation.file.mw

## contour plot of implicit expression...

Hi,

the foolowing code is for contour plot at Delta =-12.71 but there is somthing coulnd understand not works

I dont know why this not work

restart:
with(plots):

Omega:=0:lambda:=1:
gamma1:=8*Pi:
gamma2:=0.002*Pi:
x1:=100*Pi:
omega2:=200*Pi:
gamma0:=0.2*Pi:
G:=20*Pi:

lambda1:=(1/(2*Pi))*(G*Omega*gamma0/(2*(0.25*gamma0^2+Delta^2))):
lambda2:=(1/(2*Pi))*(-G*Omega*Delta/((0.25*gamma0^2+Delta^2))):
lambda3:=(1/(2*Pi))*gamma1+lambda1:
lambda4:=(1/(2*Pi))*(lambda*Delta-G^2*Delta/(0.25*gamma0^2+Delta^2)):
lambda5:=(1/(2*Pi))*(2*x1^2*omega2/((omega2^2+gamma2^2))):
f:=epsilon=(lambda1+sqrt(-lambda2^2+Y^2*(lambda3^2+(lambda4-lambda5*Y^2)^2))):

implicitplot3d(f, epsilon=0..20,Y = 0 .. 1,Delta=-40*Pi..40*Pi, labels=[epsilon,X,Delta],tickmarks=[3,3,3],style=surface);

contourplot(solve(f,Delta),epsilon=-20..20,Y=0..1,contours=[-12.71],axes=boxed,thickness=2,color=black,font=[1,1,18],tickmarks=[2, 2],linestyle=1, numpoints=50000);

## How to construct a user defined data structure in ...

Dear Community,

I would like to have a 3D matrix, where each of the matrix elements is a collection of different kind of data, e.g. integers, real (float) numbers, logical variable, 1D vector of integers or reals, 1D vector of logical variables, etc. In other words I would like to store a collection of different data on a 3D grid. This collection is of course identical for all grid points, i.e. matrix elements. I experimented with DataFrames, but it did not allow me to use vectors. How could I realize such a structure in Maple? It is done quite easily in MATLAB e.g. with the "struct" command, or in FORTRAN with the "Type" command.

best regards

Andras

## How do I search for integer coefficients?...

HI all,

Let all variables be integers here.

I am trying to search 3 variables , "A","B",and "C" so that f(A*x2+B*x+C) factors into two binomials.

Here, f(y) = y2+y+19.

Choose a search space of 0<A<10 and 0<B<30 and 0<C<100.

I am having some trouble with my Maple code.

Here is how far I got -

Maple_coefficient_search_broken.mw

Maple_coefficient_search_broken.pdf

Regards,

Matt

## List manipulation and plotting...

I want to visualize data provided by the Maximize command. The output I get is of the following form (example):

[.358700275060090779, [p[0] = .192413186080606, p[1] = 0.906594292940704e-1, p[2] = 0.677108912885780e-1, p[3] = 0.609551830556988e-1, p[4] = 0.589744573790909e-1, p[5] = 0.585737058072817e-1, p[6] = 0.589744573787748e-1, p[7] = 0.609551830550955e-1, p[8] = 0.677108912877626e-1, p[9] = 0.906594292931833e-1, p[10] = .192413186079858]]
I want to plot the sequence p[0], ..., p[10] with the command LineChart (for example).

My question is: How to automatically "clean up" output as above so I can feed it to LineChart?

## Calculating christoffel symbol with differential g...

with(DifferentialGeometry): with(Tensor):

DGsetup([x1, x2, x3, x4], M)

g1 := evalDG(dx1dx3+dx2dx4-u22(dx3)^2-u11(dx4)^2+2*u12*dx3dx4)

C1 := Christoffel(g1)

^^^ This is my code, I know theres something wrong with the metric but I'm not sure what, any help would be appreciated thanks! (This code gives me no answer).

u11*u22-u12^2+u13+u24 = 0   - This is the original eq I was working off.