MaplePrimes Questions

Most of the time, odetest() returns just zero if solution satisfies ode, and non-zero expression if solution does not satisfy ode.

So I was just checking for zero as return value to check if my solution was verified or not. This works for most cases.

But there are cases when odetest returns odetest/PIECEWISE` where some cases are zero and some are not.  Example is below.

For this, I still want to consider my solution as valid if one of the cases in piecwise is zero. But I am not sure what is a robust way to do this in code. Currently, I do the following

restart;
ode:=x*diff(y(x),x) = y(x)+2*(x*y(x))^(1/2);
my_sol:=y(x)=x*(ln(x/_C1)^2 - 1) - 2*(-1 + sqrt(ln(x/_C1)^2))*x;
res:=odetest(my_sol,ode);
if res<>0 then
   if type(res,'function') then #this meant to handle PIECWISE                      
      print("verified");
   else
      print("did not verify");
   fi;
else #if we come here, res=0, so I am sure it is valid.
   print("verified");
fi;

In the above, the check  type(res,'function')  is meant to catch PIECEWISE  return, since when I did type(res) Maple told me the type is function.

But I am not sure if this is a robust way to check for this, as it might be possible maple will return non zero, and also a function, but it will not be what I think it is (i.e. PIECEWISE) and then I would flag my solution as valid when it is not.

worksheet attached also.


 

restart;
ode:=x*diff(y(x),x) = y(x)+2*(x*y(x))^(1/2);
my_sol:=y(x)=x*(ln(x/_C1)^2 - 1) - 2*(-1 + sqrt(ln(x/_C1)^2))*x;
res:=odetest(my_sol,ode);
if res<>0 then
   if type(res,'function') then
      print("verified");
   else
      print("did not verify");
   fi;
else
   print("verified");
fi;

ode := x*(diff(y(x), x)) = y(x)+2*sqrt(x*y(x))

my_sol := y(x) = x*(ln(x/_C1)^2-1)-(2*(-1+sqrt(ln(x/_C1)^2)))*x

`odetest/PIECEWISE`([0, x/exp((-x+(x*y(x))^(1/2))/x) = _C1], [0, x/exp((x+(x*y(x))^(1/2))/x) = _C1], [-4*(-x^2*(-ln(x/_C1)^2+2*(ln(x/_C1)^2)^(1/2)-1))^(1/2), x/exp(-(-x+(x*y(x))^(1/2))/x) = _C1], [-4*(-x^2*(-ln(x/_C1)^2+2*(ln(x/_C1)^2)^(1/2)-1))^(1/2), x/exp(-(x+(x*y(x))^(1/2))/x) = _C1])

"verified"

 

 

Download how_to_check_odetest.mw


 

restart; _local(gamma); _local(I); m := 3; A := 10; delta := .112; rho := .23; beta := 1.4; alpha := 2.1; gamma := 1.02; q := 2.3; b1 := 50; b2 := 10; b3 := 5; b4 := 20; S(0) := b1; B(0) := b2; V(0) := b3; R(0) := b4; mu := .13; i = 1; for k from 0 to m do S(k+1) := (A*delta*k-(rho+mu)*S(k)-beta*(sum(S(m)*B(j-m), j = 0 .. m)))/(k+1); B(k+1) := -(-(mu+alpha+gamma)*B(k)+beta*(sum(S(m)*B(j-m), j = 0 .. m)))/(k+1); V(k+1) := (rho*S(k)-(1-q)*S(k)-mu*V(k))/(k+1); R(k+1) := (gamma*B(k)-mu*R(k))/(k+1) end do; s := sum(S(kk)*t^kk, kk = 0 .. m); b := sum(B(kk)*t^kk, kk = 0 .. m); v := sum(V(kk)*t^kk, kk = 0 .. m); r := sum(R(kk)*t^kk, kk = 0 .. m); SS(0) := s; BB(0) := b; VV(0) := v; RR(0) := r; S(0) := subs(t = T(i), s); B(0) := subs(t = T(i), b); V(0) := subs(t = T(i), v); R(0) := subs(t = T(i), r)

I

 

Warning, The imaginary unit, I, has been renamed _I

 

3

 

10

 

.112

 

.23

 

1.4

 

2.1

 

1.02

 

2.3

 

50

 

10

 

5

 

20

 

50

 

10

 

5

 

20

 

.13

 

i = 1

 

-18.00-1.4*S(3)*B(-3)-1.4*S(3)*B(-2)-1.4*S(3)*B(-1)-14.0*S(3)

 

32.50-1.4*S(3)*B(-3)-1.4*S(3)*B(-2)-1.4*S(3)*B(-1)-14.0*S(3)

 

75.85

 

7.60

 

3.800000000-.4480000000*S(3)*B(-3)-.4480000000*S(3)*B(-2)-.4480000000*S(3)*B(-1)-4.480000000*S(3)

 

52.81250000-2.975000000*S(3)*B(-3)-2.975000000*S(3)*B(-2)-2.975000000*S(3)*B(-1)-29.75000000*S(3)

 

-18.70025000-1.071000000*S(3)*B(-3)-1.071000000*S(3)*B(-2)-1.071000000*S(3)*B(-1)-10.71000000*S(3)

 

16.08100000-.7140000000*S(3)*B(-3)-.7140000000*S(3)*B(-2)-.7140000000*S(3)*B(-1)-7.140000000*S(3)

 

.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3)

 

55.85709723-1.296018889*S(3)*B(-3)-1.296018889*S(3)*B(-2)-1.296018889*S(3)*B(-1)-12.96018889*S(3)-.4666666667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.4666666667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.4666666667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)

 

2.748344167-.1820700000*S(3)*B(-3)-.1820700000*S(3)*B(-2)-.1820700000*S(3)*B(-1)-1.820700000*S(3)

 

17.25940667-.9805600000*S(3)*B(-3)-.9805600000*S(3)*B(-2)-.9805600000*S(3)*B(-1)-9.805600000*S(3)

 

-.2034933335+1.482334934*S(3)*B(-3)+1.482334934*S(3)*B(-2)+1.482334934*S(3)*B(-1)+14.82334934*S(3)-.3500000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.3500000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.3500000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)

 

44.36655818+.3921579862*S(3)*B(-3)+.3921579862*S(3)*B(-2)+.3921579862*S(3)*B(-1)+3.921579862*S(3)-.7291666668*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.7291666668*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.7291666668*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)

 

0.2185881458e-1-.1520195250*S(3)*B(-3)-.1520195250*S(3)*B(-2)-.1520195250*S(3)*B(-1)-1.520195250*S(3)

 

13.68262908-.2986166168*S(3)*B(-3)-.2986166168*S(3)*B(-2)-.2986166168*S(3)*B(-1)-2.986166168*S(3)-.1190000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.1190000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.1190000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)

 

50+(-22.06933333-1.4*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-1.4*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-1.4*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+5.780693334*S(3)*B(-3)+5.780693334*S(3)*B(-2)+5.780693334*S(3)*B(-1)+57.80693334*S(3))*T(i)+(2.497813333-.4480000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.4480000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.4480000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+1.849821867*S(3)*B(-3)+1.849821867*S(3)*B(-2)+1.849821867*S(3)*B(-1)+18.49821867*S(3))*T(i)^2+(-.9095153783-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+1.704919154*S(3)*B(-3)+1.704919154*S(3)*B(-2)+1.704919154*S(3)*B(-1)+17.04919154*S(3))*T(i)^3

 

10+(28.43066667-1.4*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-1.4*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-1.4*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+5.780693334*S(3)*B(-3)+5.780693334*S(3)*B(-2)+5.780693334*S(3)*B(-1)+57.80693334*S(3))*T(i)+(44.16516667-2.975000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-2.975000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-2.975000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+12.28397333*S(3)*B(-3)+12.28397333*S(3)*B(-2)+12.28397333*S(3)*B(-1)+122.8397333*S(3))*T(i)^2+(52.09000233-1.296018889*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-1.296018889*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-1.296018889*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+5.351348394*S(3)*B(-3)+5.351348394*S(3)*B(-2)+5.351348394*S(3)*B(-1)+53.51348394*S(3)-.4666666667*(-.9095153783-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+1.704919154*S(3)*B(-3)+1.704919154*S(3)*B(-2)+1.704919154*S(3)*B(-1)+17.04919154*S(3))*B(-3)-.4666666667*(-.9095153783-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+1.704919154*S(3)*B(-3)+1.704919154*S(3)*B(-2)+1.704919154*S(3)*B(-1)+17.04919154*S(3))*B(-2)-.4666666667*(-.9095153783-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.4129066667*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+1.704919154*S(3)*B(-3)+1.704919154*S(3)*B(-2)+1.704919154*S(3)*B(-1)+17.04919154*S(3))*B(-1))*T(i)^3

 

5+75.85*T(i)+(-21.81329000-1.071000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-1.071000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-1.071000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+4.422230400*S(3)*B(-3)+4.422230400*S(3)*B(-2)+4.422230400*S(3)*B(-1)+44.22230400*S(3))*T(i)^2+(2.219127367-.1820700000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.1820700000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.1820700000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+.7517791681*S(3)*B(-3)+.7517791681*S(3)*B(-2)+.7517791681*S(3)*B(-1)+7.517791681*S(3))*T(i)^3

 

20+7.60*T(i)+(14.00564000-.7140000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.7140000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.7140000000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+2.948153600*S(3)*B(-3)+2.948153600*S(3)*B(-2)+2.948153600*S(3)*B(-1)+29.48153600*S(3))*T(i)^2+(14.40924560-.9805600000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-3)-.9805600000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-2)-.9805600000*(.2906666667-.4129066667*S(3)*B(-3)-.4129066667*S(3)*B(-2)-.4129066667*S(3)*B(-1)-4.129066667*S(3))*B(-1)+4.048797611*S(3)*B(-3)+4.048797611*S(3)*B(-2)+4.048797611*S(3)*B(-1)+40.48797611*S(3))*T(i)^3

(1)


 

Download badSums2.mw

Hello. It is required to find a solution of the boundary value problem by cubic b-spline collocation

We are looking for a solution in the form of a spline S(x). A cubic spline S(x) is represented as an expansion over normalized B-splines

Perhaps someone familiar with the method and can help implement the solution on Maple? I agree to any kind of cooperation. Really need help

Dears,

I have this file (of course it's not the real file):

input parameters
A := 5;
B := 6;
C := 7;

derived parameters
E := A*B;
F := cos(A)+e^B;
G := 265/C;
Parameters to be calculated
T := E^2+G-sin(F);
U := F+E-B;

 

I'd like to find a way for changing A, B, and C (for example giving them the values 1, 2, .. ,9) and getting a table (i mean a CSV or something else) with the values of T and U calculated for the different input values.

Do you know if it is possible?

And sorry if I wrote something wrong, it's my first post, and I'm not expert with Maple. I used it many years ago at the University, and now I'm trying to use it again.

I can type expression below:

s1 := sqrt(2);
                              (1/2)
                             2     
map(op, indets(s1, sqrt));
                             /   1\ 
                            { 2, - }
                             \   2/ 
s2 := log[2](3);
                             ln(3)
                             -----
                             ln(2)
map(op, indets(s2, ln));

And expression above is error
Error, type `ln` does not exist

Can you help me?

s3:=surd(2,3);

map(op, indets(s3, surd)); --> { } 


 

````

s1 := sqrt(2)

2^(1/2)

(1)

map(op, indets(s1, sqrt))

{2, 1/2}

(2)

s2 := log[2](3)

ln(3)/ln(2)

(3)

map(op, indets(s2, log))

Error, type `log` does not exist

 

s3 := surd(2, 3)

2^(1/3)

(4)

map(op, indets(s3, surd))

{}

(5)

``


 

Download help_map_indets.mw

I want to solve the equation (-2*cos(x)^2+2*sin(x+(1/4)*Pi)^2-1)/sqrt(-x^2+4*x) = 0 in RealDomain. I tried
 

restart; 
RealDomain:-solve({(-2*cos(x)^2+2*sin(x+(1/4)*Pi)^2-1)/sqrt(-x^2+4*x) = 0}, {x});

I got four solutions

If I work around

restart;
 RealDomain:-solve({-x^2+4*x > 0, (-2*cos(x)^2+2*sin(x+(1/4)*Pi)^2-1)/sqrt(-x^2+4*x) = 0}, x);

I only got two solutions

With Mathematica, I got three solutions 

That is mean, Maple lost the solution x = 5*Pi/4. I check this thing

f:= x-> (-2*cos(x)^2+2*sin(x+(1/4)*Pi)^2-1)/sqrt(4*x-x^2) ;
f(5*Pi/4);


and got the result 0. 

Are these bugs?

Dear all

I would like to find the optimal parameters of the attached optimal control problem 

The system of ODEs is defined and boundary conditions and The hamilton Jacobi Bellman equations is written.

Optimal_control.mw

 

Many thinks

 

I'm currently working my thesis and can someone help me to write a code to solve this IVP

u_t + 2×u²×u_x−(u_x)²−½×u_{xx}×u=0

with initial condition

u(x,0)=-tanh(x)

 

Dear friends,

Greetings.

How to get the second solution.

how to change the guess value in maple.

figure 1 plot in Matlab with two different initial guesses.

 

TWOSOLUTION.mw

 



 

I am writing a maths books using maple now. It is fantastic to use maple for writing books in maths.
 

 

 

 in the polynomial x^3-3*x^2-33*x+35 This line is not copying in full line!!
Step 1: Find the sum of all the coefficients in the polynomial x^3-3*x^2-33*x+35 This line is copying in full!!
"= 1-3-33+35 = 0"
                                                 r x-1is a factor  ; 1 is a root of the polynomial.
In the next row, I copy pasted the lines above

 in the polynomial x^3-3*x^2-33*x+35 This line is not copying in full line!!

Step 1: Find the sum of all the coefficients in the polynomial x^3-3*x^2-33*x+35 This line is copying in full!!

"= 1-3-33+35 = 0"
                                                 r x-1is a factor  ; 1 is a root of the polynomial.
In the next row, I copy pasted the lines above

 

 

 

Can any one find the reason?

 

 

``


 

Download cannotCopyWhy.mw

I enclose a part of my document where in I made a particular line with text and maths formats combined.Then I made changes in the line. Now copy paste does work only for the later half (both text and maths formats). The corrected first part is not being copied.

How do I do the corrections properly so that copy paste is not a problem at laer stages.

Thanks for the answer.

Ramakrishnan V

The equation sin(9*x-(1/3)*Pi) = sin(7*x-(1/3)*Pi) can be solved easy by hand with solutions k*Pi and -Pi/48 + K*Pi/8. With Maple, I tried 
solve({sin(9*x-(1/3)*Pi) = sin(7*x-(1/3)*Pi)}, x, explicit, allsolutions)

I don't get the above solutions. How can I get these solutions?

My problem is related to recovering orbits from invariant polynomials, and their ideal of relations.

The invariant polynomials I obtained are:

u = x2 - x y + y2,
v = 2 x6 - 6 x5 y + 15 x4 y2 - 20 x3 y3 + 15 x2 y4 - 6 x y5 +  2 y6 ,
w = x6 - 4 x5 y + 10 x4 y2 - 10 x3 y3 + 5 x2 y4 - 2 x y5 + y6 .

Using the logic from the Cox et al. book I got that the algebraic relation (ideal of relations) between the invariants, which is:

11 u6 - 10 u3 v + 3 (v2 - v w + w2) = 0

Then, using Reduce[] (exact symbolic solver which uses cylindrical algebraic decomposition) from Mathematica I solved for x and y under the assumption x > y > 0, u > 0, v > 0 and w > 0, but I got rather a complex solution.


My question is whether there is a way to try getting something more straightforward than the solution given by Mathematica.
 

I tried to use Maple's solve function, but it immediately stops without any result of an error message.


My input for Reduce is:

Reduce[{x2 - x y + y2 == u, 2 x6 - 6 x5 y + 15 x4 y2 - 20 x3 y3 + 15 x2 y4 - 6 x y5 + 2 y6 == v,  x6 - 4 x5 y + 10 x4 y2 - 10 x3 y3 + 5 x2 y4 - 2 x y5 + y6 == w, 11 u6 - 10 u3 v + 3 (v2 - v w + w2) == 0, x > y > 0, u > 0, v > 0, w > 0}, {x, y}, Complexes]

 

and my input for solve:

 

solve({u = x^2 - x*y + y^2, v = 2*x^6 - 6*x^5*y + 15*x^4*y^2 - 20*x^3*y^3 + 15*x^2*y^4 - 6*x*y^5 + 2*y^6, w = x^6 - 4*x^5*y + 10*x^4*y^2 - 10*x^3*y^3 + 5*x^2*y^4 - 2*x*y^5 + y^6, 11*u^6 - 10*u^3*v + 3*v^2 - 3*v*w + 3*w^2 = 0, 0 < u, 0 < v, 0 < w, 0 < x, 0 < y, y < x}, {x, y})

 

Do you know what I am doing wrong, or what else could I try?

 

I use patmatch to look for certain expression inside a larger expression.

I find sometimes I need to repeat the same code to check for  "... + ..."   and also ".... * .....", since I do not know to tell Maple to look for + or * in the same code. *Luckily, I do not have to check for "-" or "/" operators, since "+" match with "-" and "*" match with "/").

An example will make things more clear.

Suppose I want to see if sin(x)*sqrt(x*y) has sqrt(x*y) anywhere in it. So I first try

restart;
expr:= sin(x)*sqrt(x*y);
if patmatch(expr,a::anything+(b::anything*x*y)^(c::anything),'la') then
    assign(la);
    if c =1/2 or c=-1/2 then
       print("found sqrt(x*y)");
    else
       print("did not find sqrt(x*y)");
    fi;
 else
   print("did not find sqrt(x*y)");
 fi;

And this fails, since I used "+" inside the patmatch. Then I try '*" instead

if patmatch(expr,a::anything*(b::anything*x*y)^(c::anything),'la') then

And now it does match.

What I'd like to write, is something like this (which ofcourse does not work)

if patmatch(expr,a::anything (* or +) (b::anything*x*y)^(c::anything),'la') then

I looked at conditional in patmatch, but it does not seem to apply for the above.

Any suggestions?

Maple 2019.1 on windows 10

 

Dear Users!

Hope everyone should fine here. I want to know how to multiple the entries of a matrix with a matrix like If A is matrix as:

A:= Matrix(2, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 2})
I want nonzero entries should multiply with m*m identity matrix and zero entries multiply with null matrix of order m*m. for m=2 the desired results i calculated manually as:

Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 2});

I want to know the general way. Thanks in advance

 

most people who post here seem to use .mw written in 2D, which I do not like to use.

Is there a tool to convert such a file to 1D worksheet that one can use from the command line before opening the document itself in Maple?

The reason I ask, sometimes opening the original file and trying to do this from inside Maple by selecting the code using the mouse, then  Format->ConvertTo->1D   does not work, and gives an error.

Also, sometimes, when I try to first create an empty worksheet document, and then try to copy/paste the code from the other document over, it also does not work. This happens when there are syntax errors in the original document. The error that comes up is

        Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

As an example, please see the attached file in the following question

https://www.mapleprimes.com/questions/227506--I-Need-Help-Trying-To-Write-A-Code

It will good to have a tool that converts such documents to 1D worksheet or even plain Maple code (.mpl) but I did not see such option under SAVE AS either. Also, when I tried to export it as .mpl file, I get the same error as above in the file. So I gave up.

 

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