nm

11353 Reputation

20 Badges

13 years, 12 days

MaplePrimes Activity


These are questions asked by nm

Should not  print("my matrix is ",A) at least print "my matrix is " even if A is not correctly filled/setup?

Notice that nothing shows on screen when using print (but lprint does)

Is this expected? If it makes any difference, I am using worksheet and this is my display options

21836

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

A:=Matrix(1,0);

print("My matrix is =",A);

lprint("My matrix is =",A);

"My matrix is =", Matrix(1,0,{},datatype = anything,storage = rectangular,order
= Fortran_order,shape = [])

 

 

Download why_print_empty_june_7_2024.mw

If I do    odetest(...,odeA) I get correct result. But if I do    odetest(...,odeB);  odetest(...,odeA);   now it gives wrong output for the odeA one. 

Same exact code. It just depends on the call done before it.

Why would issuing a command before changes the output of odetest? It seems Maple remembers something from last call. But I have no idea how to fix this.

Is there a way to tell odetest not to remember or cache any results from last calls? i.e. Can I clear its remember table before calling odetest??

This is messing all my testing now since I get different result each time depending on which call was made before. I can't do restart before testing each ode, since this is done in a loop.  I just need a way to tell Maple to clear its internal cache so that each call to odetest is not affected by last call result. 

Doing forget(odetest); before the call had no effect.

Reported to Maplesoft.

Worksheet below

``

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

restart;

4556

#EXAMPLE 1
ode:=x*diff(y(x),x)^n=0;
sol:=dsolve(ode);
odetest(sol,ode);

x*(diff(y(x), x))^n = 0

y(x) = c__1

0

restart;

4556

ode:=diff(y(x),x)^n=0;
sol:=dsolve(ode);
odetest(sol,ode);

(diff(y(x), x))^n = 0

y(x) = c__1

0^n

##EXAMPLE 1 repeated. Why now different result??

ode:=x*diff(y(x),x)^n=0;
sol:=dsolve(ode);
odetest(sol,ode);

x*(diff(y(x), x))^n = 0

y(x) = c__1

x*0^n

Download why_different_result_from_odetest_june_6_2024.mw

Update

FYI, I got email from Maplesupport that Maple R&D group will look at this issue.

So hopefully this will be fixed in a future version of Maple.  

I am not able to find a workaround but doing tracing I see that odetest does rememebr something from last call but have no idea to fix this myself.

I can't figure this out. Same exact patmatch works in global worksheet. But fails inside a proc.

I am using same exact code. In proc, I am doing    a::anything where `a` is now local symbol ofcourse. In worksheet, it is global ofcourse. I make sure I clear `a` in worksheet each time also.

So why it pathmatch fail in the proc? I must be doing something wrong but do not see it.,
 

26148

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

restart;

26148

a:='a':
stat:=0^n:

if patmatch(stat,0^a::anything) then
     0;
  else
     stat;
  fi;

0

foo:=proc(stat)
  local a;
  if patmatch(stat,0^a::anything) then
     0;
  else
     stat;
  fi;
end proc:

#why this does not return zero as expected?
foo(stat)

0^n

 


Here is screen shot in debugger showing patmatch failed inside the proc

 

Very strange. What do I need to change in the proc to make it work as in worksheet? 

Download patmatch_in_proc.mw

Is the following valid result from odetest? is returns 0^n when 0 was expected.

Is this a bug or valid result? Maple solution is correct, so I expected 0 only not 0^n as result.

25748

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1756 and is the same as the version installed in this computer, created 2024, June 5, 19:39 hours Pacific Time.`

ode:=diff(y(x), x)^n = 0

(diff(y(x), x))^n = 0

sol:=dsolve(ode)

y(x) = c__1

odetest(sol,ode)

0^n

odetest(sol,ode) assuming n::real

0^n

odetest(sol,ode) assuming n>0

0^n

 

 

Download strange_odetest_result_june_6_2024.mw

Update

Until this bug is fixed, I added the following to my code which checks for odetest result. it looks for 0^anything and changes it to 0. 

ode:=diff(y(x), x)^n= 0;
sol:=dsolve(ode);
stat:=odetest(sol,ode);
if patmatch(stat,0^a::anything) then 0; else stat; fi

gives    0

I found this problem when using odetest to check mysolution for this ode and was not getting 0 as expected,.

 

These two expressions are the same

e1:=-sqrt(-(exp(-2 + 2*x) - 2)*exp(-2 + 2*x))/(exp(-2 + 2*x) - 2);
e2:=1/sqrt(2*exp(-2*x)*exp(2) - 1);

Is there an automated way to simplify e1 to e2? Below are my attempts. The closest I got is 

simplify(e1) assuming real;

But that still does not give same as e2. I can do it by "hand" as shown. But I like to find automated way since this is done in code without looking at expression. So I can't use the "hand" method there.

We can assume everything in real domain.


 

15244

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

e1:=-sqrt(-(exp(-2 + 2*x) - 2)*exp(-2 + 2*x))/(exp(-2 + 2*x) - 2);
e2:=1/sqrt(2*exp(-2*x)*exp(2) - 1);
plot([e1,e2],x=-3..3)

-(-(exp(-2+2*x)-2)*exp(-2+2*x))^(1/2)/(exp(-2+2*x)-2)

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

simplify(e1,size);
simplify(e1,symbolic);
simplify(e1) assuming real; #closest but still no cigar
 

-(-(exp(-2+2*x)-2)*exp(-2+2*x))^(1/2)/(exp(-2+2*x)-2)

-I*exp(-1+x)/(exp(-2+2*x)-2)^(1/2)

exp(-1+x)/(-exp(-2+2*x)+2)^(1/2)

#can do it "by hand" by dividing upstairs and downstrais by numerator
A:=exp(-1 + x);
B:=-exp(-2 + 2*x) + 2;
e3:=1/sqrt( simplify(expand(B/A^2)))

exp(-1+x)

-exp(-2+2*x)+2

1/(-1+2*exp(2-2*x))^(1/2)

#verify
plot([e3,e2],x=-3..3)

 

 


Download simplification_june_6_2024.mw

First 28 29 30 31 32 33 34 Last Page 30 of 199