Adri van der Meer

Adri vanderMeer

1420 Reputation

19 Badges

21 years, 152 days
University of Twente (retired)
Enschede, Netherlands

MaplePrimes Activity


These are replies submitted by Adri van der Meer

with(plots):
p1 := polarplot(max(2+cos(x), 2), x = 0 .. 2*Pi, filled = [color=yellow]):
p2 := polarplot(min(2+cos(x), 2), x = 0 .. 2*Pi, filled = [color=white,transparency=0]):
p3 := polarplot([2+cos(x), 2], x = 0 .. 2*Pi, color = [red, blue]):
display( [p3,p2,p1] );

with(plots):
p1 := polarplot(max(2+cos(x), 2), x = 0 .. 2*Pi, filled = [color=yellow]):
p2 := polarplot(min(2+cos(x), 2), x = 0 .. 2*Pi, filled = [color=white,transparency=0]):
p3 := polarplot([2+cos(x), 2], x = 0 .. 2*Pi, color = [red, blue]):
display( [p3,p2,p1] );

... and you must change

if g(a)*g(b) < 0 

to

if evalf(g(a)*g(b)) < 0 

in the loop

... and you must change

if g(a)*g(b) < 0 

to

if evalf(g(a)*g(b)) < 0 

in the loop

@Willem Ottevanger I think that subs is the best possibility because you intend to lose the information that f is a function of x.

@Willem Ottevanger I think that subs is the best possibility because you intend to lose the information that f is a function of x.

Now I understand that it is not possible (at least not efficient) to try to extract points on the surface from the plot structure. Draghilev method (one-man) is a good suggestion.

Now I understand that it is not possible (at least not efficient) to try to extract points on the surface from the plot structure. Draghilev method (one-man) is a good suggestion.

@Carl Love Something got lost after an < -sign!

Implicitplot3d gives a sort of triangularization. You can extract points as follows:

q := plots:-implicitplot3d( x^2+y^3+z^4=1 ,x=-1..1,y=-1..1,z=-1..1 ):
pdata := plottools:-getdata(q); # doesn't work
Q := op(op(1,q));
convert(Q,listlist): R :=(ListTools:-FlattenOnce@@2)(%):
R[129]; #contains [x,y,z,f(x,y,z)]
B := select(A->abs(A[4])<1e-2,R); # only points with f(x,y,z)=0
B[5,1]^2+B[5,2]^3+B[5,3]^4; #check


Your equation is quite unclear. Perhaps you mean something like

diff(z(t),t,t) = (sqrt(diff(z(t)^2,t) + 10^10*z(t)^2)*diff(z(t),t) + 10^10*z(t))*diff(z(t),t);

In this case: rewrite the equation into a system of two equations: diff z(t),t) = y(t), diff(y(t),t) = ...
See ?DEplot

I encountered a similar problem in Ladder animation. Sometimes the whole curve disappears when complex values are calculated.
In your example

plot(Re(sqrt(75-3*x^2)));

will work.

I think it is a bug in Maple 16.

@dipamilo For finding the indices, you must use a simple procedure.
I generalize your problem a little (n rows and m columns in a):

restart; with(ArrayTools): 
n := 2: m := 4:
f:=5*RandomArray(1,n*m);
F := convert(f,Vector):
a:=map(ceil,n*m*RandomArray(n,m));
c_val := seq( min( seq( F[a[j,i]], j=1..n ) ), i=1..m );

indmin := proc(v)
  local k,j;
  k := 1:
  for j from 2 to n do if F[v[j]]<F[v[k]] then k := j end if end do:
  v[k]
end proc:
c_ind := seq( indmin(a[..,i]), i=1..m );


@dipamilo For finding the indices, you must use a simple procedure.
I generalize your problem a little (n rows and m columns in a):

restart; with(ArrayTools): 
n := 2: m := 4:
f:=5*RandomArray(1,n*m);
F := convert(f,Vector):
a:=map(ceil,n*m*RandomArray(n,m));
c_val := seq( min( seq( F[a[j,i]], j=1..n ) ), i=1..m );

indmin := proc(v)
  local k,j;
  k := 1:
  for j from 2 to n do if F[v[j]]<F[v[k]] then k := j end if end do:
  v[k]
end proc:
c_ind := seq( indmin(a[..,i]), i=1..m );


You will see that the circular curve disappears in the last frame. This has to do with rounding errors. The last sqrt is a complex number with a small imaginary part. You can avoid this by replacing the third command by

C := animatecurve( [1/2*p,1/2*Re(sqrt(4-p^2)), p = 0..2], frames=50 ):
4 5 6 7 8 9 10 Page 6 of 11