Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I have a student who has a problem when closing and opening a Maple file.

It seems as if Maple turns math fields into text, but still execuse when using ! or !!!

The dark red part is written in a text field, but Maple still executes

I

If I try to write in a math field and executes, closes Maple and opens again, this does not happen, so it is not the file that is the problem.  The student is running 2024.2 version.

Can anyone explain the problem and how to solve it.

 

 

Update 

Also, is there a way to disable the use of remember tables permanently in Maple? This causes me so much trouble and It is cause of why Maple behave differently at different times.

Help shows how to do it if one knows the name of the module or procedure. But Maple has 1000's of these. There does not seem to be a way to tell maple

          forget(all)

and have set once. (may be something I can put in the ini file, to disable this feature).

At the end of help it says

"As a special case, specifying f as an empty range allows for selective clearing of remember table entries from all remember tables in the system.  This requires a second argument, to indicate which entries to clear. For example, forget(..,x), which will clear all remembered entries in the system that reference x.  "

But what is x in the above?? If I do forget(..) it does not work.

---- end update ------------------------------------------------------------------------------------------------------------------

Adding printlevel:=20, I see simplify generate/runs through longer code the first time. The second time calling the same exact simplify code, now it shows it runs through much shorter code. 

I am assuming printlevel is behaving correctly each time.

This must be due to cache simplifies keeps somewhere, or some internal settings it updates from first time and this is what causes it to do shorter run second time.

Without doing restart, how can make force simplify to run through same code it did the first time and each time? i.e. as if it was called the very first time each time?

I tried forget, but it is not doing anything.

Here is worksheet.  The code is simply this

printlevel:=0;
restart;
printlevel:=20;
simplify(3*x^3/x+sin(x^2)/4);  #long printout

simplify(3*x^3/x+sin(x^2)/4);  #short printout

printlevel:=0;
forget(simplify,forgetpermanent = true,reinitialize=true);

printlevel:=20;
simplify(3*x^3/x+sin(x^2)/4); #still same short printout

So there is something else needs to be cleared? Only way to get the long printout is to do restart. but ofcourse I can't do restart in middle of a loop.

I tried gc() also, but had no effect. 

What other commands are there to do this? I do use Physics and it is on my libname.

printlevel:=0;

0

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1849 and is the same as the version installed in this computer, created 2025, March 12, 12:37 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

printlevel:=20;

20

simplify(3*x^3/x+sin(x^2)/4);

{--> enter sin, args = x^2

{--> enter \`type/SymbolicInfinity\`, args = x^2

false

<-- exit \`type/SymbolicInfinity\` (now in sin) = false}

{--> enter \`sin/normal\`, args = x^2

{--> enter \`tools/sign\`, args = x^2

-x^2

1

<-- exit \`tools/sign\` (now in \`sin/normal\`) = 1}

1

-sin(x^2)

sin(x^2)

<-- exit \`sin/normal\` (now in sin) = sin(x^2)}

sin(x^2)

{--> enter \`trig/linear_in_Pi\`, args = x^2

{--> enter collect, args = x^2, Pi

{Pi}

{Pi}

{}

Pi

recursive

proc (x) options operator, arrow; x end proc

x^2

<-- exit collect (now in \`trig/linear_in_Pi\`) = x^2}

x^2

<-- exit \`trig/linear_in_Pi\` (now in sin) = x^2}

x^2

sin(x^2)

<-- exit sin (now at top level) = sin(x^2)}

{--> enter simplify, args = 3*x^2+(1/4)*sin(x^2)

false

{--> enter \`simplify/do\`, args = 3*x^2+(1/4)*sin(x^2)

{--> enter \`tools/membertype\`, args = Not(Or(algebraic, list, set, relation, range)), 3*x^2+(1/4)*sin(x^2)

false

<-- exit \`tools/membertype\` (now in \`simplify/do\`) = false}

{--> enter \`simplify/check_constant\`, args = 3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/check_constant\` (now in \`simplify/do\`) = false}

false

"top"

3*x^2+(1/4)*sin(x^2)

1

{}

{--> enter \`type/ratpoly\`, args = 3*x^2+(1/4)*sin(x^2), complex(numeric)

{x}

<-- exit \`type/ratpoly\` (now in \`simplify/do\`) = false}

{--> enter \`simplify/recurse\`, args = 3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/recurse\` (now in \`simplify/do\`) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

[]

table( [ ] )

{3*x^2+(1/4)*sin(x^2)}

{--> enter \`simplify/check_constant\`, args = 3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/check_constant\` (now in \`simplify/do\`) = false}

false

{--> enter \`simplify/getkernels\`, args = 3*x^2+(1/4)*sin(x^2), false

{x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}

<-- exit \`simplify/getkernels\` (now in \`simplify/do\`) = {x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}}

{x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}

{--> enter \`simplify/getinds\`, args = {x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}

{power, trig}

<-- exit \`simplify/getinds\` (now in \`simplify/do\`) = {power, trig}}

{power, trig}

{--> enter \`simplify/sortinds\`, args = {power, trig}

53

48

[[power, 53], [trig, 48]]

[trig, power]

[trig, power]

<-- exit \`simplify/sortinds\` (now in \`simplify/do\`) = [trig, power]}

[trig, power]

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

[trig, power]

1

`simplify/trig`

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2), [power]

`simplify/power`

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2), []

3*x^2+(1/4)*sin(x^2)

{--> enter \`simplify/check_constant\`, args = 3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/check_constant\` (now in \`simplify/do\`) = false}

false

{--> enter \`simplify/getkernels\`, args = 3*x^2+(1/4)*sin(x^2), false

{x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}

<-- exit \`simplify/getkernels\` (now in \`simplify/do\`) = {x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}}

{}

{--> enter \`type/ratpoly\`, args = 3*x^2+(1/4)*sin(x^2), extended_numeric

{x}

<-- exit \`type/ratpoly\` (now in \`simplify/do\`) = false}

{--> enter \`simplify/getinds\`, args = {x^2, (1/4)*sin(x^2), 3*x^2+(1/4)*sin(x^2), sin(x^2)}

{power, trig}

<-- exit \`simplify/getinds\` (now in \`simplify/do\`) = {power, trig}}

{--> enter \`simplify/sortinds\`, args = {power, trig}

53

48

[[power, 53], [trig, 48]]

[trig, power]

[trig, power]

<-- exit \`simplify/sortinds\` (now in \`simplify/do\`) = [trig, power]}

[trig, power]

{--> enter \`simplify/power_exp\`, args = 3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

false

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

true

<-- exit \`simplify/power_exp\` (now in \`simplify/do\`) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

{--> enter \`simplify/check_constant\`, args = 3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/check_constant\` (now in \`simplify/do\`) = false}

false

{--> enter \`simplify/do/content\`, args = 3*x^2+(1/4)*sin(x^2)

1/4, 12*x^2+sin(x^2)

<-- exit \`simplify/do/content\` (now in \`simplify/do\`) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

{--> enter \`simplify/recurse_on_constants\`, args = 3*x^2

3, x^2

<-- exit \`simplify/recurse_on_constants\` (now in \`simplify/do\`) = 3*x^2}

{--> enter \`simplify/recurse_on_constants\`, args = (1/4)*sin(x^2)

1/4, sin(x^2)

<-- exit \`simplify/recurse_on_constants\` (now in \`simplify/do\`) = (1/4)*sin(x^2)}

{--> enter \`simplify/recurse_on_constants\`, args = 3*x^2+(1/4)*sin(x^2)

0, 3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/recurse_on_constants\` (now in \`simplify/do\`) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/do\` (now in simplify) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

{--> enter simplify, args = 3*x^2+(1/4)*sin(x^2), size, applysimplifysize = false

{--> enter \`simplify/do\`, args = 3*x^2+(1/4)*sin(x^2), size

false

3*x^2+(1/4)*sin(x^2), size

2

{}

[`simplify/size`]

table( [ ] )

{3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

<-- exit \`simplify/do\` (now in simplify) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

<-- exit simplify (now in simplify) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

<-- exit simplify (now at top level) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

simplify(3*x^3/x+sin(x^2)/4);

value remembered (at top level): sin(x^2) -> sin(x^2)

{--> enter simplify, args = 3*x^2+(1/4)*sin(x^2)

false

value remembered (in simplify): \`simplify/do\`(3*x^2+(1/4)*sin(x^2)) -> 3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

{--> enter simplify, args = 3*x^2+(1/4)*sin(x^2), size, applysimplifysize = false

3*x^2+(1/4)*sin(x^2)

<-- exit simplify (now in simplify) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

<-- exit simplify (now at top level) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

printlevel:=0;
forget(simplify,forgetpermanent = true,reinitialize=true);

0

printlevel:=20;

20

simplify(3*x^3/x+sin(x^2)/4);

value remembered (at top level): sin(x^2) -> sin(x^2)

{--> enter simplify, args = 3*x^2+(1/4)*sin(x^2)

false

value remembered (in simplify): \`simplify/do\`(3*x^2+(1/4)*sin(x^2)) -> 3*x^2+(1/4)*sin(x^2)

3*x^2+(1/4)*sin(x^2)

{--> enter simplify, args = 3*x^2+(1/4)*sin(x^2), size, applysimplifysize = false

3*x^2+(1/4)*sin(x^2)

<-- exit simplify (now in simplify) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

<-- exit simplify (now at top level) = 3*x^2+(1/4)*sin(x^2)}

3*x^2+(1/4)*sin(x^2)

 

 

Download how_to_clear_simplify_cache_march_24_2025.mw

Anyone has Maple 2025 could check if same behaviour there also?

How to I generate and or export a plot without a white border or equivalently , just  the information inside the axes?

See example. Note that when I insert the content below, it fails to accurately copy the information( blue background). If you look at the attached maple file, it should be very clear what I'm after.

kill_plot_border_on_plot_generation_or_export.mw

restart

NULL

How do I make and export a plot without the white border or background? I want my export to only contain information inside the blue region.
 

plot(x^2, x = 0 .. 3, background = "Blue", axes = none)

plot(x^2, x = 0 .. 3, background = "Blue", axes = none)

 

 

When looking at the exported image you see that there is a white border around the blue region.

NULL

NULL

NULL

Download kill_plot_border_on_plot_generation_or_export.mw

Using the attached problem, I want to calculate a term with a constraint that m is not equal to n. How do I insert general constraints into Maple?

test.mw

Hi,

I'm working on formatting my tables for export to PDF. Is there a way to align the text in the cells (to the left, for example)?

Thanks

GenerateSimilar_Ala.mw

I do not understand why select(has,-a^2,x); returns 1 but select(has,a^2,x); returned undefined.

Should not both return undefined, since there is no anywhere in the expression?

I looked at help and do not see a clue so far.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1849 and is the same as the version installed in this computer, created 2025, March 12, 12:37 hours Pacific Time.`

restart;

C:=a^2;
select(has,C,x);

a^2

undefined

C:=-a^2;
select(has,C,x);

-a^2

1

 

 

Download select_question_march_23_2025.mw

Here is another variation, where I changed a^2 to a

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1849 and is the same as the version installed in this computer, created 2025, March 12, 12:37 hours Pacific Time.`

restart;

C:=a;
r:=select(has,C,x);

a

C:=-a;
r:=select(has,C,x);

-a

1

 

 

Download select_question_v2_march_23_2025.mw

The good thing is that has(C,x) returns false in both case. So the problem is not with the has call. It is select which decided to return 1 when there is negative sign. But why?

restart;

C:=a;
r:=has(C,x);

a

false

C:=-a;
r:=has(C,x);

-a

false

 

 

Download select_question_v3_march_23_2025.mw

a lot of time i have this issue when i want delete something it take a lot time to show the in this worksheet it happen too what is issue it is becuase all the text are not in text modde or what? and when i want copy and past my function to place with text is write null for me, what is problem?
and why in end of my display there is two graph?

2-line-label-done.mw

Trying to use plot to connect a series of points for illustrative purposes, but the functionality seems to have broken in 2024 or else I'm overlooking something. Related/unrelated: When I copy the related code from the cell and paste it into another application (like a browser) the list of points is reversed: e.g. `

plot({[-1, -2], [-1, 1], [-1, 6], [3, -2], [3, 6]}, x = -3 .. 4, y = -4 .. 10, style = line)` 

(That was literally me copy and pasting the relevant code from Maple into this form.)

The plot in question can be seen below. Also to note, if I leave off the last [3,-2] point, it will correctly plot the graph. It's ony when I add in that last point that I suddenly get the shape I do below. 

In 1-D Math, subscripts can be found with crtl-F

In 2-D Math this does not work. 

Also powers of (^) cannot be searched in 2D-Math.

Are there any ways to perfom searches on subscripts or superscripts in 2-D Math?

Hi MaplePrimes,
I made a quick code to calculate Aliquot Sequences.

The code works.

I was inspired by a Numberphile YouTube video.

see

aliquot_sequence_cut_1.mw

aliquot_sequence_cut_1.pdf

This should be helpful.

Regards,

Matt

LIMITS

Limits in maths are defined as the values that a function approaches the output for the given input values. Limits play a vital role in calculus and mathematical analysis and are used to define integrals, derivatives, and continuity. It is used in the analysis process, and it always concerns the behavior of the function at a particular point. The limit of a sequence is further generalized in the concept of the limit of a topological net and related to the limit and direct limit in the theory category. Generally, the integrals are classified into two types namely, definite and indefinite integrals. For definite integrals, the upper limit and lower limits are defined properly. Whereas indefinite integrals are expressed without limits, and it will have an arbitrary constant while integrating the function.

Sometimes we can't work something out directly ... but we can see what it should be as we get closer and closer!

Example 1

"restart;  f(x):=(|x|-3)/(x-3);"

proc (x) options operator, arrow, function_assign; (abs(x)-3)/(x-3) end proc

(1)

plot(f(x), x = -10 .. 10, discont = true, color = "Green")

 

f(3)

Error, (in f) numeric exception: division by zero

 

Now 0/0 is a difficulty! We don't really know the value of 0/0 (it is "indeterminate"), so we need another way of answering this.

So instead of trying to work it out for x=3 let's try approaching it closer and closer:

f(3.01)

1.000000000

(2)

f(3.0000001)

1.000000000

(3)

f(2.9999999)

1.000000000

(4)

Limit(f(x), x = 3)

Limit((abs(x)-3)/(x-3), x = 3)

(5)

limit(f(x), x = 3)

1

(6)

limit(f(x), x = 3, left)

1

(7)

limit(f(x), x = 3, right)

1

(8)

Example 2

Sometimes some functions are not continuous. That is, they appear to be approaching two different values when they are approached from two sides.

"g(x):=piecewise(0<x<2,1/(2 x-x^(2)),2 <x<=3,2 -x,3<x<4,x-4, 4<=x,Pi,undefined);"

proc (x) options operator, arrow, function_assign; piecewise(0 < x and x < 2, 1/(2*x-x^2), 2 < x and x <= 3, 2-x, 3 < x and x < 4, x-4, 4 <= x, Pi, undefined) end proc

(9)

plot(g(x), x = -10 .. 10, y = -1 .. 10, discont = true, color = "Red")

 

Suppose we want to approach 2 and see the function’s limit. This naturally leads to directions from which we can approach. Left-hand side and the right-hand side limits.

The right-hand side limit is the value of the function that it takes while approaching it from the right-hand side of the desired point. Similarly, the left-hand side limit is the value of function while approaching it from the left-hand side.

eval(g(x), x = 2)

undefined

(10)

limit(g(x), x = 2, left)

infinity

(11)

limit(g(x), x = 2, right)

0

(12)

limit(g(x), x = 2)

undefined

(13)

And the ordinary limit "does not exist".

g(4)

Pi

(14)

limit(g(x), x = 4, left)

0

(15)

limit(g(x), x = 4, right)

Pi

(16)

limit(g(x), x = 4)

undefined

(17)

And the ordinary limit "does not exist".

with(Student[Calculus1]); LimitTutor()

Example 3

Estimate the value of the following limit limit(h(x)*where, x = 2), h(x) = piecewise(x <> 2, x+12, x = 2, 4).

"h(x):={[[x+12,x<>2],[4,x=2]];"

proc (x) options operator, arrow, function_assign; piecewise(x <> 2, x+12, x = 2, 4) end proc

(18)

plot(h(x), x = -10 .. 10, discont = true, color = "#40e0d0")

 

limit(h(x), x = 2)

14

(19)

The limit is NOT 2025!Remember from the first example that limits do not care what the function is actually doing at the point in question. Limits are only concerned with what is going on around the point. Since the only thing about the function that we actually changed was its behavior at x = 2 this will not change the limit.

Example 4

" w(x):=piecewise( x<0,-x+5,x>=0,2 x);"

proc (x) options operator, arrow, function_assign; piecewise(x < 0, -x+5, 0 <= x, 2*x) end proc

(20)

plot(w(x), x = -10 .. 10, y = -10 .. 10, discont = true, color = "Blue")

 

limit(w(x), x = 5)

10

(21)

limit(w(x), x = 6, left)

12

(22)

limit(w(x), x = 1, right)

2

(23)

Example 5

" k(x):=piecewise( x<5,x+4,x>=5, x^(2)-2);"

proc (x) options operator, arrow, function_assign; piecewise(x < 5, x+4, 5 <= x, x^2-2) end proc

(24)

plot(k(x), x = -10 .. 10, discont = true, color = orange)

 

limit(k(x), x = 2)

6

(25)

limit(k(x), x = 5, left)

9

(26)

limit(k(x), x = 5, right)

23

(27)

limit(k(x), x = 5)

undefined

(28)

limit(k(x), x = 6)

34

(29)

Example 6

restart

" l(x):=piecewise( x<=1,(x-8)/(x-3),x>=3, sqrt(x^(2)+x+2), undefined);"

proc (x) options operator, arrow, function_assign; piecewise(x <= 1, (x-8)/(x-3), 3 <= x, sqrt(x^2+x+2), undefined) end proc

(30)

plot(l(x), x = -10 .. 10, discont = true, color = "Blue")

 

limit(l(x), x = 0)

8/3

(31)

limit(l(x), x = 1, left)

7/2

(32)

limit(l(x), x = 1, right)

undefined

(33)

limit(l(x), x = 2)

undefined

(34)

Example 7

Estimate the value of the following limit. limit(H(t), t = 0)where, H(t) = piecewise(t < 0, 0, t >= 0, 1)

"  H(t):=piecewise( t<0,0,t>=0, 1);"

proc (t) options operator, arrow, function_assign; piecewise(t < 0, 0, 0 <= t, 1) end proc

(35)

This function is often called either the Heaviside or step function. We could use a table of values to estimate the limit, but it’s probably just as quick in this case to use the graph so let’s do that. Below is the graph of this function.

plot(H(t), t = -10 .. 10, discont = true, color = "Blue")

 

limit(H(t), t = 0, left)

0

(36)

limit(H(t), t = 0, right)

1

(37)

We can see from the graph that if we approach t = 0from the right side the function is moving in towards a yvalue of 1. Well actually it’s just staying at 1, but in the terminology that we’ve been using in this section it’s moving in towards 1.

Also, if we move in towards t = 0 from the left the function is moving in towards a yvalue of 0.

According to our definition of the limit the function needs to move in towards a single value as we move in towards t = a (from both sides). This isn’t happening in this case and so in this example we will also say that the limit doesn’t exist.

 

NULL

Download limits.mw

i did plot without reducing the decimal but when i reduce to 2 decimal this error is showing up How i fix this issue?
plot.mw

Looking back at this question:

https://www.mapleprimes.com/questions/37691-How-Do-I-Change-The-Background-Colour

the reply by Hmm in 2009

"In Linux there is an X11 resource file for the classic worksheet, one of the settings controls the background color.  The distributed file is located in the maple/X11_defaults directory."

suggested a solution only thiis does not work for me in Maple2024. Perhaps because this worked for the classic view.

Why is there still no way to do this after 16 years or perhaps I just cannot find the option?

Is there away to change the background colour or even invert all colours?

I occasionally find myself inexplicably in a region of my worksheet that does not respond to my editing, fe.g., I cannot erae or I cannot copy. I recently typed a command-there was an error of some form and I tried unsuccessfully to edit it. Then I tried to copy the code and enter it at a prompt. It refused to enter it at the prompt but copied it below the prompt in a strnge region that I do not understand. When I retyped the command at a prompt it worked fine. I do not understand th dead regions that pop up mysteriously. (I am using Maple 2024 on a Mac) The page is too long to copy but I could upload it if given directions.

1 2 3 4 5 6 7 Last Page 1 of 2191