Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

So far I have only noticed them for special functions.

For the case of Airy in 2D: Is possible the get for the input Ai(x) the output Ai(x) and not AiryAi(x)?

 For the command LieAlgebras[RootSpaceDecomposition] I don't understand what the command return, I read the help and see the examples but still not understanding.

 

for example it returns:

RSD := RootSpaceDecomposition(CSA);

RSD := table([[-2, -1] = E31, [2, 1] = E13, [1, 2] = E23, [1, -1] = E12, [-1, 1] = E21, [-1, -2] = E32])

I don't understand what means [-2, -1] even they said that is the root but I know that a root is in h* so it must be only a number not a vector.

Hi, please can someone help on how non-dimensionalize PDEs. 

I have tried the following, but is not working:

restart:
eqn := (diff(theta(x, z, t), x))^2*(K[1]-K[3])*cos(theta(x, z, t))*sin(theta(x, z, t))+(diff(theta(x, z, t), x))*((diff(theta(x, z, t), z))*(-K[1]*cos(2*theta(x, z, t))+K[3]*cos(2*theta(x, z, t)))-(1/2)*gamma[1]*(4*sin(theta(x, z, t))^2*u(x, z, t)+2*u(x, z, t)*cos(2*theta(x, z, t))))+(diff(theta(x, z, t), z))^2*(K[3]-K[1])*cos(theta(x, z, t))*sin(theta(x, z, t))-(1/2)*gamma[1]*(diff(theta(x, z, t), z))*(4*sin(theta(x, z, t))^2*v(x, z, t)+2*v(x, z, t)*cos(2*theta(x, z, t)))+(diff(theta(x, z, t), z, x))*(-2*K[1]+2*K[3])*cos(theta(x, z, t))*sin(theta(x, z, t))-(diff(u(x, z, t), z))*((1/2)*gamma[2]*cos(2*theta(x, z, t))+(1/2)*gamma[1]*(2*sin(theta(x, z, t))^2+cos(2*theta(x, z, t))))-(diff(v(x, z, t), x))*((1/2)*gamma[2]*cos(2*theta(x, z, t))+(1/2)*gamma[1]*(-2*sin(theta(x, z, t))^2-cos(2*theta(x, z, t))))-(1/2)*gamma[1]*(4*sin(theta(x, z, t))^2*(diff(theta(x, z, t), t))+2*(diff(theta(x, z, t), t))*cos(2*theta(x, z, t)))+((diff(u(x, z, t), x))*gamma[2]-(diff(v(x, z, t), z))*gamma[2])*cos(theta(x, z, t))*sin(theta(x, z, t))+f[2](theta(x, z, t))*(diff(theta(x, z, t), x, x))+f[1](theta(x, z, t))*(diff(theta(x, z, t), z, z));

varchange := {t = T*tau, u = xi*h^2*U/alpha[4], v = xi*h^2*V/alpha[4], x = X*h, z = Z*h, K[3] = K[1]*k[3], f[1] = K[1]*F[1], f[2] = K[1]*F[2], gamma[1] = mu*Gamma[1], gamma[2] = mu*Gamma[2]};

PDEtools:-dchange(varchange, eqn, [tau, U, V, X, Z, k[3], F[1], F[2], GAMMA[1], GAMMA[2]]);

Sometimes this information is not needed. Example

(Int = int)(1/x, x = a .. 2, 'AllSolutions')

I had a look at help(interface).

Hi,
I want to find (w/k)^2 from the following Eq. by Maple. How do I do it?
(u0b, mu,deltab,sigma and A are fixed parameters)

Eq.mw

Hello community,

Could I please get help on how to invert a probability distribution (reciprocal of) and add the location and scale parameters? The distribution in question is from the built-in (Statistics package) of ChiSquare(n) transformed into a scaled inverse Chi Square with location (shift) parameters.

I have tried the following which results in verified (correct) empirical (sampled) data, but have not been equally successful in the theoretical moments and its quantiles.

 

restart;
st:=time():

with(Statistics):

 

InvChi2:=proc(a,b,n)
        description "inverse chisquare distribution with a=location, b=scale, n=degrees of freedom";


        local CHI := RandomVariable(ChiSquare(n)):
        
        Distribution(
                CDF = unapply(CDF(b*n/CHI+a,t),t),
                PDF = unapply(PDF(b*n/CHI+a,t),t),
                Mean = a+~Mean(b*n/CHI),
                Median = a+~Median(b*n/CHI),
                Variance = simplify(CentralMoment(a+b*n/CHI,2)),
                Skewness = simplify(CentralMoment(b*n/CHI, 3) / CentralMoment(b*n/CHI,2)^(3/2)),
                Kurtosis = simplify(CentralMoment(b*n/CHI, 4) / CentralMoment(b*n/CHI,2)^2),
                Conditions = [b > 0],
                RandomSample = proc(N::nonnegint)
                                a+~Sample(b*n/CHI,N)
                        end proc
                );
        end proc:

 

T:= RandomVariable(InvChi2(2,4.32,3))

 

 

_R0

(1)

evalf(Median(T))

FAIL

(2)

evalf(Mean(T))

14.96000000

(3)

Variance(T)

Float(infinity)

(4)

Skewness(T)

Float(undefined)

(5)

Kurtosis(T)

Float(undefined)

(6)

Quantile(T,.25)

FAIL

(7)

A:=Sample(T,10^5):

Median(A)

HFloat(7.509476657413067)

(8)

Mean(A)

HFloat(14.419072346310452)

(9)

Variance(A)

HFloat(2692.8025716746843)

(10)

Skewness(A)

HFloat(47.59107730088799)

(11)

Quantile(A,.25)

HFloat(5.177452862452726)

(12)

Quantile(A,.75)

HFloat(12.76851658170427)

(13)

printf("Time to execute worksheet = %a seconds", time() - st)

Time to execute worksheet = 2.813 seconds

 

 


Download invChi2.mw

Thank you

How to randomly generate a matrix with the given determinant?

Many thanks!

Hello everyone
I have this equation (3+2*x+3*x2)n=Sum(bi*xi,i=0..2*n)
I want to determine the bi values for any n in N how to do that ?

I thank you in advance.

This isn't particularly complicated. Varying the span generates graphs that are smooth or have an obvious bug. Not sure why.

This also happens if you vary the C_I_CentLim or the C_Inventory. I created this example so it is clearly happening.
The graph gets a sharp jag down, then returns to normal.

Something weird with density of points? I played with it for hours and can't get it to go away.
=============================================
restart;
L := 0;
C_Inventory := 1500;
C_I_CentLim := 0.001;
C_I_StartLim := C_Inventory*C_I_CentLim;
C_InV := Matrix(1000, 3);  # This is so you  can see values created only bobble slightly where the graph has a giant deviation.
iCounter := 0;
P_ScLdt := proc(t) local x, k; global L, C_Inventory, iCounter, C_InV; x := 0; k := 0.08; iCounter := iCounter + 1; L := C_Inventory*C_I_CentLim; x := 4.8 + L/(1 + exp(-k*(t - 2060))) + 0.050; C_InV[iCounter, 1] := L; C_InV[iCounter, 2] := C_Inventory; C_InV[iCounter, 3] := x; if 0 < x then C_Inventory := C_Inventory - x; return x; else return 0; end if; end proc;

# Show results 1800-2100  Problem.
pP_ScLdt := plot('P_ScLdt'(x), x = 1800 .. 2100, linestyle = dash, color = red, thickness = 3, axis = [gridlines = [colour = black, majorlines = 2]], legend = "Pg");

# Re-initialize.
L := 0;
C_Inventory := 1500;
C_I_CentLim := 0.001;
C_I_StartLim := C_Inventory*C_I_CentLim;
C_InV := Matrix(1000, 3);
iCounter := 0;
# Show  that problem happens with a little shorter span
pP_ScLdt := plot('P_ScLdt'(x), x = 1850 .. 2100, linestyle = solid, color = black, thickness = 1, axis = [gridlines = [colour = black, majorlines = 2]], legend = "Pg");

# Re-initialize
L := 0;
C_Inventory := 1500;
C_I_CentLim := 0.001;
C_I_StartLim := C_Inventory*C_I_CentLim;
C_InV := Matrix(1000, 3);
iCounter := 0;
# Show problem goes away with a different interval 1900-2200
pP_ScLdt := plot('P_ScLdt'(x), x = 1900 .. 2200, linestyle = dash, color = blue, thickness = 3, axis = [gridlines = [colour = black, majorlines = 2]], legend = "Pg");

# Re-initialize
L := 0;
C_Inventory := 1500;
C_I_CentLim := 0.001;
C_I_StartLim := C_Inventory*C_I_CentLim;
C_InV := Matrix(1000, 3);
iCounter := 0;
# Enlarge the working interval of 1900-2200 to 1900-2300 and the problem returns, in a different place.
pP_ScLdt := plot('P_ScLdt'(x), x = 1900 .. 2300, linestyle = dash, color = blue, thickness = 3, axis = [gridlines = [colour = black, majorlines = 2]], legend = "Pg");


# Re-initialize
L := 0;
C_Inventory := 2000;
C_I_CentLim := 0.001;
C_I_StartLim := C_Inventory*C_I_CentLim;
C_InV := Matrix(1000, 3);
iCounter := 0;

# Enlarge the interval and it causes a larger set of jaggie deviations.
pP_ScLdt := plot('P_ScLdt'(x), x = 1800 .. 2800, linestyle = solid, color = blue, thickness = 1, axis = [gridlines = [colour = black, majorlines = 2]], legend = "Pg");

k                  

∏(2ⁿ-1)

n=1               

The following  question I asked a long time ago.

The user Carl Love provided a nice answer regarding the counting of cycles. Back then, I was only interested in the number of cycles, but now I am also interested in finding out these cycles.

 

I noticed sand15's answer where he (or she) attempted to use the cycle basis to find all cycles. This approach is theoretically viable. However, it seems that his (her) implementation had some instances of missing cycles.  (mmcdara‘s answer is also missing some cycles)

So I brought up this question again to draw attention to it. The only distinction is that I may have specifically mentioned the use of a cycle basis method. Additionally, I may give another question:

  • How do we generate all cycles with a specific length (by cycle basis)?

 However, I remain open-minded about alternatives that do not involve a cycle basis. 

The SageMath approach for that can be referred to the link, which is actually why I remembered this question. It feels like the function in linear algebra that generates all elements through a basis would be effective.

g=graphs.OctahedralGraph()
def gen_simple_cycles(G):
    C = [frozenset(tuple(sorted(e[:2])) for e in c) for c in G.cycle_basis(output='edge')]
    for S in Subsets(C):
        T = set()
        for c in S:
            T = T.symmetric_difference(c)
        H = Graph(T, format='list_of_edges')
        if H.is_eulerian() and max(H.degree(),default=0)==2:
            yield H.eulerian_circuit(return_vertices=True)[1]
list(gen_simple_cycles(g))

[[0, 4, 2, 0],
 [0, 4, 3, 0],
 [0, 4, 5, 1, 0],
 [2, 5, 4, 2],
 [3, 5, 4, 3],
 [0, 3, 1, 0],
 [0, 2, 1, 0],
 [0, 3, 4, 2, 0],
 [0, 2, 4, 5, 1, 0],
 [0, 4, 5, 2, 0],
 [0, 4, 2, 1, 0],
 [0, 3, 4, 5, 1, 0],
 [0, 4, 5, 3, 0],
 [0, 4, 3, 1, 0],
 [0, 4, 2, 5, 1, 0],
 [0, 4, 3, 5, 1, 0],
 [0, 4, 5, 1, 3, 0],
 [0, 4, 5, 1, 2, 0],
 [2, 5, 3, 4, 2],
 [0, 3, 1, 2, 0],
 [0, 3, 4, 5, 2, 0],
 [0, 3, 5, 4, 2, 0],
 [0, 2, 4, 3, 1, 0],
 [0, 3, 4, 2, 1, 0],
 [0, 2, 5, 1, 0],
 [0, 2, 4, 3, 5, 1, 0],
 [0, 3, 1, 5, 4, 2, 0],
 [1, 5, 4, 2, 1],
 [0, 4, 3, 5, 2, 0],
 [0, 4, 5, 2, 1, 0],
 [0, 4, 2, 1, 3, 0],
 [0, 3, 4, 2, 5, 1, 0],
 [0, 3, 5, 1, 0],
 [1, 5, 4, 3, 1],
 [0, 3, 4, 5, 1, 2, 0],
 [0, 4, 2, 5, 3, 0],
 [0, 4, 5, 3, 1, 0],
 [0, 4, 3, 1, 2, 0],
 [0, 4, 2, 5, 1, 3, 0],
 [0, 4, 3, 5, 1, 2, 0],
 [0, 3, 5, 2, 0],
 [0, 2, 5, 4, 3, 1, 0],
 [0, 3, 4, 5, 2, 1, 0],
 [0, 2, 4, 5, 3, 1, 0],
 [0, 3, 5, 4, 2, 1, 0],
 [1, 3, 4, 2, 1],
 [0, 3, 1, 5, 2, 0],
 [1, 5, 2, 1],
 [1, 5, 3, 4, 2, 1],
 [0, 4, 3, 5, 2, 1, 0],
 [0, 4, 5, 2, 1, 3, 0],
 [1, 5, 2, 4, 3, 1],
 [1, 5, 3, 1],
 [0, 3, 5, 1, 2, 0],
 [0, 4, 2, 5, 3, 1, 0],
 [0, 4, 5, 3, 1, 2, 0],
 [0, 4, 3, 1, 5, 2, 0],
 [0, 4, 2, 1, 5, 3, 0],
 [0, 2, 5, 3, 1, 0],
 [0, 3, 5, 2, 1, 0],
 [1, 3, 4, 5, 2, 1],
 [1, 3, 5, 4, 2, 1],
 [1, 3, 5, 2, 1]]

Total: 63 cycles.

 

Hi,

I can build my trigonometric circle, but I want to display irrational values ( instead of decimal values) in the tickmarks option. ideas? P.S : My code is quite long, because I wanted to display amplitudes in an optimal way.

 CERCLETEST.mwCERCLETEST.mw

Hi,

I previously wrote and ran a program with Maple 2020, but I deleted Maple 2020 and now I installed 2023, but that program runs with an error.

Download sssss.mw

eta/2*diff(f, eta) + (diff(f, eta, eta) + lambda*diff(g, eta)/g)*g^lambda=0,

g*diff(g, eta) + sigma*eta*diff(g, eta)=0,here lambda,sigma positive parameters initial conditions f'(0)=0,g'(0)=0,f' goes to 1 at eta goes to infinity ,g' goes to 1 at eta goes to infinity

can you solve this coupled nonlinear differential equations  using homotopy analysis method

I need tutoring on some calculus basics.

y(x)

y(x)

(1)

diff(y(x), x)

diff(y(x), x)

(2)

(Int = int)(diff(y(x), x), x)

Int(diff(y(x), x), x) = y(x)

(3)

(Int = int)(diff(y(x), x), x = a .. b)

Int(diff(y(x), x), x = a .. b) = int(diff(y(x), x), x = a .. b)

(4)

The right-hand side below is the desired evaluation.

(`@`(value, rhs))(Int(diff(y(x), x), x = a .. b) = int(diff(y(x), x), x = a .. b)) = eval(int(diff(y(x), x), x), x = b)-(eval(int(diff(y(x), x), x), x = a))

int(diff(y(x), x), x = a .. b) = y(b)-y(a)

(5)

Download Eval_definite_integral.mw

Maple does integrate the indefinite integral but not a definite version of it.

I assume that this is not possible without additional assumptions on y(x).

I tried to assume the properties continuous and differentiable.

Anything else that can be done/assumed to force evaluation the way I want?

Here is an example of how such integrals can come about

First 67 68 69 70 71 72 73 Last Page 69 of 2097