Kitonum

19511 Reputation

26 Badges

14 years, 324 days

MaplePrimes Activity


These are questions asked by Kitonum

The problem: to simplify the expression

for any negative  x  and  y .

Below we see that Maple copes with the task brilliantly (example 1). For example, it presents  sqrt(x*y)  as  sqrt(-x)*sqrt(-y)  and so on. But the same technique, applied only to the numerator of this expression does not give the desired presentation in the form of a square (example 2 and example 3).

restart;
# Example 1
A:=(x+y-2*sqrt(x*y))/(sqrt(-x)+sqrt(-y));
simplify(A) assuming negative;
factor(%,{sqrt(-x),sqrt(-y)});

                                         

restart;
# Example 2
B:=x+y-2*sqrt(x*y);
simplify(B) assuming negative;
factor(%,{sqrt(-x),sqrt(-y)});

                                           

 

restart;
# Example 3
B:=x+y-2*sqrt(x*y);
R:=simplify(B) assuming positive;
combine(R) assuming positive;
factor(R,{sqrt(x),sqrt(y)});

                                                   

Two questions:

1. Does anyone know the reasons for this behavior.

2. Does anyone know an easy way to simplify in examples 2 and 3 (without  substitutions  like  x=+-u^2  and  y=+-v^2 and so on,  of course)

 

Download sqrt.mw

 

after running the command  DocumentTools:-Tabulate  as you can see it in the example below in Maple 2018.2:

DocumentTools:-Tabulate(Matrix(2, [a, b, c, d]), width=20);

Output:
                                  

 

 

An hour or two ago, I answered a question in which it was a question of plotting a complex-valued function of 2 real variables. But the question itself and also my answer to it disappeared somewhere. Therefore, I send my answer here below.

There are two options for plotting:
1. Graphs of real and imaginary parts (as 2 surfaces in 3D).
2. Graph of the absolute value of this function (one surface in 3d) .

restart;
f:=(1+cosh(2*x))*exp(-4*I*t):
plot3d([Re,Im](f), x=0..1, t=0..1, color=[red,blue]);
plot3d(sqrt(add([Re,Im](f)^~2)), x=0..1, t=0..1, color=green);

 

I wonder if it is possible to automatically obtain the well-known  binomial theorem  for an arbitrary integer and a positive exponent  n  in Maple. The expansion  (1)  below  I want to get in Maple automatically. But all my attempts were unsuccessful:
 

restart;

(a+b)^n=Sum(binomial(n,k)*a^(n-k)*b^k, k=0..n);  # The binomial theorem

(a+b)^n = Sum(binomial(n, k)*a^(n-k)*b^k, k = 0 .. n)

(1)

expand((a+b)^n) assuming n::posint;
convert((a+b)^n, Sum) assuming n::posint;
convert((a+b)^n, polynom) assuming n::posint;
convert((a+b)^n, binomial) assuming n::posint;

 

(a+b)^n

 

(a+b)^n

 

(a+b)^n

 

(a+b)^n

(2)

 


 

Download binomial_theorem.mw

For some unknown reason, the code below does not work in Maple 2018.1, but works in Maple 2015 and Maple 2017 (the idea is taken from here

restart; 
with(plottools): with(plots):
V1,V2,V3,V4,V5,V6,V7,V8:=[0,-1,0],[0,0,0],[1,0,0],[1,-1,0],[0,-1,1],[0,0,1],[1,0,1],[1,-1,1]:  # The vertices of the cube
Faces:=[[V1,V4,V8,V5],[V5,V6,V7,V8],[V2,V3,V7,V6],[V1,V2,V3,V4],[V3,V4,V8,V7],[V1,V2,V6,V5]]: # The list of the faces
Colors:=[green, red,RGB(1, 0, 4),blue,grey,gold]: # The list of the colors
Cube[0]:=display([seq(polygon(Faces[i],color=Colors[i]),i=1..6)]):

for n from 1 to 7 do
F[n]:=t->rotate(Cube[n-1],t, [[0,n-1,0],[1,n-1,0]]):
Cube[n]:=rotate(Cube[n-1],-Pi/2, [[0,n-1,0],[1,n-1,0]]):
A[n]:=animate(display,[F[n](t)], t=0..-Pi/2,paraminfo=false);
od:

for m from 6 to 0 by -1 do
G[m]:=t->rotate(Cube[m+1],t, [[0,m,0],[1,m,0]]):
B[m]:=animate(display,[G[m](t)], t=0..Pi/2,paraminfo=false);
od:

C1:=display([seq(A[k], k=1..7)], insequence):
C2:=display([seq(B[k], k=6..0, -1)], insequence):
display([C1,C2], insequence, scaling=constrained, axes=normal);

 

1 2 3 4 5 6 7 Page 2 of 8