MaplePrimes Questions

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 implements the removal (i.e., capturing substrings that does not match the given pattern), but as regards 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"]


Nevertheless, there exist at least two disadvantages to it.

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

For instance, there should be three flags in “RegFilter("a.+?b", "aabbbaaabb", 'overlapped'=⁇);”: 
⒈“["aab", "aaab"]” (selection with no overlap), 
⒉“["aab", "abb", "aaab", "aab", "abb"]” ( with partial overlaps), and 
⒊“["aab", "aabb", "aabbb", "aabbbaaab", "aabbbaaabb", "abb", "abbb", "abbbaaab", "abbbaaabb", "aaab", "aaabb", "aab", "aabb", "abb"]” ( with full overlaps). 

Unfortunately, the  above can only handle the last mode.

Another disadvantage is its inefficiency. Considering the following regular expression which matchs email-like strings

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

So Maple is capable of completing this removal within 4 seconds, yet if I execute the analogous

timelimit(60, time[real](RegFilter(re, sample))); 

Maple will end up running out of memory.

In view of these, where is the generic StringTools:-RegFilter functionality? Or can we construct those matched cases from  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,Sc:=2,Gr:=5,Gc:=10,DX:=0.02;DR:=0.2,Dt:=:=0.01:m:=7.44,7.88 where ,j=0..5;

eq1[i,j,m]:=(1/(4*DX))*(U[i, j-1,m+1]-U[i-1, j-1,m+1]+U[i,j,m+1]-U[i-1, j,m+1]- U[i-1, j-1,m]+U[i, j,m]-U[i-1, j,m])+(1/(2*DR))*(V[i, j,m+1]-V[i, j-1,m+1]+V[i, j,m]-V[i, j-1,m])+(1/(1+(j-1)*DR))*(V[i, j,m+1]):

eq2[i,j,m]:=(1/Dt)*(U[i, j,m+1]-U[i, j,m])+(U[i, j,m]/(2*DX))*(U[i, j,m+1]-U[i-1, j,m+1]+U[i, j,m]-U[i-1, j,m])+(V[i, j,m]/(4*DR))*(U[i, j+1,m+1]-U[i, j-1,m+1]+U[i, j+1,m]-U[i, j-1,m])=(Gr/2)*(T[i, j,m+1]+T[i, j,m])+(Gc/2)*(C[i, j,m+1]+C[i, j,m])+(1/(2*(DR)^2))*(U[i, j-1,m+1]-2*U[i, j,m+1]+U[i, j+1,m+1]+U[i, j-1,m]-2*U[i, j,m]+U[i, j+1,m])+(1/(4*DR*(1+(j-1)*DR)))*(U[i, j+1,m+1]-U[i, j-1,m+1]+U[i, j+1,m]-U[i, j-1,m]):

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

I want to report a bug.

This was possible in MaplePrimes but I cannot find the option software change request (if i remember correctly) any more. Hast this option moved or been removed?

systems of Nonlinear equations : 

EQ1 := 0.6250000000e-3*Omega^2*R[2]^6+0.4500000000e-2*Omega^2*R[2]^4+(Omega^4-1.9919*Omega^2+1)*R[2]^2-0.225e-1*Omega^2*R[1]^2 = 0;
EQ2 := (.2916*Omega^6+0.225e-1*U^2)*R[1]^6+(-0.9936e-1*Omega^4*U^2+1.296*Omega^4*U-1.20*Omega^2*U^2+1.20*U^2)*R[1]^4+(16*Omega^4*U^2+0.8464e-2*Omega^2*U^4-.2208*Omega^2*U^3-30.56*Omega^2*U^2+16*U^2)*R[1]^2-2.56*U^2*R[2]^2 = 0;
EQ3 := 0.3164062500e-4*Omega^2*R[1]^8+0.1687500000e-2*Omega^2*(-Omega^2+1)*R[1]^6+0.225e-1*Omega^2*(-Omega^2+1)^2*R[1]^4-0.3600e-2*Omega^2*R[1]^2*R[2]^2+.16*(Omega^2-1)^2*R[2]^4 = 0;

Please, I would like writing the pochhammer's symbols or rising factorials in a nice way.

Trying

nicepo:=(a,b)->(a)[b];

apparently works, however the output of

substitute(pochhammer=nicepo,pochhammer(1/2,n));

is nicepo(1/2,n), and not the output I would like, namely (1/2)[n].

Is there a way of getting the output I want?

May be someone could help me understand the logic that Maple goes through in this example.

restart;
ode:=diff(y(x), x) = sqrt(y(x))*sin(x);
dsolve([ode,y(0)=0]);
dsolve([ode,y(0)=0],'implicit');

For first dsolve it returns y(x)=0 and for the second it returns what is expected which is sqrt(y(x)) + cos(x)/2 - 1/2 = 0

Why this difference in result? Just trying to understand the logic behaind it. 

Maple 2023.1 on windows 10

``

restart;

ode:=diff(y(x), x) = sqrt(y(x))*sin(x);
dsolve([ode,y(0)=0]);
dsolve([ode,y(0)=0],'implicit');

diff(y(x), x) = y(x)^(1/2)*sin(x)

y(x) = 0

y(x)^(1/2)+(1/2)*cos(x)-1/2 = 0

 

Download why_dsolve.mw

Hi, how can I apply classic geometric transformations (rotation, scaling, reflection, etc.) to an imported photo? For example, with this image

Thanks

The document block (copied from a larger document) in the attached file could be executed with Maple 2022 (in the larger document).

Maple 2023 evaluates... that I have to interrupt.

On my installation I cannot convert the block to 1d input to investigate for hidden characters. This works in 2022.

Trying to manipulate (splitting, cutting, ...) the block lead several times to the 2023 GUI not responding normally which required Maple restart.

What I found with Maple 2022 and lprint: There is a ndash character here

Ein Bild, das Text, Schrift, Reihe enthält.

Automatisch generierte BeschreibungEin Bild, das Schrift, Reihe, Handschrift, weiß enthält.

Automatisch generierte Beschreibung

which must be deleted in the attached file. The larger document does not lprint a ndash. So this might be a copy/paste artefact and is perhaps unrelated to the evaluation problem with 2023.

With Maple 2023 there is no ndash but the output looks differentEin Bild, das Schrift, Diagramm, Reihe, Design enthält.

Automatisch generierte Beschreibung

The whole thing is perhaps related to this

Can someone reproduce and/or help?


 

interface(version)

`Standard Worksheet Interface, Maple 2023.1, Windows 10, July 7 2023 Build ID 1723669`

(1)

exp(`–`((1/2)*x^2)-(1/2)*y^2)/(2*Pi)

(1/2)*exp(-(1/2)*x^2-(1/2)*y^2)/Pi

(2)

`if`(evalf((1/2)*exp(-(1/2)*x^2-(1/2)*y^2)/Pi) < 0.7957747150e-1, (1/2)*exp(-(1/2)*x^2-(1/2)*y^2)/Pi, NONE); p3 := plot3d(%, x = -3 .. 3, y = -3 .. 3, color = blue); `if`(evalf((1/2)*exp(-(1/2)*x^2-(1/2)*y^2)/Pi) < 0.2153927929e-1, (1/2)*exp(-(1/2)*x^2-(1/2)*y^2)/Pi, NONE); p4 := plot3d(%+0.1e-3, x = -3 .. 3, y = -3 .. 3, color = red)

Warning,  computation interrupted

 

NULL


 

Download plot3d_in_2023_not_working.mw

First 156 157 158 159 160 161 162 Last Page 158 of 2427