Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello Everyone,

Firstly thank you for your help everyone with answering my other question yesterday, it really helped.
Today I present with yet another issue, which is dealing with solving differential equations using the dsolve-command.

I have written a script which is defining the differential equations, (some numbers), and the constraints. However when I let it solve using dsolve, I only get a very very trivial answer, meaning f(x) = 0.
of course this is a valid answer, but not one I can work with... 
(Can I maybe give an additional information, e.g. the function type it is supposed to do this task? In the documentation there is information on setting it up as a series, but what about exponential equations?)

I have uploaded to script (very short), maybe someone knows where I went wrong?
Also, I am assuming that for solving a DE which involves a fourth order derivative I need exactly four boundary conditions, which I provided.
Things are also getting really wonky when I set Nxy to something non-zero... Then I get a solutions which involves a mysterious Z which never happened before and again all four C_x, which I assume resemble missing boundary conditions, reappear.

Any help would be fantastic! :)

Best Regards,

Lennart
 

``

 

restart*with(DocumentTools); with(LinearAlgebra); D11 := 10000; D12 := 10000; D22 := 10000; D66 := 10000; Nx := 1000; Ny := 1000; Nxy := 0; a := 5000; b := 5000; w := sin(y)*GenFunc(x); PDGL := D11*(diff(w, `$`(x, 4)))+(2*(D12+2*D66))*(diff(w, `$`(x, 2), `$`(y, 2)))+D22*(diff(w, `$`(y, 4)))+Nx*(diff(w, `$`(x, 2)))+Ny*(diff(w, `$`(y, 2)))+2*Nxy*(diff(w, `$`(x, 1), `$`(y, 1))) = 0; RB := GenFunc(0) = 0, (D(GenFunc))(0) = 0, GenFunc(a) = 0, (D(GenFunc))(a) = 0; dsolve({PDGL, RB}, GenFunc(x))

GenFunc(x) = 0

(1)

NULL


 

Download Test_DGL1.mw

Given a lagrangian  in general relativity , how can I calculate equation of motion using euler lagrangian equation in maple software ?

the lagrangian is 

L = 1/2 g[mu,nu] diff(x[~mu], lambda) diff(x[~nu],lambda)

here lambda is the affine parameter.  and the metric is 

 

 

metric coordinate = (t,u,x,y)

This is the context: I call LinearAlgebra:-LinearSolve to solve system of linear equations. If there are infinite solutions, then Maple return the solution that has free variables, calling them using  _t[n] where can change each time and be different. It can also be _t0[n] and _t1[n] etc.. but these all are indexed variables.

I want to obtain a list of all these free variables in the resulting solution vector, so that later I can assign them some values.

But I do not know what can be. And how many of them there are. There could be _t[3] and _t[4] for example in the same solution vector.

Here is what I do now, where I just check for indexed type. This seems to work, since only _t[n] should be in the resulting solution if any.

restart;
A:=Matrix([[0,1,-1],[-1,-2,2],[-1,-2,2]]):
v:=Vector([-1,1,1]):
sol := LinearAlgebra:-LinearSolve(A,v);

map(x->select(type,x,'indexed'),convert(sol,set))

I do not know how to tell it to look for all something that starts with  _t and also indexed type.

Is there a better way to obtain list of all _t[n] that LinearAlgebra:-LinearSolve could return? Will LinearAlgebra always return the free variables as indexed variables so I am sure the above will always work?  Do you see a problem with the above solution?

It is annoying that some functions in Maple wants input like (a,b,c,.....) which represents numbers, and I am not able to find how to use such a function, because the list of numbers I have are in a list.

For example, ilcm and igcd.  This is not a good design. The input should have been a list or set, or vector, etc.... 

I wanted to find least common multiplier of a list of numbers. These numbers are allready in a list, since this is a result of a computation done earlier. Now I want to find ilcm of them. 

How to use ilcm in this case? How to unpack them to make ilcm happy? In Mathematica there a special function to do this, called Sequence, which takes a list and unpack it to call function. 

But I am not able to find one in Maple. There is no convert(list,exprseq). 

Here is a MWE

v:=[2,4,7];
ilcm( v ); #does not work, since ilcm does not accept a list

The variable v above has to be in a list (or set, or vector). This is result from another computation. This is all done non-interactive. 

So I am looking for some magic function to use it like this

v:=[2,4,7];
ilcm( convert_to_expression_sequence(v) )

Is there a way to unpack or convert list to expression sequence, so I can use ilcm?

This is my attempt. But I suspect there is a build-in way in Maple to do this which I have not found yet.

restart;

convert_list_to_exprsequence:=proc(L::list)::exprseq;
local r:=NULL,item;

for item in L do
    r:=r,item;
od;

return r;
end proc:

v:=[2,4,7];
ilcm(convert_list_to_exprsequence(v)); #now it works

                  #28

Maple 2020.1

Sir can you please tell me how to mention the valve of parameters like Re and lambda on the graph with different colors like as shown in the attached figure. I want to show thee valve by using  command rather than editing menually.  

How I can find the coefficient an, and bn according to the following solution?

the coefficients an and bn can be found by solving the
two linear equations that come from V = V[0] at eta=eta[0] and 
V = V[1] at eta=eta[1], and comparing with following Eq in each
case.

Best

2.mw

 

 

 

 

Need help to draw a graph between x and lambda, lambda should on the horizontal axis. it should look like the attached picture.


 

restart

lambda := proc (x) options operator, arrow; (-1.565845910+2.393779704*x^2+1.564996800*x^4+1.800900000*x^6)/(x^2+2)^4 end proc

proc (x) options operator, arrow; (-1.565845910+2.393779704*x^2+1.564996800*x^4+1.800900000*x^6)/(x^2+2)^4 end proc

(1)

data := [seq([lambda(x), x], x = 0 .. 1, .1)]

[[-0.9786536938e-1, 0], [-0.9445602702e-1, .1], [-0.8473253124e-1, .2], [-0.7004169612e-1, .3], [-0.5215959052e-1, .4], [-0.3283205351e-1, .5], [-0.1345044703e-1, .6], [0.5065808511e-2, .7], [0.2221891338e-1, .8], [0.3780341321e-1, .9], [0.5177568635e-1, 1.0]]

(2)

with(CurveFitting)

x := PolynomialInterpolation(data, lambda)

-0.6298940090e12*lambda^10-0.1443096227e12*lambda^9-7314622270.*lambda^8+489000321.4*lambda^7+45718357.19*lambda^6-73452.0126*lambda^5-68414.72355*lambda^4-508.641296*lambda^3+39.75510893*lambda^2+5.699823870*lambda+.6702161742

(3)

``


 

Download help2.mw

 

restart

lambda := proc (x) options operator, arrow; (-1.565845910+2.393779704*x^2+1.564996800*x^4+1.800900000*x^6)/(x^2+2)^4 end proc

proc (x) options operator, arrow; (-1.565845910+2.393779704*x^2+1.564996800*x^4+1.800900000*x^6)/(x^2+2)^4 end proc

(1)

data := [seq([lambda(x), x], x = 0 .. 1, .1)]

[[-0.9786536938e-1, 0], [-0.9445602702e-1, .1], [-0.8473253124e-1, .2], [-0.7004169612e-1, .3], [-0.5215959052e-1, .4], [-0.3283205351e-1, .5], [-0.1345044703e-1, .6], [0.5065808511e-2, .7], [0.2221891338e-1, .8], [0.3780341321e-1, .9], [0.5177568635e-1, 1.0]]

(2)

with(CurveFitting)

x := PolynomialInterpolation(data, lambda)

-0.6298940090e12*lambda^10-0.1443096227e12*lambda^9-7314622270.*lambda^8+489000321.4*lambda^7+45718357.19*lambda^6-73452.0126*lambda^5-68414.72355*lambda^4-508.641296*lambda^3+39.75510893*lambda^2+5.699823870*lambda+.6702161742

(3)

``


 

Download help2.mw

I an unable to prot the optimal  control function and the controls individualy for the diterministic mathematical model with an two or more optimal control. May  any one can give me a sample program on it. Such us the following figure

You may give me direction even.

I'm thinking of better demonstrating the cartesian product of a graph.
With the help documentation, we can easily find the cartesian product of two graphs.

with(GraphTheory):
G := CycleGraph([v__1,v__2,v__3,v__4]);
H:=Graph({{u__1,u__2}}):
DrawGraph(G,size=[250,250],stylesheet=[vertexborder=false,vertexpadding=10,edgecolor = "Red",
vertexcolor="navy",edgethickness=3]);
DrawGraph(H,size=[250,250],stylesheet=[vertexborder=false,vertexpadding=10,edgecolor = "Blue",
vertexcolor="Gold",edgethickness=3]);


GH:=CartesianProduct(G,H)
DrawGraph(GH,style=spring)

 

 

 

When I saw Wikipedia's demo diagram, https://en.wikipedia.org/wiki/Cartesian_product_of_graphs

I was fascinated,and I also wanted to visually reflect the nature of Cartesian product by doing different staining of vertices.
It is easy for me to dye the vertices in one color, but it is difficult for 
two different colors .

 

restart;

kernelopts(version);

`Maple 2020.1, X86 64 LINUX, Jul 30 2020, Build ID 1482634`

This one works as expected:

solve({x + y = 5, x - y = 3});

{x = 4, y = 1}

This one fails:

solve({x(0) + y(0) = 5, x(0) - y(0) = 3});

That shouldn't fail.  According to ?solve,details, under the Description

heading, it says that the unknown may be a name or a function.  Note that

type(x(0), function);

true

so there seems to be a contradiction.  Nevertheless, there is a workaround:

solve({x(0) + y(0) = 5, x(0) - y(0) = 3}, {x(0), y(0)});

{x(0) = 4, y(0) = 1}

 

Now try with fsolve().  This one works as expected:

fsolve({x + y = 5, x - y = 3});

{x = 4., y = 1.}

This one fails:

fsolve({x(0) + y(0) = 5, x(0) - y(0) = 3});

But the previous workaround does not help:

fsolve({x(0) + y(0) = 5, x(0) - y(0) = 3}, {x(0), y(0)});

I can temporarily rename the variables to plain symbols, or perhaps

freeze/thaw them.  But is there a simpler workaround?

 

 

Download fsolve-problem.mw

 

Maple's gamma constant appears to misbehave.

restart;

kernelopts(version);

`Maple 2020.1, X86 64 LINUX, Jul 30 2020, Build ID 1482634`

evalf(gamma);     # this one is expected

.5772156649

evalf(gamma(0));  # this one may be explained

.5772156649

evalf(gamma(1));  # how to explain this one?

-0.7281584548e-1

Things get more puzzling.  Let's declare gamma as local:

local gamma:

Warning, A new binding for the name `gamma` has been created. The global instance of this name is still accessible using the :- prefix, :-`gamma`.  See ?protect for details.

evalf(gamma);     # this is good

gamma

evalf(gamma(0));  # expected an unevaluated gamma(0) here!

.5772156649

evalf(gamma(1));  # expected an unevaluated gamma(1) here!

-0.7281584548e-1

 

Download gamma-puzzle.mw

 

Is there a way to prevent Maple from applying the product rule for exponents? That is, keep x*x as it is instead of automatically simplifying it to x^2. Or, alternatively, is there a way to decompose x^2 as x*x?

Moving to online learning has proved difficult to get any real 1 on 1 time or with my teachers around this question, and the help I have got hasn't helped me as yet. 

I understand that asking for homework help is probably frowned upon but I would appreciate any help, guidance or direction on how to answer the below in Maple2019. 

The general formula for a plane in the 3D space is z = ax + by + c, where a, b, c are the parameters. Alice encodes three English words to three numbers by using the Maple command "text2num". She then set up a (3,4) secret sharing scheme with the idea of the Blakley method. The four shares are four planes given by: 

z =   4x + 19y + 2515211725275120 (mod 2515211819051461)

z = 52x + 27y + 2515210613496048 (mod 2515211819051461)

z = 36x + 65y + 2515210981587340 (mod 2515211819051461)

z =   6x + 60y + 2515211676449260 (mod 2515211819051461).

Find the secret English words of Alice with Maple command 

I'm absolutely hitting a wall. The most I have found in the word "you".

Thanks in advance. 

Hi there.

It seems like a bug in modp1(('Rem')(...)) with large polynomials with large coefficients.

Please look at the file:

bug_rem.mw

It needs the file polys.m there:

https://dropmefiles.com/9fATR

File polys.m too big for this forum so I used dropmefiles.

Polys.m contain two polynomials x and f_t with large degrees: degree(f_t) = m = 50021, degree(x) = 2*m - 2 = 100040 and large coefficients up to 2^N, where N = ceil(m / 2)+2 = 25013.

I just compute rem(x,f_t) mod 2^N.

As you can see in the first part of doc bug_rem.mw I decreased coefficients of polynomials by additional mod 2^N (with Embed function), where N = floor(N / 2) = 12506. WIth these decreased polynomials and decreased N modp1(('Rem')(...)) function works well and use maximum about 2.5 Gb of RAM.

But in the second part of doc bug_rem.mw with original polynomials and N = 25013 modp1(('Rem')(...)) use maximum about 3.5 Gb of RAM and crash with error:

Error, Maple was unable to allocate enough memory to complete this computation.  Please see ?alloc
 

This is strange and looks like a bug considering that the test server has 48 Gb of RAM.

Is it a bug or modp1(('Rem')(...)) just need more than 48 Gb of RAM?

How many RAM it needs for this computation?

Thank you

I'm a new Maple user and wondering if anyone can explain how to plot vectors similar to this image.

 

I have seen examples of how to construct a plot with vectors (see example) but I do not want these bold arrows. A line with an arrowhead is clearer.

/Christer

First 13 14 15 16 17 18 19 Last Page 15 of 1740