vv

14092 Reputation

20 Badges

10 years, 95 days

MaplePrimes Activity


These are answers submitted by vv

It is strange that convert(...,tanh) does not work as expected.
For example, convert(sinh(x), tanh)  works but convert(exp(x), tanh) does not.

`convert/exp2tanh`:=proc(ex)
  simplify(eval(ex, exp = (t -> (tanh(t/2)+1)/(1-tanh(t/2)))))
end;

convert(exp(3*x),exp2tanh);

       

Expr:=-(exp(-a*s)-1)*kw/((exp(-a*s)+1)*s^2):

convert(Expr,exp2tanh);

    

PerfectRandom := proc()
  return 4  # Chosen by fair dice roll, guaranteed to be random
end proc:

Example:

PerfectRandom();
        4

Output:=Array(-10..10,-10..10, (i,j)->i^2+j^2):
plots:-surfdata(Output);

Let f be a real function defined on [a,b].

If f has an antiderivative F (on [a,b]) then F is by definition differentiable, hence continuous.
But f could have infinitely many discontinuities and could be non-integrable (Riemann or even Lebesgue).

Note that there exist other (generalized) integrals such as Denjoy; in this context f becomes integrable
and Newton-Leibniz applies. However the Denjoy integral is not usually considered even at a university level.

The simplest example of a function not integrable (Riemann or Lebesgue) but having an antiderivative
is  f(x) = F'(x), F(x) = x^2*sin(1/x^2), x∈[-1,1]∖{0}, F(0) = 0. Note that f is discontinuous at 0.

 

(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    

First 86 87 88 89 90 91 92 Last Page 88 of 121