Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I need some command that simplifies the exponentials (or a series of commands) so that there is no power over power.

What's happening (exp(k))^2

What do I need exp(2k)

What would be the most appropriate method? Below is a photo of my code

Where can I find a tutor on Maples ??? I need a tutor on maple i am on graduate engineering  contat me anyone can help 

So I have a complex-valued function f that depends on two real variables x and y. I want to plot its range, i.e. the set of all values f(x,y), where x and y vary over their entire domain (which is a compact subset of R^2). Since I did not find of a direct way to do this, I decided to just compute the output f(x,y) at a finite set of points and plot these values in the complex plane. This gives me a rough idea of what the range should look like. However, this process is very slow (even though it should not be that slow, in my opinion). Here is the code I have used:

f := x -> exp(2*I*Pi*x);
S1 := (x, y) -> Matrix(3, 3, [[f(x - y), 0, 0], [0, 1, 0], [0, 0, f(-y)]]);
S2 := (x, y) -> Matrix(3, 3, [[f(y), 0, 0], [0, f(y - x), 0], [0, 0, 1]]);
C := Typesetting[delayDotProduct](1/sqrt(3), Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]), true);
with(LinearAlgebra);
d := LinearAlgebra[Determinant](C . C);
V := (x, y) -> (((S1(x, y)/d^(1/3)) . C) . (S2(x, y))) . C;
tracevals := [];

for i from 0 to 100 do
    for j from 0 to 100 do tracevals := [op(tracevals), Trace(V(0.01*i, 0.01*j))]; end do;
end do;
with(plots);
P2 := complexplot(tracevals, x = -2 .. 3, y = -3 .. 3);

Note that the specific example (i.e. plotting the trace of a unitary matrix V(x,y)) is not really important to this question. We could instead think of any complex-valued function f(x,y), it should not have any impact on the problem. Maple generates the following output:

Even though this output shows quite well the range that the function will take, it takes almost two minutes to generate. Is there a quicker or more elegant way to compute the range of a function?

We just switched to a new Antivirus program (Bitdefender), and we are getting a bunch of security warnings because of outdated software.

I do have  a couple of those for my PC, e.g. some regarding Apache. I don't have Apache installed on my PC, but I think Maple does use it.

So I wonder which policy Maple has regarding updating its open source libraries.

A quick review on Maple Help - copyright information shows a couple of Open Source licenses code which seems to be delivered in old versions.

Bitdefender classifies them with a high security risk.

I am working with a family of unitary matrices, that depend on two parameters x and y in a smooth way. Their eigenvalues are thus complex numbers of absolute value 1. My goal is to plot the bands (i.e. the argument of the eigenvalues). I know that there exists a parametrization of the eigenvalues such that the corresponding bands are continuous. In particular, I use the following code:

f := x -> exp(2*I*Pi*x);
S1 := (x, y) -> Matrix(3, 3, [[f(x - y), 0, 0], [0, 1, 0], [0, 0, f(-y)]]);
S2 := (x, y) -> Matrix(3, 3, [[f(y), 0, 0], [0, f(y - x), 0], [0, 0, 1]]);
C := Typesetting[delayDotProduct](1/sqrt(3), Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]), true);
d := LinearAlgebra[Determinant](C . C);
V := (x, y) -> (((S1(x, y)/d^(1/3)) . C) . (S2(x, y))) . C;
with(LinearAlgebra);
bands := (x, y) -> -I*ln~(Eigenvalues(V(x, y)));

with(plots);
plot3d({bands(x, y)[1], bands(x, y)[2], bands(x, y)[3]}, x = 0 .. 1, y = 0 .. 1);

However, the output is the following plot:

One can see that the bands can technically be chosen in a way such that they are continuous and we dont have those weird vertical jumps. Is there a way to make Maple choose them like this? Or is there a way to at least surpress these vertical jumps in the plot, so that the plot is a bit more ordered? Ideally I would like a way that works for more examples than the one I gave above (I'd like to do these plots for different matrices C), but any help is appreciated!

 

Edit: Maybe an easier starting point is the following: If I choose the matrix C to be the identity matrix, the bands are of a nicer form:

We can see that Maple parametrizes the bands in a continuous way. The only problem is the vertical jumps that happen when the argument switches from pi to -pi. Is there a way to avoid plotting these jumps, so the plot does not include these vertical lines?

Is it possible to add a label to a plot output? 

Hello,

New user of Maple, new to this MaplePrimes.

I am working with the following code taken from this help file.

In particular, I am studying the section "Techniques for solving a non-linear two-point BVP" towards the end.

Here is the initial setup of the code that puts the code I am finding challenging into context:

restart;
ode := diff(y(x),x,x) + (y(x))^2*diff(y(x),x) + cos(y(x)) = x;
bc1 := (1 + y(0))*D(y)(0) - 3*y(0) = 0;
bc2 := (1 + y(1))*D(y)(1) - 3*y(1) - (y(1))^2 + 0.5 = 0;

The code I am struggling with is as follows.

h:=proc(a,b)
  local F;
  Digits := 10;
  if type(a,numeric) and type(b,numeric) then
    F:=dsolve({ode,y(0)=a,D(y)(0)=b},y(x),numeric);
    [rhs(F(1)[2],rhs(F(1)[3])];
  else 'h'(a,b);
  end if;
end proc:

Could someone please kindly explain to me what the underlying purpose is of the if.. then.. else conditions written into the procedure code? It is clearly necessary, because if I remove it then the code does not work. I can see that, were we to just run some instruction like h(1,3) then none of this woud be necessary. The value of a is set to 1, the value of b is set to 3, both of these values are numeric and the procedure can run the dsolve operation and spit out the list as determined by the contents of F(1).

But this procedure is being used to ultimately construct an implicit plot (see below), and without the extra conditional statements the code does not work. So, how does the way the code is structred get around  the problem?

I have difficulty understanding the Maple environment regarding using quotes to delay evaluation. I have read a lot of information, but at the moment I have confused myself more and more.

I guess the best explanation to help me would be if someone were to describe to me what I am getting/needing/expecting if I were actually the Maple software myself running the code. How does the absence of the conditional statements mess things up for me? How is it rescued by these statements?  The 'h'(a,b) really has me scratching my head. What does Maple do when a and b are not numeric? Do a and b start off not being numeric? When do they become numeric? 

For clarity, following the help pages, th procedure is to be implemented as follows. First, two more procedures are created, one which involves h.

BC1 := proc(a,b)
  (1 + a)*b - 3*a
end proc;
BC2 := proc(a,b)
  (1 + h(a,b)[1])*h(a,b)[2] - 3*h(a, b)[1] - h(a,b)[1]^2 + 0.5
end proc;

And then the set of points (a,b) is to be plotted which simultaneously satisfy BC1=0 and BC2=0.

with(plots):
implicitplot([BC1(a,b)=0,BC2(a,b)=0], a=-5..1, b=-11..7, color=[black,red], 
  legend=["BC1(a,b)=0","BC2(a,b)=0"]);

Thanks for any help anyone can provide. The explanation needs to start off in simple terms - my head is spinning from all of the Maple descriptions in Maple terms and jargon.  I'm not getting a foot in the door that way.

Best wishes

Mikey

Here is an example without assumptions that should return false for complex numbers (IMO)

prp := cos(z)/abs(cos(z)) - abs(cos(z))/cos(z) = 0:
is(prp);
                              true

For comparision: simplify requires restriction to the real domain

simplify(prp);
(simplify(prp) assuming real);
                          2                    
                 -|cos(z)|  sec(z) + cos(z)    
                 -------------------------- = 0
                          |cos(z)|             

                             0 = 0

This only makes sense if is(...) assumes real or I am wrong with complex numbers and simplify should simplify this expression without assumptions.

Hello sir

I am new to here

I am not familear with maple can i solve the pde in maple software and get the plots and tabular values which are mentioned in the below given pdf

The final equation (12-19) of the pdf to solve and get the plots like below mentioned figure number

Figure 4,17 and 23 one sample graphs 

With table 2 values. Basha-2023-Keller-box-computation-for-entropy

I heared about maple recently in reseach gate. It is friendly user.

Please tell me how to get the above mentiond values and plots.

There are two opposing commands remove and select in Maple. According to the main help page, StringTools:-RegSplit effectively implies the removal (i.e., capturing substrings that does not match the given pattern), but for extracting the matching parts of the input string (e.g., this example from MatLab), where is the command to carry out the selection?
At present I can do something like 

use StringTools in RegFilter := (p::string, s::string) -> select[2](RegMatch, sprintf("^%s$", p), (op@NGrams)~(s, [`$`](Length(s)))) end:
RegFilter("a.+b", "aabbbaaabb");
 = 
 ["aab", "abb", "aab", "abb", "aabb", "abbb", "aaab", "aabb", 

   "aabbb", "aaabb", "abbbaaab", "aabbbaaab", "abbbaaabb", 

   "aabbbaaabb"]


This is essentially equivalent to letting the matcher keeps starting at the same position until no more new matches are found, while sometimes we just need the matcher to continue the shortest-match testing at the character following the last matched substring after finding a match:

For instance, `RegFilter("a.+?b", "aabbbaaabb", 'overlapped'=⁇);` should return:
⒈`["aab", "aaab"]`,
⒉`["aab", "abb", "aaab", "aab", "abb"]`, or
⒊`["aab", "aabb", "aabbb", "aabbbaaab", "aabbbaaabb", "abb", "abbb", "abbbaaab", "abbbaaabb", "aaab", "aaabb", "aab", "aabb", "abb"]`?

Another disadvantage of it is that it is too inefficient. Considering the following regular expression which matchs email-like strings

sample := Import("https://github.com/mariomka/regex-benchmark/raw/optimized/input-text.txt"): # length:
time[real]((remnants := StringTools:-RegSplit("[a-zA-Z_0-9\\.+-]+@[a-zA-Z_0-9\\.-]+\\.[a-zA-Z_0-9\\.-]+", sample)));
 = 
                             3.157

while if I execute the analogous “timelimit(60, time(RegFilter("[a-zA-Z_0-9\\.+-]+@[a-zA-Z_0-9\\.-]+\\.[a-zA-Z_0-9\\.-]+", sample)));”, Maple will end up running out of memory.

So, where is the StringTools:-RegFilter functionality? Or can we construct those matched cases from remnants and the original text?

Hey my maple document will not open up! When I try to open it, it simply asks me if I want to open my document as maple text, plain text, maple input or simply cancel. No matter which of the options I select the document will just be blank. If anyone can fix it then please help me! I really really need the document since all my notes are in there. I have attached the document to this post.

regards chri69a9

Download Notes_to_Introduction_to_Probability_Theory.mw

Notes_to_Introduction_to_Probability_Theory.mw

I noticed that when I enter an equation into Maple, Greek symols change to English equivalents after a couple of days. E.g. Gamma becomes G , Pi becomes p, but not for all characters.

I haven't noticed any similar effects on mathematical characers or operators, or any other symbols.

RH

I am asking this beacuse I am rusty on using animate in plots. Just trying to show the line segment moving.

restart

with(plottools); with(plots)

Trvl := Matrix(5, 18, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 2, (1, 4) = 3, (1, 5) = 4, (1, 6) = 5, (1, 7) = 6, (1, 8) = 7, (1, 9) = 8, (1, 10) = 9, (1, 11) = 10, (1, 12) = 11, (1, 13) = 12, (1, 14) = 13, (1, 15) = 14, (1, 16) = 15, (1, 17) = 16, (1, 18) = 17, (2, 1) = 25.00000000, (2, 2) = 25.62348980, (2, 3) = 26.24697960, (2, 4) = 26.87046941, (2, 5) = 27.49395921, (2, 6) = 28.11744901, (2, 7) = 28.81795052, (2, 8) = 29.70796779, (2, 9) = 30.69482490, (2, 10) = 31.66997559, (2, 11) = 32.64189447, (2, 12) = 33.63901734, (2, 13) = 34.59934793, (2, 14) = 35.46317753, (2, 15) = 36.17679740, (2, 16) = 36.69583812, (2, 17) = 36.98802824, (2, 18) = 37.03520080, (3, 1) = 9.50000000, (3, 2) = 10.28183148, (3, 3) = 11.06366296, (3, 4) = 11.84549445, (3, 5) = 12.62732593, (3, 6) = 13.40915741, (3, 7) = 14.11748988, (3, 8) = 14.56318511, (3, 9) = 14.69313898, (3, 10) = 14.49329251, (3, 11) = 14.26929209, (3, 12) = 14.29271187, (3, 13) = 14.56209574, (3, 14) = 15.06069470, (3, 15) = 15.75750830, (3, 16) = 16.60921202, (3, 17) = 17.56285107, (3, 18) = 18.55913279, (4, 1) = 26.55872458, (4, 2) = 27.18221431, (4, 3) = 27.80570411, (4, 4) = 28.44091912, (4, 5) = 29.26771501, (4, 6) = 30.27132826, (4, 7) = 31.26754127, (4, 8) = 32.19797655, (4, 9) = 33.15526524, (4, 10) = 34.16855668, (4, 11) = 35.08363639, (4, 12) = 35.87210441, (4, 13) = 36.48493760, (4, 14) = 36.88403298, (4, 15) = 37.04457671, (4, 16) = 36.95658698, (4, 17) = 36.62553455, (4, 18) = 36.06730316, (5, 1) = 11.45457880, (5, 2) = 12.23641019, (5, 3) = 13.01824167, (5, 4) = 13.79066482, (5, 5) = 14.38908368, (5, 6) = 14.67833203, (5, 7) = 14.61699479, (5, 8) = 14.33989949, (5, 9) = 14.25015666, (5, 10) = 14.40907532, (5, 11) = 14.80585186, (5, 12) = 15.41668792, (5, 13) = 16.20360467, (5, 14) = 17.11767545, (5, 15) = 18.10206776, (5, 16) = 19.09557685, (5, 17) = 20.03643114, (5, 18) = 20.86416514})

_rtable[36893489645234278260]

(1)

display(seq(line([Trvl[2, i], Trvl[3, i]], [Trvl[4, i], Trvl[5, i]], color = green), i = 1 .. 18))

 

animate(line([Trvl[2, i], Trvl[3, i]], [Trvl[4, i], Trvl[5, i]], color = green), i = 1 .. 18)

Error, bad index into Matrix

 

NULL

Download 23-11-03_Q_Animate_a_line.mw

Please Help.

I have solve this problem in Runge-Kutta Method but i'm getting error.Can you solve this in RK Method or How to give a code for Shooting Method.

Here is my code.

 HNF1.mw

Dear maple users,

i want to solve these 4 difference scheme equations to calculate the values of U,V,C,T and plot the graphs i verse U by fixing the values

i:=1,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+(U[i, j,m]/(2*DX))*(C[i, j,m+1]-C[i-1, j,m+1]+C[i, j,m]-C[i-1, j,m])+(V[i, j,m]/(4*DR))*(C[i, j+1,m+1]-C[i, j-1,m+1]+C[i, j+1,m]-C[i, j-1,m])=(1/(2*Sc*(DR)^2))*(C[i, j-1,m+1]-2*C[i, j,m+1]+C[i, j+1,m+1]+C[i, j-1,m]-2*C[i, j,m]+C[i, j+1,m])+(1/(4*Sc*DR*(1+(j-1)*DR)))*(C[i, j+1,m+1]-C[i, j-1,m+1]+C[i, j+1,m]-C[i, j-1,m]):

First 9 10 11 12 13 14 15 Last Page 11 of 2072