C_R

3752 Reputation

21 Badges

6 years, 221 days

MaplePrimes Activity


These are questions asked by C_R

Here is another case where an incorrect solution of a non-algebraic expression is returned.

How to make Maple exclude solutions obtained with allsolutions where the expression is not defined?

IMO, allsolutions facilities of Maple should do this automatically. Anything from a mathematical point of view that speaks against an automatic exclusion?

(Are there other commands that provide a correct solution?)

By the way:

solve(sin(x)/x)

does not return a single solution as stated on the solve help page ("In general for transcendental equations, the solve command returns only one solution,...") because solve correctly discards x=0 but does not consider returning x=pi.

restart

expr := sin(x)/x

sin(x)/x

(1)

The above expression is not defined at x = 0

Eval(expr, x = 0)

Eval(sin(x)/x, x = 0)

(2)

value(Eval(sin(x)/x, x = 0))

Error, (in value/Eval) numeric exception: division by zero

 

Roots of the expression with RootOf

sol := allvalues(RootOf(expr))

Pi*_Z1

(3)

indets(sol)

{_Z1}

(4)

about({_Z1}[])

Originally _Z1, renamed _Z1~:
  is assumed to be: integer
 

 

getassumptions({_Z1})

{_Z1::integer}

(5)

type(0, integer)

true

(6)

subs(x = sol, expr) = 0

sin(Pi*_Z1)/(Pi*_Z1) = 0

(7)

is(sin(Pi*_Z1)/(Pi*_Z1) = 0)

true

(8)

The above should be false because expr is not defined for _Z1 = 0.However, this is what automatic simplifcation does behind the scenes with the output (7) 

sin(Pi*_Z1)/(Pi*_Z1) = 0

0 = 0

(9)

For this particular case Maple should have returned a special name expressing nonzero integers, like _NZ .
`ℤ__≠0`or `minus`(integer, {0})or `#msup(mi("ℤ",fontstyle = "normal"),mo("*"))`are common symbols for that
So _Zis incorrect in the solution and automatic simplification does something wrong.
Only substituing everything at once leads to a correct response:

subs(x = sol, _Z1 = 0, expr)

Error, numeric exception: division by zero

 


Solve

solve(expr, x)

x_sol := [solve(expr, x, allsolutions)]

[2*Pi*_Z2, Pi*(2*_Z2+1)]

(10)

indets(x_sol)

{_Z2}

(11)

subs(x = x_sol[1], expr) = 0

(1/2)*sin(2*Pi*_Z2)/(Pi*_Z2) = 0

(12)

is((1/2)*sin(2*Pi*_Z2)/(Pi*_Z2) = 0)

true

(13)

(1/2)*sin(2*Pi*_Z2)/(Pi*_Z2) = 0

0 = 0

(14)

subs(x = x_sol[1], _Z2 = 0, expr) = 0

Error, numeric exception: division by zero

 

Again _Z2 = 0is not a valid solution for the first solution butNULLworks for the second solution

subs(x = x_sol[2], expr) = 0

sin(Pi*(2*_Z2+1))/(Pi*(2*_Z2+1)) = 0

(15)

is(sin(Pi*(2*_Z2+1))/(Pi*(2*_Z2+1)) = 0)

true

(16)

sin(Pi*(2*_Z2+1))/(Pi*(2*_Z2+1)) = 0

0 = 0

(17)

Substituing everything at once works

subs(x = x_sol[2], _Z2 = 0, expr) = 0

sin(Pi)/Pi = 0

(18)

sin(Pi)/Pi = 0

0 = 0

(19)

However, the second solution does not cover all solutions (it misses even multiples of π)

[seq({_Z2}[] = i, i = -2 .. 2)]

[_Z2 = -2, _Z2 = -1, _Z2 = 0, _Z2 = 1, _Z2 = 2]

(20)

seq(subs([_Z2 = -2, _Z2 = -1, _Z2 = 0, _Z2 = 1, _Z2 = 2][i], x_sol[2]), i = 1 .. nops([_Z2 = -2, _Z2 = -1, _Z2 = 0, _Z2 = 1, _Z2 = 2]))

-3*Pi, -Pi, Pi, 3*Pi, 5*Pi

(21)

Related topic: I also think that new users and students should profit from a directly understandable output like this

Maybe adding new convert form is an option.

Download roots_of_sinc.mw

When I click on

called from here

Maple 2026 crashes. I had to use this

PackageTools:-Install("https://maple.cloud/app/4797495082876928/Maple+Customer+Support+Updates",overwrite=true)

Is that issue known?

I have troubles writing text passages including non-executable math with Maple 2026 in worksheet mode.

Since these "indicator switches" (or radio buttons) are not available any more, I have tried "toggling" between text and non-executable math by using F5. I am struggeling with too many use errors (changing mode, start writing in the wrong mode, deleting wrong text, toggling the mode with F5).

Is it normal that the cursor does not clearly indicate the entry mode state? Here is an example

There seems to be no difference between non-executable math and executable math. Only a small underline is visible. In document mode the cursor changes to grey for non-executable and to light blue for executable input. Was it allways like this (and I did not pay attention because of the above indicators switches) or is it something related to my local setting? Can someone confirm? Any other suggestions to speed up text editing.

Context: Commenting Maple worksheets with text mixed with nonexecutable math. I look for ways to speed up my workflow because the new quick access buttons do not provide quick access to change the entry mode. Too many clicks are needed. Usabilty has been degraded further with Maples 2026 version by shrinking the quick access button in size and moving them out of the user focus. They are now in the upper right corner of the screen but most user interactions happen on the left side of the screen. This is forcing me going back to shortcuts that I stopped using after the introduction of Maple 2021.

The command completion facility is real time saver. On the other hand, entering the colon dash is not fluent since it requires searching the keys on the key board.

I was wondering if there is a keyboard shortcut that enters both characters at once.

Can someone explain why the element selection inside Compare works differently for the second argument?

ode := diff(diff(y(x), x), x)+sin(y(x)) = 0; IC := y(infinity) = Pi; sol := [dsolve([ode, IC])]

diff(diff(y(x), x), x)+sin(y(x)) = 0

 

y(infinity) = Pi

 

[y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. Pi))+_a+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. Pi)+_a+c__2))^(1/2), _a = 0 .. _Z)+x+c__2)]

(1)

dsolve([ode, y(x__IC) = y__IC])

y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2)

(2)

ExpressionTools:-Compare(sol[1], [y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2)][1])

"([[y(x)=RootOf(-(∫)[0]^_Z1/(sqrt(2 cos(_a)+RootOf(-(∫)[0]^Pi1/(sqrt(2 cos(_a)+_Z)) ⅆ_a+_a+`c__2`))) ⅆ_a+x+`c__2`)],[[y(x)=RootOf(-(∫)[0]^_Z1/(sqrt(2 cos(_a)+RootOf(-(∫)[0]^`y__IC`1/(sqrt(2 cos(_a)+_Z)) ⅆ_a+`x__IC`+`c__2`))) ⅆ_a+x+`c__2`),y(x)=RootOf((∫)[0]^_Z1/(sqrt(2 cos(_a)+RootOf((∫)[0]^`y__IC`1/(sqrt(2 cos(_a)+_Z)) ⅆ_a+`x__IC`+`c__2`))) ⅆ_a+x+`c__2`)][1]]])"

(3)

whattype(y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2))

exprseq

(4)

ExpressionTools:-Compare(sol[1], (y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2))[1])

"([[y(x)=RootOf(-(∫)[0]^_Z1/(sqrt(2 cos(_a)+RootOf(-(∫)[0]^Pi1/(sqrt(2 cos(_a)+_Z)) ⅆ_a+_a+`c__2`))) ⅆ_a+x+`c__2`)],[(y(x)=RootOf(-(∫)[0]^_Z1/(sqrt(2 cos(_a)+RootOf(-(∫)[0]^`y__IC`1/(sqrt(2 cos(_a)+_Z)) ⅆ_a+`x__IC`+`c__2`))) ⅆ_a+x+`c__2`),y(x)=RootOf((∫)[0]^_Z1/(sqrt(2 cos(_a)+RootOf((∫)[0]^`y__IC`1/(sqrt(2 cos(_a)+_Z)) ⅆ_a+`x__IC`+`c__2`))) ⅆ_a+x+`c__2`))[1]]])"

(5)

NULL

(y(x) = RootOf(-(Int(1/(2*cos(_a)+RootOf(-(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC))+x__IC+c__2))^(1/2), _a = 0 .. _Z))+x+c__2), y(x) = RootOf(Int(1/(2*cos(_a)+RootOf(Int(1/(2*cos(_a)+_Z)^(1/2), _a = 0 .. y__IC)+x__IC+c__2))^(1/2), _a = 0 .. _Z)+x+c__2))[1]; ExpressionTools:-Compare(sol[1], %)

y(x) = RootOf(-(Int(1/sqrt(2*cos(_a)+RootOf(-(Int(1/sqrt(2*cos(_a)+_Z), _a = 0 .. y__IC))+x__IC+c__2)), _a = 0 .. _Z))+x+c__2)

(6)
 

NULL

Download Compare_and_indexing_output.mw

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