vv

14112 Reputation

20 Badges

10 years, 136 days

MaplePrimes Activity


These are answers submitted by vv

 

The exact solution (just for fun).

restart;

h:=1: g:=1:  r:=1/2:

v0:=sqrt(2*g*h):

T:= n -> v0/g*(1+r-2*r^n)/(1-r):

Too := v0/g*(1+r)/(1-r): # = T(infinity)

Y:=proc(t)
local n := floor( ln(-t*sqrt(2)*g*(1-r)/(4*sqrt(g*h))+1/2+(1/2)*r)/ln(r) ),
      tau:= t - T(n);
piecewise(t<Too, v0*r^n*tau - g/2*tau^2, 0)
end:

plot(Y(t), t=0..Too, size=[1200,800]);

 

Y(t);

piecewise(t < 3*sqrt(2), sqrt(2)*(1/2)^floor(-ln(-(1/8)*t*sqrt(2)+3/4)/ln(2))*(t-2*sqrt(2)*(3/2-2*(1/2)^floor(-ln(-(1/8)*t*sqrt(2)+3/4)/ln(2))))-(1/2)*(t-2*sqrt(2)*(3/2-2*(1/2)^floor(-ln(-(1/8)*t*sqrt(2)+3/4)/ln(2))))^2, 0)

(1)

Too;

3*2^(1/2)

(2)

 

Probably the designers considered that the color, linestyle, thickness are enough for the legend (which I also do).

Anyway, the symbols seem to be useless here because their exact position is not known.

You have the Physics package loaded. It redefines many things, including diff.
The conversion works as expected if you don't use the package (which is not needed in the worksheet).

If you have the curve in polar coordinates, then DirectSearch or fsolve is not needed.
Something like this (for a modified cardioid):

r:=t->2*(1-cos(t))+1:
plots:-animate(plot, 
[[[r(t-u)*cos(t),r(t-u)*sin(t),t=0..2*Pi] ,
[[0,r(Pi/2-u)*sin(Pi/2)],[0,2+r(Pi/2-u)*sin(Pi/2)]]   ],thickness=[1,6]],
u=0..2*Pi, scaling=constrained);

You cannot use plot3d(f(x,y)=0.1, x=0..1,y=0..1);
Probably you want plots[implicitplot](f(x,y)=0.1, x=0..1,y=0..1);

For z=0..1  just use the view option.
Compare:

plot3d(x^2+y^2, x=-1..1, y=-1..1);
plot3d(x^2+y^2, x=-1..1, y=-1..1, view=0..1);


 

In my opinion the student should be taught to use a single simple line of code

s := n -> s(n-1)^2 - 2;   s(1) := 4;

defining his own sequence:
s(4);
     
37634
 seq(s(n), n=1..5);  
     
4, 14, 194, 37634, 1416317954

evalindets treats the type `*` using the internal representation rather than using op.
For example 5*x^3*y  and a*x^3*y  have distinct internal representations (check with dismantle).
The next procedure has not this problem.

M:=proc(f::polynom,x,y)
local i,t, a:=coeffs(f,[x,y],t);
add(a[i]* m[degree(t[i],x),degree(t[i],y)], i=1..nops([a]));
end;

M(5*x^3*y+13*a*y^2+z, x,y);

  

 

Your notations and manipulations are unusual.

But the problem is a bug in (inv)hilbert:

 

H1:=inttrans:-hilbert(exp(t)*sin(s+A), s, x);  combine(%);  #ok

exp(t)*cos(A)*cos(x)-exp(t)*sin(A)*sin(x)

 

exp(t)*cos(x+A)

(1)

H2:=inttrans:-hilbert(exp(t)*sin(B)*sin(s+A), s, x); # bug

exp(t)*sin(B)*cos(x)

(2)

H3:=inttrans:-hilbert(exp(t)*b*     sin(s+A), s, x); #ok

-sin(A)*exp(t)*b*sin(x)+exp(t)*cos(A)*b*cos(x)

(3)

You have a mess in your arguments. You substitute f(t,s)  but keep  s,x?
Actually it is not clear which is the intended  function  subject to invhilbert.

Sierpinski:=proc(n,cir:=true)
local L:=[[0,sqrt(3)],[-1,0],[1,0],[0,sqrt(3)]], S;
S:=proc(a,b,c)
  L:=L,[(b+c)/2,(a+c)/2,(a+b)/2,(b+c)/2];
  if (c[1]-b[1])>2^(-n+2) then
     S(a,(a+b)/2,(a+c)/2);
     S((a+b)/2,b,(c+b)/2);
     S((a+c)/2,(b+c)/2,c) fi;
  end;
S([0,sqrt(3)],[-1,0],[1,0]);
plot([L],axes=none,scaling=constrained,thickness=0,title="Sierpinski "||(nops([L])),color=blue);
plots:-display(%,`if`(cir,plot([L], style=point,symbol=circle,symbolsize=10,color=blue),NULL));
end:
Sierpinski(4); Sierpinski(7,false);

    a = b mod n;

is interpreted as

   a = (b mod n)
or (by default) as
    a = modp(b, n)

see, the help page ?operators,precedence

So, 

3 = 0 mod 3;
                             3 = 0
0 = 3 mod 3;
                             0 = 0

 

 

 

eqs:=t^2*x^2 + t*x + 2*x - 1=0, t^2*y^3 + t*y^2 + 2*y - 1=0, 2*t^2*z^3 + t*z + 3*z - t^2=0:
sol:=solve({eqs,x>0},{x,y,z}, explicit,allsolutions):
plots:-spacecurve(eval([x,y,z],sol), t=0..4,color=red);

Note that x>0 eliminates the "x" solution not defined at t=0.

First 73 74 75 76 77 78 79 Last Page 75 of 121