Adri van der Meer

Adri vanderMeer

1350 Reputation

18 Badges

14 years, 213 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity


These are answers submitted by Adri van der Meer

If you replace

z:=H/mg*(cosh(mg/H*x+zeta)-cosh(zeta));

  by

z :=  x -> H/mg*(cosh(mg/H*x+zeta)-cosh(zeta));

the shifted plot wil be:

plot(z(x+deltax), x=0..1 );

 

Why should you use a procedure if you don't want to use a parameter sequence? But if so, you can refer to parameters outside the procedure via the -: operator. A simple example:

restart;

p,q := x^2+2*x+1, x^2-3*x+5:

f := proc()
  solve(:-p + :-q = 0,{x})
end proc:

f();

{x = 1/4+((1/4)*I)*47^(1/2)}, {x = 1/4-((1/4)*I)*47^(1/2)}

(1)

 

Download NoArguments.mw

The assignment x := LinearSolve(A, b) makes x a Vector (with parameter _t2), so it cannot be used as a range parameter. Replace it by v := LinearSolve(A, b), and don't forget to restart.

R2 is an 1x1-matrix, as to expect:

lprint(R2);
Matrix(1, 1, {(1, 1) = 44}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

 

Make an operator that for multiplies the identity function with the derivative:

restart;

xD := f ->(x->x)*D(f);

proc (f) options operator, arrow; (proc (x) options operator, arrow; x end proc)*D(f) end proc

(1)

(xD@@2)(f)(y);

y*((D(f))(y)+y*((D@@2)(f))(y))

(2)

 

 

Download D_operator.mw

Because x and y are constants, there is no reason to try to calculate the sum symbolically.

add(binomial(y, i)*(1/3)^i*(2/3)^(y-i)*(add(binomial(x, j)*(1/3)^j*(2/3)^(x-j), j = i+1 .. x)), i = 0 .. y);

Make the colorbar as a separate 3D-plot, viewed from above (P2 in the worksheet)

restart; with(plots):
X2 := <seq(i,i=1..25)>:
X3 := <seq(2*i,i=1..25)>:
zz := <seq(-i^2+23*i+53,i=1..25)>:
M,m := max(zz),min(zz):
P1 := pointplot3d(X2, X3, zz, symbol=solidcircle, symbolsize=20, shading=zhue, orientation=[75,60,0]):
P2 := plot3d( y, x=0..20, y=m..M, style=patchnogrid, shading=zhue,orientation=[-90,0,0],tickmarks=[0,default,0], labels=["","zz",""],scaling=constrained ):
display( Array([P1,P2]) );

 








 

If you don't want to plot (a) solution curve(s), use dfieldplot:

dfieldplot(DE3, [y(x), z(x)], x = 0 .. 3, y = 0 .. 2, z = -4 .. 4, arrows = medium, dirgrid=[20,20]);

If you use a loop to place (some) answers in a set, it is more efficient to use a sequence as intermediate:

restart;

S := NULL: #empty sequence

for i to 5 do S := S,i end do:

S1 := {S}; #makes a set from the sequence S

{1, 2, 3, 4, 5}

(1)

 

Download Makeset.mw

To interchange the horizontal and the vertical axis, make F13 a parametrisized plot:

F13 := plot([-0.2e-1*sin(6*Pi*y),y, y = 0.25e-1*L .. .475*L], scaling = constrained):

The x=X substitution is not necessary:

Diameters := unapply(subs(Data, piecewise(x<L/2, d0 ,x<2/3*L, 2*d0 ,x>2/3*L, 1.5*d0)),x);

Use * (asterisk) instead of . (dot) for multiplication:

x1 := solve(x1+2/3*x2=0,x1);

plot( [Re(f(x)),Im(f(x)),abs(f(x))], x=0.2..0.4,
       legend=["Re(f)","Im(f)","|f|"] );

while k<100000 do x:=f(x): k:=k+1 :
  if(x>0 and x<1) then a:=a+1
  elif x<2 then b:=b+1
  elif x<3 then c:=c+1
  elif x<4 then d:=d+1
  end if :
end do:

(edited)

1 2 3 4 5 6 7 Last Page 1 of 27