Kitonum

20344 Reputation

26 Badges

16 years, 8 days

MaplePrimes Activity


These are answers submitted by Kitonum

The  has(a, b)  command returns true if  b  is an operand of  of some level (in this case we say that  b  is a subexpression of  a ) . The operands are returned by the op command. See

restart;
A:=I/sqrt(a);
B:=op(A);
op(B[2]);
has(A,a^(-1/2));
has(A,-1/2);

                       

In the help for the  Algebraic:-Remainder(a, b, x, options) command it is written: "The arguments a and b must be univariate polynomials in the variable x, which is typically a name. If other names or non-algebraic sub-expressions are included and they cannot be evaluated to algebraic numbers, an "unable to divide multivariate polynomials" error will be returned". So use he standard command  rem :

restart;
rem(a*x^3 + b*x^2 + c*x + d, 3*a*x^2 + 2*b*x + c, x);

 

Use the  empty symbol  ``  for this.

Example:

restart;
plot(sqrt(x), x = 0 .. 4, tickmarks = [[seq(i=``,i=0..4)], [seq(i=``,i=0..2)]], scaling=constrained);

                               

restart;
expr:=factor(x^10/36 - 4/25*y^24*z^8);
r:=op(expr);
d:=r[1];
sort(``(sqrt(d)*r[2])*``(sqrt(d)*r[3]), x);

                    

 

 

It's very simple. You must write your code as a procedure with the parameter  xP , and then use the  plots:-animate command, specifying a range for the parameter  xP :

restart;
Proc:=proc(xP)
local xA, yA, xB, yB, yP;
uses plots,geometry;
_EnvHorizontalName := 'x';
_EnvVerticalName := 'y';
xA := 5;
yA := 0;
point(A, xA, yA);
xB := 5;
yB := -7;
point(B, xB, yB);
midpoint(C, A, B);
segment(sg1, A, B);

yP := 0;
point(P, xP, yP);
PerpenBisector(L, C, P);
line(YYp, y = yB);
line(XXp, y = 0);
intersection(M, L, YYp);
line(PM, [P, M]);
projection(H, C, PM);
triangle(CMP, [C, M, P]);
triangle(ABH, [A, B, H]);
distance(B, H);
circle(cir, [B, 7]);
display(textplot([[coordinates(A)[], "A"], [coordinates(B)[], "B "], [coordinates(C)[], "C"], [coordinates(M)[], "M"], [coordinates(H)[], "H"], [coordinates(P)[], "P"]], align = {"above", 'right'}),
draw([YYp(color = red), XXp(color = black), PM(color = green), L(color = green), sg1(color = black), cir(color = magenta), P(color = black, symbol = solidcircle, symbolsize = 10), M(color = black, symbol = solidcircle, symbolsize = 10), H(color = black, symbol = solidcircle, symbolsize = 10), A(color = blue, symbol = solidcircle, symbolsize = 10), B(color = blue, symbol = solidcircle, symbolsize = 10), CMP(color = blue, filled = true, transparency = 0.8), ABH(color = red, filled = true, transparency = 0.8), C(color = blue, symbol = solidcircle, symbolsize = 10)]),
axes = none, view = [-15 .. 14, -15 .. 3]);
end proc:

plots:-animate(Proc, [a], a=-12..12, frames=90);

     

Also we can use the Explore command:

Explore(Proc(xP), xP=-12..12);

     

 

When specifying a function using the arrow, you must specify the function name. Your function names will be y1 and y2, not y1(x) and y2(x).
Also, your expression is somewhat better simplified with the  combine  command rather than the  simplify.

y1 := proc (x) options operator, arrow; 2*sin(x)-sin(2*x)+cos(2*x) end proc; y2 := proc (x) options operator, arrow; 4*sin(x)+sin(2*x)-cos(2*x) end proc; diff(y1(x), x); Expr := 1/2*((diff(y1(x), x))^2+(diff(y2(x), x))^2)+1/2*(3*y1(x)^2-y1(x)*y2(x)+y2(x)^2); simplify(Expr); combine(Expr)

33/2+(3/2)*sin(4*x)+(5/2)*sin(3*x)+(5/2)*cos(3*x)+(3/2)*cos(x)+(3/2)*sin(x)

(1)

NULL

Download simplify_expression_new.mw

I think this example reveals a serious bug in the  isolve  command that may appear in other examples. Let's consider a very simple example: find all integer solutions to the equation (x - y)*z = 1  . Obviously, the product of two integers is equal to 1 if and only if both factors are equal to 1 or both factors are equal to -1, that is, we obtain the set of two systems  {x - y = 1, z = 1}  or  {x - y = -1, z = -1} . But Maple only solves the first system and for some reason ignores the second one:

isolve((x-y)*z=1);

                      {x = _Z1+1, y = _Z1, z = 1}

Your problem has infinitely many solutions (see result of the  solve  command)). As an example at the end we find 1 solution:

restart;
A:=Matrix(3,symbol=x);
B:=A^2-A;
convert(B, set);
Sol:=solve(%); # All the solutions
X:=Sol[1];
L:=[x[2,1]=1,x[3,1]=2,x[3,2]=3,x[3,3]=4];
Y:=eval(X, L);
A:=eval(A,[L[],Y[]]); # 1 solution
A^2-A; # Check

Matrix(3, 3, {(1, 1) = x[1, 1], (1, 2) = x[1, 2], (1, 3) = x[1, 3], (2, 1) = x[2, 1], (2, 2) = x[2, 2], (2, 3) = x[2, 3], (3, 1) = x[3, 1], (3, 2) = x[3, 2], (3, 3) = x[3, 3]})

 

Matrix(3, 3, {(1, 1) = x[1, 1]^2+x[1, 2]*x[2, 1]+x[1, 3]*x[3, 1]-x[1, 1], (1, 2) = x[1, 1]*x[1, 2]+x[1, 2]*x[2, 2]+x[1, 3]*x[3, 2]-x[1, 2], (1, 3) = x[1, 1]*x[1, 3]+x[1, 2]*x[2, 3]+x[1, 3]*x[3, 3]-x[1, 3], (2, 1) = x[1, 1]*x[2, 1]+x[2, 1]*x[2, 2]+x[2, 3]*x[3, 1]-x[2, 1], (2, 2) = x[1, 2]*x[2, 1]+x[2, 2]^2+x[2, 3]*x[3, 2]-x[2, 2], (2, 3) = x[1, 3]*x[2, 1]+x[2, 2]*x[2, 3]+x[2, 3]*x[3, 3]-x[2, 3], (3, 1) = x[1, 1]*x[3, 1]+x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1], (3, 2) = x[1, 2]*x[3, 1]+x[2, 2]*x[3, 2]+x[3, 2]*x[3, 3]-x[3, 2], (3, 3) = x[1, 3]*x[3, 1]+x[2, 3]*x[3, 2]+x[3, 3]^2-x[3, 3]})

 

{x[1, 1]^2+x[1, 2]*x[2, 1]+x[1, 3]*x[3, 1]-x[1, 1], x[1, 1]*x[1, 2]+x[1, 2]*x[2, 2]+x[1, 3]*x[3, 2]-x[1, 2], x[1, 1]*x[1, 3]+x[1, 2]*x[2, 3]+x[1, 3]*x[3, 3]-x[1, 3], x[1, 1]*x[2, 1]+x[2, 1]*x[2, 2]+x[2, 3]*x[3, 1]-x[2, 1], x[1, 1]*x[3, 1]+x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1], x[1, 2]*x[2, 1]+x[2, 2]^2+x[2, 3]*x[3, 2]-x[2, 2], x[1, 2]*x[3, 1]+x[2, 2]*x[3, 2]+x[3, 2]*x[3, 3]-x[3, 2], x[1, 3]*x[2, 1]+x[2, 2]*x[2, 3]+x[2, 3]*x[3, 3]-x[2, 3], x[1, 3]*x[3, 1]+x[2, 3]*x[3, 2]+x[3, 3]^2-x[3, 3]}

 

Sol := {x[1, 1] = -(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1], x[1, 2] = -x[3, 2]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[1, 3] = -x[3, 3]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[2, 1] = x[2, 1], x[2, 2] = x[2, 1]*x[3, 2]/x[3, 1], x[2, 3] = x[2, 1]*x[3, 3]/x[3, 1], x[3, 1] = x[3, 1], x[3, 2] = x[3, 2], x[3, 3] = x[3, 3]}, {x[1, 1] = -(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1], x[1, 2] = -x[3, 2]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3])/x[3, 1]^2, x[1, 3] = -(x[2, 1]*x[3, 2]*x[3, 3]+x[3, 1]*x[3, 3]^2-x[2, 1]*x[3, 2]-x[3, 1]*x[3, 3])/x[3, 1]^2, x[2, 1] = x[2, 1], x[2, 2] = (x[2, 1]*x[3, 2]+x[3, 1])/x[3, 1], x[2, 3] = x[2, 1]*(x[3, 3]-1)/x[3, 1], x[3, 1] = x[3, 1], x[3, 2] = x[3, 2], x[3, 3] = x[3, 3]}, {x[1, 1] = -x[2, 2]+1, x[1, 2] = -x[2, 2]*(x[2, 2]-1)/x[2, 1], x[1, 3] = -x[2, 3]*(x[2, 2]-1)/x[2, 1], x[2, 1] = x[2, 1], x[2, 2] = x[2, 2], x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 0}, {x[1, 1] = -x[2, 2]+1, x[1, 2] = -x[2, 2]*(x[2, 2]-1)/x[2, 1], x[1, 3] = -x[2, 3]*x[2, 2]/x[2, 1], x[2, 1] = x[2, 1], x[2, 2] = x[2, 2], x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 1}, {x[1, 1] = 1, x[1, 2] = -x[1, 3]*x[3, 3]/x[2, 3], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = -x[3, 3]+1, x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = -x[3, 3]*(x[3, 3]-1)/x[2, 3], x[3, 3] = x[3, 3]}, {x[1, 1] = 1, x[1, 2] = x[1, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 0}, {x[1, 1] = 1, x[1, 2] = x[1, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = -x[1, 2]/x[1, 3], x[3, 3] = 0}, {x[1, 1] = 1, x[1, 2] = 0, x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 0}, {x[1, 1] = 1, x[1, 2] = 0, x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 1}, {x[1, 1] = 1, x[1, 2] = x[1, 2], x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 1}, {x[1, 1] = 0, x[1, 2] = -x[1, 3]*(x[3, 3]-1)/x[2, 3], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = -x[3, 3]+1, x[2, 3] = x[2, 3], x[3, 1] = 0, x[3, 2] = -x[3, 3]*(x[3, 3]-1)/x[2, 3], x[3, 3] = x[3, 3]}, {x[1, 1] = 0, x[1, 2] = 0, x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 0}, {x[1, 1] = 0, x[1, 2] = x[1, 3]*x[3, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 0, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 1}, {x[1, 1] = 0, x[1, 2] = x[1, 2], x[1, 3] = 0, x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = x[3, 2], x[3, 3] = 0}, {x[1, 1] = 0, x[1, 2] = x[1, 2], x[1, 3] = x[1, 3], x[2, 1] = 0, x[2, 2] = 1, x[2, 3] = 0, x[3, 1] = 0, x[3, 2] = 0, x[3, 3] = 1}

 

X := {x[1, 1] = -(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1], x[1, 2] = -x[3, 2]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[1, 3] = -x[3, 3]*(x[2, 1]*x[3, 2]+x[3, 1]*x[3, 3]-x[3, 1])/x[3, 1]^2, x[2, 1] = x[2, 1], x[2, 2] = x[2, 1]*x[3, 2]/x[3, 1], x[2, 3] = x[2, 1]*x[3, 3]/x[3, 1], x[3, 1] = x[3, 1], x[3, 2] = x[3, 2], x[3, 3] = x[3, 3]}

 

L := [x[2, 1] = 1, x[3, 1] = 2, x[3, 2] = 3, x[3, 3] = 4]

 

Y := {1 = 1, 2 = 2, 3 = 3, 4 = 4, x[1, 1] = -9/2, x[1, 2] = -27/4, x[1, 3] = -9, x[2, 2] = 3/2, x[2, 3] = 2}

 

Matrix(3, 3, {(1, 1) = -9/2, (1, 2) = -27/4, (1, 3) = -9, (2, 1) = 1, (2, 2) = 3/2, (2, 3) = 2, (3, 1) = 2, (3, 2) = 3, (3, 3) = 4})

 

Matrix(%id = 18446746597940595758)

(1)

 


 

Download Matrix_equation.mw

See help on the  Explore  command.

By default, Maple works in the complex domain. Use  LinearAlgebra:-DotProduct  command with the option conjugate=false to work in the real domain:

restart;
with(LinearAlgebra):
with(Typesetting):
Settings(typesetprime = true):
Settings(typesetdot = true):

v := <diff(rho(t), t)*cos(theta(t)) - rho(t)*diff(theta(t), t)*sin(theta(t)), diff(rho(t), t)*sin(theta(t)) + rho(t)*diff(theta(t), t)*cos(theta(t)), diff(z(t), t)>;

u_rho := <cos(theta(t)), sin(theta(t)), 0>;

DotProduct(v,u_rho, conjugate=false);
simplify(%)

 

I don't think your boundary value problem can be solved exactly, probably only numerically. To do this, I gave some numerical values ​​to all the parameters. Maple also does not accept a value at infinity as a boundary value. I replaced infinity with the number 50. You yourself can take as infinity some number that for your task is reasonable to take as infinity.

restart

with(plots)

OdeSys := D1*(diff(U0(y), y, y))+A*S*(diff(U0(y), y))-(M1+D1/K)*U0(y)+B*G1*Theta0(y) = 0, D1*(diff(U1(y), y, y))+A*S*(diff(U1(y), y))-(M1+D1/K+A*i*omega)*U1(y)+B*G1*Theta0(y) = 0, E1*(diff(Theta0(y), y, y))+Pr*S*C*(diff(Theta0(y), y))-F*Theta0(y)+Du*(diff(Phi0(y), y, y))+Pr*C*QL*Phi0(y) = 0, E1*(diff(Theta1(y), y, y))+Pr*S*C*(diff(Theta1(y), y))-F*Pr*C*i*omega*Theta1(y)+Du*(diff(Phi1(y), y, y))+Pr*C*QL*Phi1(y) = 0, diff(Phi0(y), y, y)+S*Sc*(diff(Phi0(y), y))-Kr*Sc*Phi0(y) = 0, diff(Phi1(y), y, y)+S*Sc*(diff(Phi1(y), y))-(i*omega+Kr)*Sc*Phi1(y) = 0; OdeSys1 := eval({OdeSys}, [A = 1, B = 2, C = 3, D1 = 4, Du = -1, E1 = -2, F = -3, G1 = -4, K = 5, Kr = 1, M1 = 2, Pr = 3, QL = 4, S = 5, Sc = 6, i = 1.5, omega = .5]); Cond := {Phi0(0) = 1, Phi0(50) = 0, Phi1(0) = 1, Phi1(50) = 0, Theta0(0) = 1, Theta0(50) = 0, Theta1(0) = 1, Theta1(50) = 0, U0(0) = 1, U0(50) = 0, U1(0) = 0, U1(50) = 0}

{diff(diff(Phi0(y), y), y)+30*(diff(Phi0(y), y))-6*Phi0(y) = 0, diff(diff(Phi1(y), y), y)+30*(diff(Phi1(y), y))-10.50*Phi1(y) = 0, 4*(diff(diff(U0(y), y), y))+5*(diff(U0(y), y))-(14/5)*U0(y)-8*Theta0(y) = 0, 4*(diff(diff(U1(y), y), y))+5*(diff(U1(y), y))-3.550000000*U1(y)-8*Theta0(y) = 0, -2*(diff(diff(Theta0(y), y), y))+45*(diff(Theta0(y), y))+3*Theta0(y)-(diff(diff(Phi0(y), y), y))+36*Phi0(y) = 0, -2*(diff(diff(Theta1(y), y), y))+45*(diff(Theta1(y), y))+20.25*Theta1(y)-(diff(diff(Phi1(y), y), y))+36*Phi1(y) = 0}

 

{Phi0(0) = 1, Phi0(50) = 0, Phi1(0) = 1, Phi1(50) = 0, Theta0(0) = 1, Theta0(50) = 0, Theta1(0) = 1, Theta1(50) = 0, U0(0) = 1, U0(50) = 0, U1(0) = 0, U1(50) = 0}

(1)

solutions := dsolve(`union`(OdeSys1, Cond), numeric, maxmesh = 10000)

odeplot(solutions, [[y, U0(y)], [y, U1(y)], [y, Phi0(y)], [y, Phi1(y)], [y, Theta0(y)], [y, Theta1(y)]], y = 0 .. 50, color = [red, blue, green, yellow, gold, cyan], axes = box, size = [1000, 400])

 
 

 

NULL

Download ode_exact_new.mw

Here are 2 solutions - numerical and symbolic. The  extrema command acknowledges the symbolic answer that was first received by the  identify  command:

restart;
with(geom3d):
point(A,0,0,4): point(B,6,-2,6): point(C,4,-8,4): v:=[1,-1,2]:
point(M,x,y,z):
line(d,[C,v]):
f:=distance(M,d);
v1:=<0,0,4>-<x,y,z>: v2:=<6,-2,6>-<x,y,z>:
p:=v1.v2 assuming real;
 Optimization:-Minimize(f, {x^2 + (y - 2)^2 + (z + 1)^2 = 29, p=0}); # Numerical solution
identify(evalf(%)); # Symbolic solution
extrema(f, {x^2 + (y - 2)^2 + (z + 1)^2 = 29, p=0}, {x,y,z}, s);
s;

 

The  P  procedure solves your problem:

restart;

P:=proc(Eq)
local Eq1;
Eq1:=(lhs-rhs)(Eq)=0;
select(t->has(t,diff),lhs(Eq1))=-sort(remove(t->has(t,diff),lhs(Eq1)));
end proc:

Eq:=diff(u(x, t), t, t) + 3 + 2*diff(u(x, t), t) + 4*t + x^2 + x^3/3 + diff(u(x, t), t, x, x) + diff(u(x, t), x, x, x, x) = x*t^2;

P(Eq);

   

 

 

@JAMET  You wrote "I wish to write the following in this order (for instance)
<2275,3648,4275>,<975,448,1273>,<275,252,373>,<33,56,65>,<15,8,17>,<3,4,5> Is it possible ?" 

You made a mistake - the first and second triplets are not Pythagorean. I fixed it. The procedure   FromLargestToSmallest  solves your problem:

restart;
FromLargestToSmallest:=proc(t::Vector)
local L, M1, M2, M3, A1, A2, A3, t1, k, r, R;
uses LinearAlgebra;
if t[1]^2+t[2]^2 <> t[3]^2 then error `The actual procedure argument is not a Pythagorean triple` fi;
M1, M2, M3 := <1,-2,2;2,-1,2;2,-2,3>, <1,2,2;2,1,2;2,2,3>, <-1,2,2;-2,1,2;-2,2,3>;
A1, A2, A3 := ([M1,M2,M3]^~(-1))[];
t1:=t; L[1]:=t1; k:=1;
while not Equal(t1,<3,4,5>) do
R:=[A1.t1,A2.t1,A3.t1];
for r in R do
if r[1]>0 and r[2]>0 and r[3]>0 then k:=k+1; L[k]:=r; t1:=r fi;
od;  od;
convert(L,list)[];
end proc:


Examples of use:

FromLargestToSmallest(<2275,3648,4275>);
FromLargestToSmallest(<2225, 3648, 4273>);

     

 

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