Kitonum

21440 Reputation

26 Badges

17 years, 37 days

MaplePrimes Activity


These are answers submitted by Kitonum

 idol050279 10
Inside the opaque cylinder, 30 random points are located. When the plane moves, the walls of the cylinder to the left of the plane disappear and the points become visible:

restart;
with(plots): with(plottools):
P1:=[seq(RandomTools:-Generate(list(float(range = -3..3), 3)), n=1..300)]:
P2:=select(p->p[1]^2+p[2]^2<3.9 and p[3]>0, P1)[1..30]:
Al:=animate(plot3d,[[2*cos(t),2*sin(t),h], t=arccos((2-s)/2)..2*Pi-arccos((2-s)/2), h=0..3, style=surface], s=0..4, frames=90, paraminfo=false):
Ac:=animate(plot3d,[[[x,y,3],[x,y,0]],x=2-s..-2,y=-sqrt(4-x^2)..sqrt(4-x^2), style=surface], s=0..4, frames=90, paraminfo=false):
B:=plots:-pointplot3d(P2, symbol=solidsphere, color=red, symbolsize=10):
C:=animate(display@polygon,[[[2-s,2,0],[2-s,2,3],[2-s,-2,3],[2-s,-2,0]], color=yellow], s=-0.02..4, frames=90, paraminfo=false):
plots:-display(Al, Ac, B, C, axes=normal, view=[-2.7..2.7,-2.7..2.7,-0.7..3.7]);

               

Example:

msolve(2^n=2, 3);
                                            {n = 1 + 2 _Z2}

 

_Z2  is an integer.
 

You forgot to put a semicolon in 1dmath mode. Also before  @  you have confused the order  "  and  ':

["<","&",">","'@"];

                                            ["<","&",">",'"@"]

Alternative solution:

restart;
f:=1-max(abs(x),abs(y),abs(z)):
g:=1.5-(x^2+y^2+z^2):
A:=plots:-implicitplot3d(piecewise(f<g,f,g), x=-1.6..1.6,y=-1.6..1.6, z=-1.6..1.6, 
       numpoints=300000, scaling=constrained, color=green, style=surface, axes=none ):
f:=1-(x^2+y^2+z^2):
g:=z^2-x^2-y^2:
B:=plots:-implicitplot3d(piecewise(f<g,f,g), x=-1..1,y=-1..1, z=-1..1, 
       numpoints=300000, scaling=constrained, color=green, style=surface, axes=none):
plots:-display(<A | B>);


Interestingly, for a slightly smaller numpoints, the plotting quality is slightly better.


 

See this simple example in which the difference between  algsubs  and  subs  is clearly visible. Your second example works as expected, because the numerator is independent of  w :

Expr:=a/(a+b);
algsubs(a+b=c, Expr);
subs(a+b=c, Expr);

                         Expr := a/(a+b)
                               (-b+c)/c
                                  a/c


Read Help on these commands for details.

I do not know of such a built-in function, but here is a simple procedure that in many cases solves the problem:

Separation:=proc(F)
local F1, F2, S, Sx, Sy;
F1:=factor(F);
F2:=evalindets(F1, {`^`,function}, expand);
S:={op(F2)};
Sx:=select(depends,S,x);
Sy:=S minus Sx;
if not(type(F1,`*`) or type(F1,`^`) or type(F1,function)) or depends(Sx,y) or depends(Sy,x) then return NULL else
[combine(`*`(op(Sx))), combine(`*`(op(Sy)))] fi; 
end proc:



Examples of use:

Separation(((3*y + y^2)*3*x)/(x + sin(x)));
                                               [x/(x+sin(x)), 3*y*(y+3)]

Separation((3*y + x^2)*3*x/(x + sin(x)));
                                                             NULL

Separation(2^(x^2-y+2*x));
                                                 [2^(x^2+2*x), 2^(-y)]

 

Edit.

 

plottools:-getdata  command seems appeared in Maple 15. If you have an older version, you can use another method (see an example below):

op([1,1], plot(x^2, x=0..2));

                                                   

with(LinearAlgebra):
A := Matrix([[-2,1,1],[0,2,0],[-4,1,3]]);
Eigenvalues(A);

sys1 := Eigenvalues(A)[1]*IdentityMatrix(3)-A;
sys2 := Eigenvalues(A)[2]*IdentityMatrix(3)-A;
sys3 := Eigenvalues(A)[3]*IdentityMatrix(3)-A;

LinearAlgebra:-NullSpace(sys1); # for eigenvalue1
simplify(4*~LinearAlgebra:-NullSpace(sys2)); # for eigenvalue2

Addition. Of course it's easier to use Eigenvectors command for these purposes

The simple  Sylvester  procedure gives a direct solution to the problem of the type of definiteness of a symmetric square matrix by applying the Sylvester's criterion for all possible cases:

Sylvester:=proc(A)
local n, L1, L2;
uses LinearAlgebra, combinat:
n:=Dimension(A)[1];
L1:=[seq([$1..k], k=1..n)];
if `and`(seq(`if`(Determinant(A[k,k])>0,true,false), k=L1)) then return `Positive definite` else
if `and`(seq(`if`((-1)^nops(k)*Determinant(A[k,k])>0,true,false), k=L1)) then return `Negative definite` else
L2:=subsop(1=NULL, powerset([$1..n]));
if `and`(seq(`if`(Determinant(A[k,k])>=0,true,false), k=L2)) then return  `Positive semidefinite` else
if `and`(seq(`if`((-1)^nops(k)*Determinant(A[k,k])>=0,true,false), k=L2)) then return  `Negative semidefinite` else
`Indefinite` fi; fi; fi; fi;
end proc:


Examples of use:

Sylvester(<-1,2; 2,-5>);
                       Negative definite

Sylvester(<1,2; 2,3>);
                           Indefinite

Sylvester(<-5, 0, 0; 0, 0, 0; 0, 0, -1>);
                     Negative semidefinite

 

Use  is  command for this:

is(1000 < 5^(1/2));
                                    false

In Maple the number pi should be coded as  Pi  rather than pi . For numeric value use  evalf  command:

cos(Pi/2);
evalf[5](Pi);  
# Pi with 5 digits

                               0
                           3.1416
 

 

You have a space after  solve  command, which Maple in 2d math interprets as multiplication. Remove it and everything will work:

solve(arctan((2*x^2-1)/(2*x^2+1)) = 0, x);

                                         (1/2)*sqrt(2), -(1/2)*sqrt(2)

A little shorter:

e1_1:=-gamma*r*theta/(w*beta*(theta-1));
subs(1/(theta-1)=-1/(1-theta), e1_1);

                        

or even shorter:

subs(theta-1=-``(1-theta), e1_1);

 

Edit.

A:=[<5,5,5>, <1,2,3>, <-5,1,2>];
LinearAlgebra:-Basis(A);

You can calculate this double integral by writing it as an iterated one:

restart;
with(Student[Calculus1]):
a := Int(Int(exp(cos(x)), y = 0 .. sin(x)), x = 0 .. (1/2)*Pi) ;
ShowSolution(a);

                

 

 

First 151 152 153 154 155 156 157 Last Page 153 of 289