nm

11353 Reputation

20 Badges

13 years, 12 days

MaplePrimes Activity


These are replies submitted by nm

@dharr 

The odeadvisor is also confusing for me. When asked for type of this ode, it says "linear". But it is also of type "homogeneous" but it does not say that. I would have expected odeadvisor to give all types the ode falls under, right?

ode:=x*diff(y(x), x) = x + 1/2*y(x);
DEtools:-odeadvisor(ode);

  [_linear]

But 

dsolve(ode,[homogeneous]);

Classification methods on request
Methods to be used are: [homogeneous]
----------------------------
* Tackling ODE using method: homogeneous
--- Trying classification methods ---
trying homogeneous types:
trying homogeneous D
<- homogeneous successful

And

dsolve(ode,[linear]);
Classification methods on request
Methods to be used are: [linear]
----------------------------
* Tackling ODE using method: linear
--- Trying classification methods ---
trying 1st order linear
<- 1st order linear successful

I could never know why sometimes it lists all types of the ode, and sometimes it does not.

@acer 

But just using sol:=dsolve(ode,[homogeneous]); does not specify the sub class of homogeneous to use. There are 4 or 5 subclass for this method. I put link to the help web page above.

For example

ode := diff(y(x),x)=F((a*x+b*y(x)+c)/(r*x+s*y(x)+t));
sol:=dsolve(ode,[homogeneous]);

Gives

trying homogeneous types:
trying homogeneous C
trying homogeneous types:
trying homogeneous D
<- homogeneous successful
<- homogeneous successful

So it used homogeneous C I am guessing because 

DEtools:-odeadvisor(ode)

gives

[[_homogeneous, `class C`], _dAlembert]

I wanted to tell dsolve to use a specific sub class of homogeneous. The reason is, I wanted to check that specific algorithm if it works on some ode's. 

May be then one can't specify the sub class of homogeneous method to use? Even though they are given names from odeadvisor? I thought any method given in odeadvisor can be specified?

 

@sursumCorda 

FYI. Found a bug

is_symbol_inside_func_only:=proc(expr::anything,f::name,y::symbol)::truefalse;
  type(applyrule('conditional'(f('x'::anything), _depends('x', y)) = `tools/gensym`(f), expr), freeof(y))
end proc;

expr:=-1/k^2*ln(x)+1/2/k^2*ln(k^2+x^2);
is_symbol_inside_func_only(expr,ln,x);

gives

Error, (in PatternMatching:-AlgStruct:-TableLookup) invalid input: depends expects its 2nd argument, x, to be of type {name, list(name), set(name)}, but received k^2+x^2

Maple 2023.2.1 on windows 10

It seems due to your function using 'x' inside?  The symbol passed can be anything,. y or z or x. If I change the call to 

expr:=-1/k^2*ln(y)+1/2/k^2*ln(k^2+y^2);
is_symbol_inside_func_only(expr,ln,y);

Then no error. 

I do not understand why you used 'x' and not declare local variable. I am sure there is good reason, but I did not use applyrule myself much before.

@dharr 

The problem with expansion is really due to weakness in Maple simplify. compare:

e1:=-(-y - 1 + 2*x)*(4*x^2 - 4*x*y + y^2 + 2*x - y + 1);
simplify(e1);
simplify(e1,size);

It did not simplify it back to 

In Mathematica:

So I took your cancel function and implemented in Mathematica, and this problem do not show up. I just need to call FullSimplify on the LHS. Here is your function in Mathematica

cancel[eq_Equal] := Module[{lhs, rhs, nums, dens},
     lhs = Factor[eq[[1]]];
     rhs = Factor[eq[[2]]];
     If lhs == 0 || rhs == 0,
          Return[lhs == rhs, Module]
      ];
  
     nums = Factor[Numerator[lhs]/Numerator[rhs]];
     dens = Factor[Denominator[lhs]/Denominator[rhs]];
     FullSimplify[Numerator[nums]/Numerator[dens]] == 
   Denominator[nums]/Denominator[dens]
  ]

And now

When I use your function in Maple, with Acer's change to add simplify(size), it still does not do the above

	
cancel := proc(eq::`=`);
  local lhseq, rhseq, nums, dens;
  lhseq := factor(lhs(eq));
  rhseq := factor(rhs(eq));
  if lhseq = 0 or rhseq = 0 then return lhseq = rhseq end if;
  nums := factor(numer(lhseq)/numer(rhseq));
  dens := factor(denom(lhseq)/denom(rhseq));
  simplify(numer(nums)/numer(dens),size) = denom(nums)/denom(dens);
end proc:

Now

expr:=((y-2*x)^3+1)/( (y-x)^2 * x )*x^2 = x*a;
cancel(expr);

gives

I always said that Maple needs a FullSimplify version of simplify. 

@Carl Love 

good question but I did not mention these cases because luckily for me, these do not show up for what I am using this for.

So one can assume that the function will be always be the top level.

For example, if it is ln then it will only show on its own as in ln(1+y) and not be inside another function.

So no cos(sin(ln(y)) and no sin(ln(y)) and so on. No need to worry about such cases since they will not show up.

The tests I showed are typical cases and your code only needs to pass these tests.

@Carl Love 

Yes, I know that. But I just prefer map(X->...., collection) notation than ~ because I find this is more explicit and I can more easily do things on X inside since it has a name to use, which is X in this case.

@Mikey_W 

I note that

evalhf(Pi)
3.14159265358979312

gives Pi correct as far as the 793 in the decimal readout. The 12 at the end is not correct

That is correct. I do not know why. May be slight fault somewhere. You could report it. On Mathematica, it gives 3.141592653589793

 

 

@Carl Love 

"Are you saying that in some earlier version of Maple, solve needed the parametric option"

I was replying to sursumCorda initial comment that he had to use parametric option to solve it. But he later on he editied his reply and removed this part. I assumed he was using different/older version of Maple. I only have Maple 2023 and 2022.

I was starring at this for 30 minuts and did not noticed that I have type eq1 on the left side on both of them 

@sursumCorda 

opps, sorry, I have not seen this typo. This explains it. I was wondering why. I need new glasses.   But in Maple 2023.2.1 it solves now without using  parametric. Here is workheet. It now gives same answer as Mathematica:

17020

restart;

17020

sol:=1/4*exp(-t) * (c2*(-1+exp(4*t)) + c1*(3+exp(4*t))):
expand(simplify(sol));

(1/4)*(exp(t))^3*c1+(1/4)*(exp(t))^3*c2+(3/4)*c1/exp(t)-(1/4)*c2/exp(t)

eq1:=-3=eval(sol,t=4):
expand(simplify(eq1));

-3 = (1/4)*exp(12)*c1+(1/4)*exp(12)*c2+(3/4)*c1*exp(-4)-(1/4)*c2*exp(-4)

eq2:=-17=eval(diff(sol,t),t=4);
expand(simplify(eq1));

-17 = -(1/4)*exp(-4)*(c2*(-1+exp(16))+c1*(3+exp(16)))+(1/4)*exp(-4)*(4*c2*exp(16)+4*c1*exp(16))

-3 = (1/4)*exp(12)*c1+(1/4)*exp(12)*c2+(3/4)*c1*exp(-4)-(1/4)*c2*exp(-4)

solve([eq1,eq2],[c1,c2])

[[c1 = (2*exp(16)-5)/(exp(-4)*exp(16)), c2 = -(15+2*exp(16))/(exp(-4)*exp(16))]]

 

Download unable_to_solve_2_equations_dec_26_2023.mw

@C_R 

"Keep us posted."

It did not work. Maple hanged same as on windows at random problem,. I saw mserver shoot in CPU and stayed there. I ended up deleting the whole Linux installation including Maple. (it was on Virtual box) but with lots of RAM (32 GB and lots of disk space).

Next will try a mac. But I have no mac and never used a mac myself before. But will try to see if I can rent one from somewhere for a month and try it there.

If Maplesoft can just fix its software quality none of this will be needed.

@C_R 

thanks, I downloaded trial version and installed it ok with the temp purchase code they emailed me.  It is now up on Linux. This gives me 2 weeks to try Maple on Linux. If these hangs do not show on Linux, I will go buy new PC and switch to Linux.  I

I want the solution in real domain. I tried

restart;
eq:=Z^2=y/x;
solve(eq,Z) assuming real

Which gives same. sqrt(x*y)/x is same as sqrt(y)/sqrt(x) only for non-negative x,y :

I want the solution to be sqrt(y)/sqrt(x) and not sqrt(x*y)/x.  Is there no option in Maple to make solve do this?

@Thomas Richard 

Is there study on which platform Maple is more reliable? mac or Linux or windows?

For me, on windows (now windows 10), I can get Maple to easily hang/freeze/crash few time every day. 

All what I have to do is run my program which takes 20 or more hrs to complete, and it will either crash or most likely hang at random location each time then I have to kill mserver.exe and restart worksheeet again from the same spot it was hanging, It is these random hangs where mserver will stay running at high CPU no matter how long I wait. So I keep checking every 1-2 hrs, and when I noticed this, the only option is to terminate and start again at same problem it was hanging. Then it works. seems like memory or such problem. I never figured why this happens.

Then it runs again OK for 2-3 hrs and then the same problem happens at different random place.  Nothing improves. Same problems I had for years. version after version.

If Maple on mac or Linux are known to be more reliable, I will switch and try. I never used Maple on anything other than windows.

As I was typing the above, Maple mserver.exe went into one of its spins. Been running like this for one hr now.  I can leave it running for 5 years and it will still be doing same thing.

Here is movie. So I had to kill it and start again at same problem and it ran OK. So it is not my program. If it was my code, then it will do the same thing again at same location, but it does not.

@Carl Love 

fyi, sometimes this does not work. Here is example

f:=-(8*x*y^(5/3)+y)/x/(2*x*y^(2/3)-1);
L:=discont(evalc(f),x);
indets(L[2],suffixed(_Z));
indets(L[2],suffixed(_));
has(L[2],_Z)

Maple 2023.2.1

@sand15 

You can try this. Make sure you end your printf(...) with "\n"  this sometimes causes the line buffer to automatically flush and not be buffered.

First 21 22 23 24 25 26 27 Last Page 23 of 91