Kitonum

21550 Reputation

26 Badges

17 years, 123 days

MaplePrimes Activity


These are replies submitted by Kitonum

@rlopez  I think for the beginner your method is the simplest and most understandable solution to the problem. When I wrote about two ways, I just forgot about this method. So we already have 3 ways.

@Markiyan Hirnyk  You did not answer my question (...to display successive frames of animation). On the animation bar (if you use  plots:-animate  command) there is a special button that allows you to do this.

@Markiyan Hirnyk  How do you expect to display successive frames of animation with a specific step in this case?

@Rouben Rostamian   min(a,b) = (a + b - abs(a - b))/2

@one man  Try in the procedure to replace  r:=sqrt(add(d^~2))  with  r:=sqrt(`+`((d^~2)[ ]))  or  r:=sqrt(add(d[i]^2, i=1..nops(d))) .  Do not forget to restart first.

@Harry Garst  Here are three simple examples that confirm your observation:

Expr1:=a/(a+b+c);
algsubs(a+b+c=d, Expr1);

Expr2:=b/(a+b+c);
algsubs(a+b+c=d, Expr2);

Expr3:=c/(a+b+c);
algsubs(a+b+c=d, Expr3);

 

We see that the result depends on the position:  a  is the first in  a+b+c

The code snippet that you submitted works as expected. Give the complete code with which you have problems.

my_proc:=proc(func::`+`) 
    subs([x[1] = 2, x[2] = 1], func);
end proc:

func:=5 + x[1]*x[2] + 10*x[1];
my_proc(func);

                                      func := x[1] x[2] + 10 x[1] + 5
                                                         27
 

@Rouben Rostamian  A brilliant solution, which is better than mine. Unfortunately, there are examples with which it fails, eg for  cos(x+y+1)+sin(x-1)*sin(y+2)

PS. It is worth noting that Mathematica copes with this:
Simplify[Cos[x + y + 1] + Sin[x - 1]*Sin[y + 2]]
                     Cos[1 - x] Cos[2 + y]

@nm  I adjusted the procedure a little. Now it works with exp function, but still does not work with sqrt:

Separation(exp(x^2-y));

                               [exp(x^2), exp(-y)]

@idol050279  I do not understand what relation CrossSectionTutor command has to the points inside the cylinder. This command simply shows the intersection lines of some surface with a set of planes.
Write more clearly what exactly you want to achieve.

@acer  But why  match  command fails with this example (in Maple 2017.1). Is this a bug?

restart;
e:= x^2+y^2-8*x-12*y-92:
g:= (x+a)^2+(y+b)^2+c:
match(e=g, {x,y}, 's');
s;

                            false
                               s

                           
 

 


 

@Christopher2222  Change the ranges for the plotting:

restart;
F := x^2+y^2+a*x+b*y+c:
XY := [[8,0], [4,4], [14,4]]:
minimize(add((eval(F, {x = XY[i, 1], y = XY[i, 2]}))^2, i = 1 .. nops(XY)), location);
assign(op(%[2])[1]):
A := plot(XY, style = point, symbolsize = 15, symbol = solidcircle, color = red):
B := plots[implicitplot](F, x = -1 .. 15, y = -1 .. 11, color = green):
plots[display](A, B, scaling = constrained);

@ernilesh80  You wrote "can I also get  sign (positive or negative) of determinant of all possible 63 principal minors? "

Any principal minor is determined by some sublist of the list  [1,2, ..., n]  (A is a square matrix n x n). Here is a procedure that returns the positions and determinants of all leading principal minors (lpm) or principal minors (pm) of a matrix A:

Minors:=proc(A, p)
local n, L1, L2;
uses LinearAlgebra, combinat:
n:=Dimension(A)[1];
L1:=[seq([$1..k], k=1..n)];
if p=lpm then return seq(k=Determinant(A[k,k]), k=L1) else
L2:=subsop(1=NULL, powerset([$1..n]));
seq(k=Determinant(A[k,k]), k=L2) fi;
end proc:

 

Example of use:

A:=LinearAlgebra:-RandomMatrix(3, shape=symmetric);
Minors(A, lpm);  
# Leading principal minors
Minors(A, pm);  # Principal minors


 


 

 

@mohkam7  A slight adjustment of the procedure allows you also to work with polynomials containing symbolic coefficients, provided that conditions are imposed on them:

ClassTerms1:=proc(P::polynom, S::list(symbol), Ass::set:={})
local C, t, T, Terms, Tp, Tn, Tind;
C:=[coeffs(P,S,'t')];
T:=[t];
Terms:=convert(zip(`[]`,C,T),set);
Tp:=select(p->is(p[1]>0) and `and`(seq(type(degree(p[2],s),even), s=S)), Terms) assuming op(Ass);
Tn:=select(p->is(p[1]<0) and `and`(seq(type(degree(p[2],s),even), s=S)), Terms minus Tp) assuming op(Ass);;
Tind:=Terms minus `union`(Tp,Tn);
print(P_positive={seq(p[1]*p[2],p=Tp)});
print(P_negative={seq(p[1]*p[2],p=Tn)});
print(P_indeterminate={seq(p[1]*p[2],p=Tind)});
end proc:


Example of use:

ClassTerms1(a*x^2+b*x*y-c*y^2+d*x^2*y^2+x-5, [x,y], {a<0,b>0,c<0,d<0});

@Jalale  You can use  Explore  command to create similar animations with sliders. See help on this command.

First 61 62 63 64 65 66 67 Last Page 63 of 133