Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Some rewriting for a general equation , how to do ?


 

Transformation of eq 1 in wanted eq 2 form

A*x^2+B*x*y+C*y^2+D*x+E*y+F = 0 (general form 2)

After complete square for x and y and some rearrangment (general form 2) ,  i got this equation eq1  

 

 

(A*(x + (B*y + D)/(2*A))^2 + C*(y + (B*x + E)/(2*C))^2)/(-C*y^2 - E*y - 2*F + (B*y + D)^2/(4*A) - A*x^2 - D*x + (B*x + E)^2/(4*C))=1;

(A*(x+(1/2)*(B*y+D)/A)^2+C*(y+(1/2)*(B*x+E)/C)^2)/(-C*y^2-E*y-2*F+(1/4)*(B*y+D)^2/A-A*x^2-D*x+(1/4)*(B*x+E)^2/C) = 1

(1)

eg1:= (-4*A^2*C*x^2 + (-4*y^2*C^2 + (-8*B*x*y - 4*D*x - 4*E*y)*C - (B*x + E)^2)*A - (B*y + D)^2*C)/(4*A^2*C*x^2 + (4*y^2*C^2 + (4*D*x + 4*E*y + 8*F)*C - (B*x + E)^2)*A - (B*y + D)^2*C) = 1;

(-4*A^2*C*x^2+(-4*y^2*C^2+(-8*B*x*y-4*D*x-4*E*y)*C-(B*x+E)^2)*A-(B*y+D)^2*C)/(4*A^2*C*x^2+(4*y^2*C^2+(4*D*x+4*E*y+8*F)*C-(B*x+E)^2)*A-(B*y+D)^2*C) = 1

(2)

 

(1) wanted form of eg1
"A x^2+B x y+C y^2+D x+E y+F=0*("general form 2))

for M ≠ 0

 

(x+(B*y+D)/(2*A))^2/X+  (y+(B*x+E)/(2*C))^2/Y = 1

 

Note : what X and Y could be ? :   M/A and M/B  ..

So it must be possible to transform eq1  in this form  above ?

 

Some background info

If B= 0 in (general form 2) you get (general form 1)  

 

(2) In book for M ≠ 0 as example we get this form
 Ax^2+Cy^2+Dx+Ey+F = 0(general form 1 )

(x+C/(2*A))^2*A/M+  (y+D/(2*B))^2*B/M = 1

 


 

Download vraag1-herleidingconics2.mw

 

 

I need to check if expression is "special" kind of polynomial. Where powers are allowed to be non-integers and can be fractions. This is not polynomial in the mathematical sense ofcourse so can not use type(expr,polynom) on it, and did not see a way to tell type(expr,polynom) to accept non-integer exponents.

For an example, given p(x):=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x*sin(x): it will return false, due to sin(x) term there. Without this term, it will return true, since all other terms have the form x^anything.

Currently, this is what I do

expr:=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x*sin(x):

if type(expr,polynom(anything,x)) then
   print("Yes, normal polynomial");
else
   what_is_left:=remove(Z->type(Z,{`^`('identical'(x),algebraic),'identical'(x)}),expr);
   if has(what_is_left,x) then
      print("Not special polynomial");
   else
      print("Yes, special polynomial");
   fi;
fi;

While with

expr:=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x:

It will print "Yes, special polynomial"

Is the above a good way to do this, or do you suggest a better way? It seems to work on the few tests  I did on it so far.

It is always "polynomial" in one symbol, such as x. So if it contains any function of x, other than  x^exponent, where exponent can only be numeric, or other symbol, it will fail the test. So this below will pass the a above test as well

expr:=x^2+x^(1/3)+3+sqrt(x)+x^a+1/x:

 

I was just praising Maple for not rewriting/simplifying  expressions automatically without the explicit user asking for it, when I found the following strange result

expr:=arccos(a-p) does not cause any change in the input. Good.

But when I change the letter ordering to expr:=arccos(p-a) now Maple changed it to Pi - arccos(a - p)

I have no idea why. Is there an option to tell Maple not to do that, even if it is mathematically correct? 

restart;
expr:=arccos(a-p);

restart;
expr:=arccos(p-a);

It seems to use lexicographical ordering to re-write things. Is it possible to turn that off?  Notice that I did not ask for simplification or anything. 

Maple 2020.1, Physics 724

I was checking my solution against Maple. Maple gives solution with integral and RootOf. I am not able to simplify it to better compare.

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode);

It is the second solution above I want to simplify/evaluate. So I tried

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode);
sol:=[sol][2];
DEtools:-remove_RootOf(sol)

But this did nothing. Then I tried adding useint in the dsolve command

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode,useint);

But this also kept the integral there. Then I tried eval

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=[dsolve(ode,'explicit')];
eval(sol[2])

The solution I obtained is 

y(x) = -ln(_C1^2 - 2*_C1*x + x^2 + 1)/2 + ((-2*x + 2*_C1)*arctan(-x + _C1))/2

Which does verify to zero OK using odetest.

Any suggestions/tricks to use to get an more explicit solution from Maple I am overlooking?

Maple 2020.1 , Physics 724

I can post/attach my full solution if needed. 

 

 

Hello,

I have a particular problem that I haven't managed to find the solution to by googling.

9/10 times that I open Maple 2020 I can't seem to open any of my saved documents. it opens the start tab, and I'm still able to open a new document or worksheet, but then when I try to change to text instead of math, it won't let me. I can type, but I can't press backspace or enter.

I have tried restarting and shutting down my computer, but every time I have to just force quit Maple because it won't respond half of the time and it won't quit normally.

I'm running the latest version of Maple and using macOS Catalina version 10.15.5.

How to plot the following functions?

 

plot(4*sqrt(L/g)*EllipticF(Pi/2, sin(theta0/2)), theta0 = 1 .. 20)

 Suppose that A is an m×n real matrix. The function TA:ℝn→ℝm   defined by

TA(x)=Ax,  for all 𝕩∈ℝn

     is a linear transformation.

let A=<< 87, -66, -90, 12, 48>|<-36, -40, -82, -54, 15>|<99, 79, 76, -31, 27>|<-69, 15, -10, 45, -9>>

and x= <9,-4,2,-17>.

Then TA(x)=   Preview   

   Alternatively, you can copy your answer from your Maple worksheet and paste it to the answer box.

 

(b) Suppose now that the linear map T:ℝ2→ℝ3  is defined by, for all 𝕩=(x1,x2)∈ℝ2

 T(x)=  <<x1+6x2>|<−2x2>|<−4x1+2x2>>

    

     Enter the matrix M , in Maple syntax, in the box below such that T(x)=Mx  for all x∈ℝ2,  

  M=    Preview   

 

Can someone pls help me with this question. TIA.

   

 

 

I have no problems assigning simple plots to variables and then displaying all in a single plot using the display command.

However, I am now trying to do the same using implicitplot without success.

This is my code;

restart;
f := 3*(x^2 + y^2)^2 = 100*x*y;

with(plots, implicitplot);
p1 := implicitplot(f, x = -4 .. 4, y = -4 .. 4, rangeasview = true):

p2 := pointplot([[1, Pi/2], [-1, -Pi/2]], color = red):

display({p1,p2})

What I get is a small implicit plot and the code for the pointplot back at me.

Is there any way to make this work?

Thank you for your help.

Jose

 

I solved this ODE and got a solution and wanted to compre it with Maple. This is initial value first oder ODE. So it should have no constants in it. But Maple's solution contains something I never seen before _B1~

I wonder what it means? And odetest did not verify Maple's solution. 

restart;
ode:=diff(y(x),x)-y(x)/x+csc(y(x)/x)=0;
sol:=dsolve([ode,y(1)=0]);
simplify(odetest(sol,ode));

odetest does not gives zero.

This is my solution

mysol:=y(x)=x*arccos(ln(x)+1);
odetest(mysol,ode)

   0

Any idea what _B1~ means? The ~ looks like it is an assumed variable? may be leaked from inside Maple.

Maple 2020.1 on windows 10

 

We've come over another annoying "feature" in units handling.

Maple isn't able to compare variables that have similar units, but are defined differently (like MPa and N/mm^2).

Did a quick check in Mathcad, seems to work there.

Compare_units.mw

I use odeadvisor a lot to tell me the type of the ode. It is one of the best tools in Maple.

But sometimes it overlooks some types of ODE's, if the ODE is written in different way. This does not happen alot. Here is an example

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


And advisor says it is rational, which is correct. 

But it does not also say it is exact. By rewriting as follows, it now see it is exact as well as rational:

ode2:=(denom(rhs(ode)))*diff(y(x),x)-(numer(rhs(ode)))=0;
DEtools:-odeadvisor(ode2);

And now it says [_exact, _rational]. It is the same ODE, just written different.

This is not a complaint about the advisor, I know it is not easy to figure the type of the ODE under different trasformations, but may be something to look into to improve it to be able to detect more types.

Maple 2020.1 

One thing I always liked about Maple, is that it does not do automatic simplifications or automatic re-write of expressions without the user explicitly asking for it like some other CAS systems do, which I think this is the right way.

So I was surprised when I set up a rational expression of a numerator and denominator, then when I asked for its denom and numer, I found Maple did automatic rewrite (even though on the screen the expression remained as it was originally). This caused a bug in my program (since it assumed as long as no simplifcation is made on the expression, numer and denom will remain as it was orginally placed). Here is an example

restart;
num:=-(1-x/exp(y));
den:=(exp(y)+x);
expr:=num/den;

So now, one would expect, by looking at the screen, when asking for numer(expr) to obtain back -(1-x/exp(y))  but this is not what happens

numer(expr)

And 

denom(expr)

So Maple's internal representation of numer and denom, is not what "appears" on the screen for the user. Maple automatically replaced -1+x/exp(y) by (-exp(y)+x)/exp(y) and then moved denominator of this, which is exp(y), down to the denominator of the orginal expression.

I was surprised by this, since as I said, my experence with Maple is that it keeps expressions as entered and will change them only when the user asks for a change.

How common is such behavior in Maple? and why did Maple do this under the cover manipulation in this case? It is probably documented somewhere if I search hard enough.

 

 

Good day.

I have a simple function that I would like to plot, but am finding this awkward to do. My objective is to plot the function for varying k-values and I tried doing this using implicitplot and sequencing values of k.

The function in question is:
y := k*x*sqrt(z*(1-z));

The constant, k, takes the values: 5, 10, 15, ..., 100
The variables lie in the range: 0 ≤ x < 1 and 0 ≤ z < 1

So, if someone can tell me how to construct a plot of multiple solution curves for varying k, I would be most grateful.

Thanks for reading!

MaplePrimes_Plot.mw

 

Hello all, 

When I tried to extract the RHS of the answer from 'solve()' command, the attempt failed. 


 

restart;

sys := U__s^2 = ((1+sigma)*U__T2N - u__rN * U__T2N/(1+sigma))^2+(u__xN * U__T2N/(1+sigma))^2;

U__s^2 = ((1+sigma)*U__T2N-u__rN*U__T2N/(1+sigma))^2+u__xN^2*U__T2N^2/(1+sigma)^2

(1)

answer := solve( sys, {U__T2N} );

{U__T2N = (1+sigma)*U__s/(sigma^4+4*sigma^3-2*sigma^2*u__rN+6*sigma^2-4*sigma*u__rN+u__rN^2+u__xN^2+4*sigma-2*u__rN+1)^(1/2)}, {U__T2N = -(1+sigma)*U__s/(sigma^4+4*sigma^3-2*sigma^2*u__rN+6*sigma^2-4*sigma*u__rN+u__rN^2+u__xN^2+4*sigma-2*u__rN+1)^(1/2)}

(2)

answer[1];

{U__T2N = (1+sigma)*U__s/(sigma^4+4*sigma^3-2*sigma^2*u__rN+6*sigma^2-4*sigma*u__rN+u__rN^2+u__xN^2+4*sigma-2*u__rN+1)^(1/2)}

(3)

rhs(answer[1]);

Error, invalid input: rhs received {U__T2N = (1+sigma)*U__s/(sigma^4+4*sigma^3-2*sigma^2*u__rN+6*sigma^2-4*sigma*u__rN+u__rN^2+u__xN^2+4*sigma-2*u__rN+1)^(1/2)}, which is not valid for its 1st argument, expr

 

 


Perhaps, the failure might be related to the fact that the equation is contained in curly brackets, but I could not come up with a solution. 

Please let me have a chance to learn the way to do the 'rhs()' operation in the correct way. 

Thank you, 

In Kwon Park 

Download Qprime_20200710.mw

I want to define a vector function, then plot it, differentiate it, etc.

The best I've been able to do so far is to define it two different ways: one for evaluating, one for symbolic manipulation

with(plots): with(VectorCalculus):
r:= < cos(t), sin(t), t >;  # symbolic version of function, for example to take derivative
# returns derivative,
diff(r,t);
rf := (t)->evalf( < cos(t), sin(t), t > );   # returns numerical value of function
# we use numerical version to plot
rCurve := spacecurve( rf(t), t = -1 .. 1 );
# But how to return value of derivative?? Next line doesn't work.
df := (t)->evalf( diff(r,t) );

But how do I plot the derivative? The last line doesn't work. I've tried various variations but no luck.

I don't think this approach is write (why define two different ways?) but haven't been able to figure out how to do it.

Various online docs haven't helped.

 

First 13 14 15 16 17 18 19 Last Page 15 of 1711