Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Kitonum On my computer with Maple 2022.2 the computation took only 0.047 seconds.

I started by just copying from the code as written in the question. (Only changing LinearSolve to LinearAlgebra:-LinearSolve as you did).
It went fine and with no errors. So there aren't any syntax errors in his code.

Maple's solve returns NULL on 1/ x = 0:
 

solve(1/x=0,x);

Mathematically, that is what I would expect: Infinity is not a real number.

You need to contact Customer Service via maplesoft.com.

They will probably require that you uninstall the existing version from your old computer.

@tomleslie Certainly simpler. My sneaking suspicion because of their being two loops is that he wanted this:

restart;
n:=5:
M:=Matrix(n,n);
for i from 1 to n do
  for j from  1 to n do
    M[i,j]:=sin(i*j)
  end do
end do:
   
M;

Thus in the simpler way:
 

restart;
R:=Matrix(5,5,(i,j)->sin(i*j));

 

You need to tell us what sgn and IF are. Presumably sgn is signum, but what about IF? Is it `if` (i.e. ifelse)? If so it needs 3 arguments.

@dharr Fortunately even without 'zero' simplify works:
 

simplify([0.*I-3, 5, 7, -2]);

@Carl Love The reason for using Maple 12 was that on my most recent and fastest computer I only have Maple 2022, 2021, and 12.
I have many more on my old laptop. I was able to check Maple 15 through 18. All returned unevaluated.
I wasn't able to check Maple 2015 and 2016, because my computer wouldn't connect to the kernel despite numerous and lengthy updates of this rarely used computer. Maple 2017 worked just fine, however, on the same computer. The result was as in Maple 2022.

## Addition: Maple 8 on my old computer gets the correct result reporting it as 8.173973726/Pi^2, which is .8281966926.

@jediknight I tried maximize in Maple 12. It returned unevaluated.

But this worked in Maple 12:
 

Optimization:-Maximize((((8*wx^2*(6.3-1)/(Pi^2*sqrt((6.3*wx^2-1)^2+1^2*wx^2*(wx^2-1)^2*(6.3-1)^2))))),wx=0.1..2);

 

@Rouben Rostamian  There is a problem with your solution: It doesn't solve the original ode for t > a.

The reason is the meaning of  x^(2/3) in Maple when x is negative:
x^n = exp(ln(x)*n) = exp((ln(abs(x)) + argument(x)*I)*n), where argument in Maple means the principal argument. Thus ln in Maple is the principal branch of ln.

evalc((-1)^(2/3));
evalc(x^(2/3)) assuming x<0;

If instead you modify the original ode to ode := diff(v(t),t) = -2*(v(t)^2)^(1/3), then the solution given by you satisfies ode for all t.

Alternatively you could modify your solution of the original ode to
sol := piecewise(t > a, 0, -(8*(t-a)^3)/27);

@vv Yes, you are right.

If you try debug( `type/realcons`)  you will see that the problem arises in examining negative powers.
These lines are endlessly repeated:

<-- exit \`type/realcons\` (now in \`series/power/isnegative\`) = false}
{--> enter \`type/realcons\`, args = 1+x0
                       functions_around,names_around :=     {}, {x0}

So I tried a normalized version of eq:
 

restart;
eq:=1 = -X*(-1/4*(-40*(X + x0)^(5/3) - 20/3*(X + x0)^(2/3)*Y - 20/3*(X + x0)^(2/3)*y0 - 32*A*(X + x0)^(1/3))/((X + x0)^(5/3)*(Y + y0)) + 5/12*(-15*(X + x0)^(8/3) - 4*(X + x0)^(5/3)*Y - 4*(X + x0)^(5/3)*y0 - 24*A*(X + x0)^(4/3) + 12*A^2)/((X + x0)^(8/3)*(Y + y0)))/(Y*(1/(Y + y0) + 1/4*(-15*(X + x0)^(8/3) - 4*(X + x0)^(5/3)*Y - 4*(X + x0)^(5/3)*y0 - 24*A*(X + x0)^(4/3) + 12*A^2)/((X + x0)^(5/3)*(Y + y0)^2)));
normal((rhs-lhs)(eq));
EQ:=numer(%);
sol:=solve(identity(EQ,X),[x0,y0]);

The answer was sol := [].

@Rouben Rostamian  With little change to your nice code using odeplot with the frame option, we can make the orbit as the bob moves.
 

#orbit := spacecurve(eval([r[1],r[2],-r[3]], dsol), t=0..tmax);
# Using instead:
orbitA:=odeplot(dsol,[r[1],r[2],-r[3]],0..tmax,frames=100,color=blue);
A:=animate(frame, [t], t=0..tmax, scaling=constrained, frames=100); # No background
display(A,orbitA);

@nm Here is a case (expr2 below) where things are different:  

expr1:=(A+E)/B+C;
normal(expr1);
combine(expr1); # As expected
expr2:=2*sin(x)*cos(x)/B+C;
normal(expr2); # As expected
combine(expr2); # Not expected: (C*B + sin(2*x))/B
expand(%,sin); #  Now we get what I expected above: C + sin(2*x)/B
### A more complicated version:
evalindets(expr2,`*`,combine); # C + sin(2*x)/B

# Note: Using map instead of evalindets seems simpler:

map(combine,expr2);

@nm I admit that I find frontend difficult to use, so I rarely use it.
Instead I use freeze and thaw when I need to avoid e.g. expansions:
 

evalindets(eq,`^`,freeze);
solve(%,A);
thaw(%);

 

In your extremely simple example both of the following work:
 

restart;
eq:=A=(1/2+x+y)^(3);
the_rhs:=solve(eq,A);
rhs(isolate(eq,A));
frontend(solve,[eq,A],[{`=`}]);
First 13 14 15 16 17 18 19 Last Page 15 of 229