Rouben Rostamian

MaplePrimes Activity


These are questions asked by Rouben Rostamian

I want to make a 3D image of a US one cent coin (a penny).  To produce one face of the penny I thought of doing

plot3d(0, y=-sqrt(1-x^2)..sqrt(1-x^2), x=-1..1, image="penny.png");

but this distorts the circular image into something that's not quite circular:

What is a better way of doing that?

 

 

Here is the image penny.png that I used: 

I don't understand why Maple does not like my code:

restart;

with(plots):

dsol := dsolve({diff(y(t),t) = -y(t), y(0)=1}, numeric):

frame := proc(s)
  odeplot(dsol, [t,y(t)], t=0..s);
end proc:

animate(frame, [t], t=0..3);

Error, (in plots/animate) invalid range


I know how to get around it (as shown in the attached worksheet) but I am curious to know why the above approach does not work.

Download worksheet: mw.mw

 

I solve a boundary value problem for a linear system of first order PDEs
in the unknowns u(x, t) and "v(x,t)."  Ultimately, I am interested in the graph
of the function v(0, t) but numerical artifacts distort that graph badly by
imposing spurious oscillation.

Is there a way to maneuver the calculations to obtain the graph of v(0, t)
without the oscillation?

restart;

pde1 := diff(u(x,t),t)=diff(v(x,t),x);

diff(u(x, t), t) = diff(v(x, t), x)

pde2 := diff(u(x,t),x)=v(x,t);

diff(u(x, t), x) = v(x, t)

ibc := u(x,0)=1, u(0,t)=0, u(1,t)=0;

u(x, 0) = 1, u(0, t) = 0, u(1, t) = 0

dsol := pdsolve({pde1,pde2}, {ibc}, numeric, spacestep=0.01, timestep=0.01);

_m139872446597344

dsol:-value(output=listprocedure):
my_u := eval(u(x,t), %):
my_v := eval(v(x,t), %%):

plot3d(my_u(x,t), x=0..1, t=0..0.5);

plot3d(my_v(x,t), x=0..1, t=0..0.5);

The oscillations are numerical artifacts.  Can they be avoided?

plot(my_v(0,t), t=0..0.5);

A side comment: By eliminating vbetween the two PDEs we see that u
satisfies the standard heat equation, thus vis the flux.  The expression
v(0, t) expresses the heat flux at the boundary, and that's what I am after.
 


 

Download calculating-flux-in-the-heat-equation.mw

I expect this proc to return a matrix of all ones but it returns a matrix of all zeros.  Why does it do that?

doit := proc()  
  local i, j, M;                                     
  M := Matrix(3,3);                    
  for i from 1 to 3 do  
    for j from 1 to 3 do  
      M[i][j] := 1;                                      
    end do;                             
  end do;              
  return M;  
end proc:                                           

doit();                            
                                 [0    0    0]
                                 [           ]
                                 [0    0    0]
                                 [           ]
                                 [0    0    0]

 

We solve Laplace's equation in the domain a < r and r < b, c < t and t < d
in polar coordinates subject to prescribed Dirichlet data.

Maple produces a solution in the form of an infinite sum,
but that solution fails to satisfy the boundary condition
on the domain's outer arc.  Is this a bug or am I missing
something?

restart;

kernelopts(version);

`Maple 2019.1, X86 64 LINUX, May 21 2019, Build ID 1399874`

with(plots):

pde := diff(u(r,t),r,r) + diff(u(r,t),r)/r + diff(u(r,t),t,t)/r^2 = 0;

diff(diff(u(r, t), r), r)+(diff(u(r, t), r))/r+(diff(diff(u(r, t), t), t))/r^2 = 0

a, b, c, d := 1, 2, Pi/6, Pi/2;

1, 2, (1/6)*Pi, (1/2)*Pi

bc := u(r,c)=c, u(r,d)=0, u(a,t)=0, u(b,t)=t;

u(r, (1/6)*Pi) = (1/6)*Pi, u(r, (1/2)*Pi) = 0, u(1, t) = 0, u(2, t) = t

We plot the boundary data on the domain's outer arc:

p1 := plots:-spacecurve([b*cos(t), b*sin(t), t], t=c..d, color=red, thickness=5);

Solve the PDE:

pdsol := pdsolve({pde, bc});

u(r, t) = Sum((1/6)*cos(3*signum(n1-1/4)*(-1+4*n1)*t)*(2*Pi*sin((1/2)*signum(n1-1/4)*Pi)*abs(n1-1/4)-6*Pi*sin((3/2)*signum(n1-1/4)*Pi)*abs(n1-1/4)+cos((3/2)*signum(n1-1/4)*Pi)-cos((1/2)*signum(n1-1/4)*Pi))*signum(n1-1/4)*8^(signum(n1-1/4)*(4*n1+1))*(r^((-3+12*n1)*signum(n1-1/4))-r^((3-12*n1)*signum(n1-1/4)))/(abs(n1-1/4)*Pi*(-1+4*n1)*(16777216^(signum(n1-1/4)*n1)-64^signum(n1-1/4))), n1 = 0 .. infinity)+Sum(-(1/3)*((-1)^n-1)*sin(n*Pi*ln(r)/ln(2))*(exp((1/6)*Pi*n*(Pi+6*t)/ln(2))-exp((1/6)*Pi*n*(7*Pi-6*t)/ln(2)))/(n*(exp((1/3)*n*Pi^2/ln(2))-exp(n*Pi^2/ln(2)))), n = 1 .. infinity)

Truncate the infinite sum at 20 terms, and plot the result:

eval(rhs(pdsol), infinity=20):
value(%):
p2 := plot3d([r*cos(t), r*sin(t), %], r=a..b, t=c..d);

Here is the combined plot of the solution and the boundary condition.
We see that the proposed solution completely misses the boundary condition.

plots:-display([p1,p2], orientation=[25,72,0]);


 

Download mw.mw

First 7 8 9 10 11 12 13 Last Page 9 of 17