vv

13827 Reputation

20 Badges

9 years, 316 days

MaplePrimes Activity


These are answers submitted by vv

(Using Rouben's suggestion.)

fn:=cat(kernelopts(homedir),"/Elsymfun.txt");
save(`convert/elsymfun`,fn):  close(fn):
sf:=readbytes(fn,infinity,TEXT):
sf:=StringTools:-Subs([") local vars," = ", vars::set(name)) local ", "elsy"="Elsy", "vars := indets(p);"=""], sf): 
close(fn):writebytes(fn,sf):close(fn):read(fn):

u := a*(x+y) + b*(x^2+y^2) + a*b*(x^3+y^3):
convert(u, elsymfun);
      Error, (in convert/elsymfun) polynomial is not symmetric
convert(u, Elsymfun, {x,y});
       a*b*(x+y)^3-3*a*b*(x+y)*x*y+b*(x+y)^2+a*(x+y)-2*b*x*y

 

 

Maybe something like this.

imagefile := cat(kernelopts(datadir), "/images/fjords.jpg"):
plot3d(1-x^2-y^2,x=-1..1,y=-1..1, image = imagefile);

Note that the image file can be obtained from any plot/plot3d.

restart;
select(u->type(convert(u,symbol),procedure), convert([seq(33..127)],compose,bytes,list));

        ["$", "*", "+", "-", ".", "/", "<", "=", ">", "@", "D", "^", "~"]

 

 

 

 

diffeq := diff(y(t),t,t,t,t)+10*diff(y(t),t,t)+169*y(t)=0:

ic:= y(0)=0, D(y)(0)=1;
D(y)(infinity)=0;

y(0) = 0, (D(y))(0) = 1

 

(D(y))(infinity) = 0

(1)

s:=dsolve({diffeq,ic},y(t));

y(t) = (1/3-(4/3)*_C4-_C3)*exp(-2*t)*sin(3*t)-_C4*exp(-2*t)*cos(3*t)+_C3*exp(2*t)*sin(3*t)+_C4*exp(2*t)*cos(3*t)

(2)

Y:=rhs(s);

(1/3-(4/3)*_C4-_C3)*exp(-2*t)*sin(3*t)-_C4*exp(-2*t)*cos(3*t)+_C3*exp(2*t)*sin(3*t)+_C4*exp(2*t)*cos(3*t)

(3)

Y1:=diff(Y,t);

-2*(1/3-(4/3)*_C4-_C3)*exp(-2*t)*sin(3*t)+3*(1/3-(4/3)*_C4-_C3)*exp(-2*t)*cos(3*t)+2*_C4*exp(-2*t)*cos(3*t)+3*_C4*exp(-2*t)*sin(3*t)+2*_C3*exp(2*t)*sin(3*t)+3*_C3*exp(2*t)*cos(3*t)+2*_C4*exp(2*t)*cos(3*t)-3*_C4*exp(2*t)*sin(3*t)

(4)

map(limit,[op(Y1)], t=infinity);

[0, 0, 0, 0, undefined, undefined, undefined, undefined]

(5)

op([5..8],Y1);

2*_C3*exp(2*t)*sin(3*t), 3*_C3*exp(2*t)*cos(3*t), 2*_C4*exp(2*t)*cos(3*t), -3*_C4*exp(2*t)*sin(3*t)

(6)

Ysol:=eval(Y,[_C3=0,_C4=0]); #otherwise Y'(infinity) does not exist

(1/3)*exp(-2*t)*sin(3*t)

(7)
Sievert := proc (B)
local a, b, denom, m, X;
a := sinh(B)*u; b := cosh(B)*v;
denom := sinh(B)*((cosh(2*a)-cos(2*b))*cosh(2*B)+2+cosh(2*a)+cos(2*b));
m := cosh(B)*<sinh(a), sin(b)*cos(v), sin(b)*sin(v)> + <0, -cos(b)*sin(v), cos(b)*cos(v)>;
X := <u, 0, 0>-8*cosh(B)*cosh(a)*m/denom;
end proc:

 

You may use:

plot(10^10*x, x = 0 .. 5,labels = ["x", typeset(10^`10`*Delta*z)],labeldirections = ["horizontal", "vertical"]);

Actually, typeset is not needed here, labels = ["x",10^`10`*Delta*z]  is OK.

When you integrate the function sqrt(x)*sqrt((x+1)/x)
you probably assume (correctly for a high school level) that x>0.

For this domain ==> sqrt(x)*sqrt((x+1)/x) = sqrt(x+1)
and the antiderivative is obvious.
But this equality is not true for an arbitrary x (for example for x<0) and the "test" fails.
Note that actually Maple executes (under the hood)
is( sqrt(x)*sqrt((x+1)/x) = sqrt(x+1) );
     false

You must tell Maple to test this relation for x>0 only.
This can be done e.g. using

is(sqrt(x)*sqrt((x+1)/x) = sqrt(x+1))  assuming x>0;
     true

(see also ?assume)

Now, if you want only "clickable math" (which I don't recommend)
then you will have to simplify

sqrt(x)*sqrt((x+1)/x) - sqrt(x+1)

via the context menu  Simplify > Assuming positive
and the result will be 0.
[Note that using the context menu you have access only to a small part of the available commands].

For "normal" situations the implicit equation of the surface is  min(f,g)=0.
Unfortunately Maple does not plot as nice as Mathematica, but acceptable.

(It seems that Mathematica parametrizes the surface.)

with(plots):
f:=1-max(abs(x),abs(y),abs(z)):
g:=1.5-(x^2+y^2+z^2):
plots:-implicitplot3d(min(f,g)=0, x=-1.6..1.6,y=-1.6..1.6, z=-1.6..1.6, 
       numpoints=500000, scaling=constrained, color=green, style=surface, axes=none );
f:=1-(x^2+y^2+z^2):
g:=z^2-x^2-y^2:
plots:-implicitplot3d(min(f,g)=0, x=-1..1,y=-1..1, z=-1..1, 
       numpoints=500000, scaling=constrained, color=green, style=surface, axes=none);


F(x,y,...) = f(x) * g(y) * ...

Sep:=proc(F::algebraic,X::set(name=algebraic))
local r,u,n:=nops(X);
r:=`.`(eval(1/F,X)^(n-1), seq( eval(F, X minus {u}),u=X) );
F=r,  is(simplify(F=subs(`.`=`*`,r)));
end:

############################################################

Sep( exp(x^2-y^2+x-2), {x=0,y=0});

exp(x^2-y^2+x-2) = (exp(x^2+x-2).exp(-y^2-2))/exp(-2), true

(1)

F:=sin(2*y-2*z+x)+sin(2*y+2*z+x)+sin(-2*z+x-2*y+2)+sin(2*z+x-2*y+2)

sin(2*y-2*z+x)+sin(2*y+2*z+x)+sin(-2*z+x-2*y+2)+sin(2*z+x-2*y+2)

(2)

Sep(expand(F), {x=0,y=0,z=0});

8*sin(y)*cos(y)*cos(x)*cos(z)^2-4*sin(x)*sin(2)*sin(y)*cos(y)+4*cos(x)*cos(2)*sin(y)*cos(y)+8*cos(z)^2*sin(x)*cos(2)*cos(y)^2+8*cos(z)^2*cos(x)*sin(2)*cos(y)^2+2*sin(x)+2*sin(x)*cos(2)+2*cos(x)*sin(2)-4*sin(x)*cos(z)^2-4*cos(y)^2*sin(x)-4*sin(x)*cos(2)*cos(y)^2-4*cos(x)*sin(2)*cos(y)^2-4*cos(z)^2*sin(x)*cos(2)-4*cos(z)^2*cos(x)*sin(2)+8*cos(y)^2*sin(x)*cos(z)^2-4*sin(y)*cos(y)*cos(x)+8*cos(z)^2*sin(x)*sin(2)*sin(y)*cos(y)-8*cos(z)^2*cos(x)*cos(2)*sin(y)*cos(y) = (1/4)*(`.`(2*sin(x)*cos(2)+2*cos(x)*sin(2)+2*sin(x), 4*sin(y)*cos(y)-4*cos(2)*sin(y)*cos(y)+4*sin(2)*cos(y)^2-2*sin(2), 4*cos(z)^2*sin(2)-2*sin(2)))/sin(2)^2, true

(3)

combine((rhs(%[1])));

-(`.`(2*sin(x+2)+2*sin(x), 2*sin(2*y)-2*sin(2*y-2), sin(2+2*z)-sin(-2+2*z)))/(-2+2*cos(4))

(4)

 

Click the expression, use the menu   Format > Convert To > 1-D Math Input
then delete the unwanted pair    condition, expr
Then convert back to 2-D if you want.

Maybe this will convince you to use 1-D all the time!

 

facxy:=proc(F::algebraic, X::name=anything, Y::name=anything)
  local f:=eval(F,Y), g:=eval(F,X), c; 
  c:=eval(F,[X,Y])/eval(f,X)/eval(g,Y);
  F=c . f . g, is(F=c*f*g)
end:

facxy(  ((3*y + y^2)*3*x)/(x + sin(x)), x=Pi, y=1);

 

facxy(2^(x^2-y+2*x), x=0, y=0);

        
      
facxy(cos(x + y + 1) + sin(x - 1)*sin(y + 2),   x=1, y=-2);

         cos(x+y+1)+sin(x-1)*sin(y+2) = cos(x-1) . cos(y+2), true    

match should work but is too limited.
solve/identity works only for one variable.
So an ad-hoc solution seems to be needed.

e:= x^2+y^2-8*x-12*y-92:
g:= (x+a)^2+(y+b)^2+c:
solve([coeffs(expand(e-g), [x,y])]);

                   {a = -4, b = -6, c = -144}
eval(g,%);
                    (x - 4) ^2 + (y - 6)^2  - 144

 

Edit. I have not noticed acer's solution  Student:-Precalculus:-CompleteSquare(e);
which is simpler in this case.

 

1. An equality such as your sys1 cannot be minimized.

2. E.g.  (-0.99)^(2.3)  is not real, is it?

The problem reduces to show that a "reduced" quadratic form is negative definite.
(see e.g.  Ruszczynski A., Nonlinear optimization, PUP, 2006, p. 149).

hessian-question-max-ok.mw

 

To test whether a matrix A is positive/negative semidefinite one may use the LinearAlgebra commands

LinearAlgebra:-IsDefinite(A, 'query' = 'positive_semidefinite');
LinearAlgebra:-IsDefinite(A, 'query' = 'negative_semidefinite');

It is also possible to compute the minors (Sylvester theorem, the semidefinite case) but for a matrix of order
n there are 2^n - 1 such minors, so the method is very inefficient.

 

 

 

First 85 86 87 88 89 90 91 Last Page 87 of 120