Adri van der Meer

Adri vanderMeer

1400 Reputation

19 Badges

20 years, 136 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

Your question is not very specific. Perhaps you want to make a procedure, with n as a parameter.
For example:

f := proc(n::posint)
local A,i;
A := Vector(n);
for i to n do
A[i] := ...
end do;
A;
end proc:
plot( x^3, x=-8..8, y=-10..10 );

or

plot( x^3, view=[-8..8, -10..10] );

In the first way the label "y" is used for the vertical axis, in the second way there is no label.

Firstly, notice that f is a twodimensional (1×8) array, so you need two indices to get the entries: f[1,1], f[1,2] etc.
So I make F a Vector.

I suppose that the matrix a is meant to contain indices for the array a. Then I get:


restart; with(ArrayTools):

f:=5*RandomArray(1,8);

f := Matrix(1, 8, {(1, 1) = .64953, (1, 2) = 4.67005, (1, 3) = 3.89584, (1, 4) = 2.65399, (1, 5) = .26975, (1, 6) = .37927, (1, 7) = 2.83911, (1, 8) = 1.90223})

(1)

F := convert(f,Vector):

a:=map(ceil,8*RandomArray(2,4));

a := Matrix(2, 4, {(1, 1) = 8, (1, 2) = 1, (1, 3) = 8, (1, 4) = 8, (2, 1) = 7, (2, 2) = 6, (2, 3) = 7, (2, 4) = 4})

(2)

min( seq( F[a[j,1]], j=1..2 ) );
# the minimum of {F[8],F[7]}

HFloat(1.9022292348767833)

(3)

c := seq( min( seq( F[a[j,i]], j=1..2 ) ), i=1..4 );

HFloat(1.9022292348767833), HFloat(0.3792714478153181), HFloat(1.9022292348767833), HFloat(1.9022292348767833)

(4)

 


Download dipamilo.mw

If you want the results as the third column in the excelsheet, you can do

Q := Import( "Test.xls",1, "A1:B20" );
f := (x,y) -> 2*x+y;
C := f~(Q[..,1],Q[..,2]); # a short alternative for zip
Export( C, "Test.xls", 1, "C1" );

Edited:
I didn't see Preben Alsholms answer.

You want to see a combination of three animations:
(1) a picture of the sliding ladder;
(2) the position of its midpoint;
(3) the trace of the midpoint position.

First, you have to choose the parameter. I take the x-coordinate of the lower endpoint.
Plot the ladder as a line through the point on the wall and the point on the floor.

with(plots):
A := animate(plot, [[p,0],[0,sqrt(4-p^2)]], p = 0..2, frames=50 ): # ladder
B := animate(pointplot, [1/2*[p,sqrt(4-p^2)]], p = 0..2, symbol=solidcircle, symbolsize=20, frames=50 ):
C := animatecurve( [1/2*p,1/2*sqrt(4-p^2), p = 0..2], frames=50 ): # trace of the midpoint
display( {A,B,C} );


(1) Export the picture as an .eps file
(2) Display it by Ghostview and look for the bounding box cordinates: you will see a dashed box around the picture end a moveable cross. Look for the coordinates of the desired bounding box (down left and up right), and write these on a piece of paper.
(3) Now edit your epsfile using a texteditor, and change the bounding box.

I changed sin2.pdf to sin3.pdf

(I cannot upload *.eps-files)

inttrans[laplace]( simplify(hypergeom( [5],[4],t ),hypergeom), t,s );

A cubic spline is a piecewise defined continuous function hat interpolates the data points, see ?spline for more information. So the curve goes exactly through all the data points. If you want a single third degree polynomial that approximates the data points, you must use the LeastSquares approximation.:

p3 := CurveFitting:-LeastSquares(L, x, curve=a*x^3+b*x^2+c*x+d ):

P1 := plot( p3, x=0..50 ):
P2 := pointplot(L):
display(P1,P2);

but this is probably not what you really want.

Your main problem is that you are not quite clear about what the input and the output of your procedure is supposed to be. When you choose the data as the input, and a function x → m*x+b as output, you can do something like

VerticalRegression := proc(data)
  local err, vertical, distance, VerticalLine, m,b,s;

# (then define each local variable)

s := solve( {diff(distance(vertical(m, b), data), b) = 0,
             diff(distance(vertical(m, b), data), m) = 0}, {b, m} );
unapply( subs(s, m*x+b), x ) #output statement
end proc;

(the do loop isn't necessary; if the sum is from 1 to 25 (fixed number) you can better use add; see ?add and ?sum )

kernelopts(version);
   Maple 16.02, X86 64 WINDOWS, Nov 18 2012, Build ID 788210

series((1/epsilon-log(4)),epsilon=0);

                            (-1)          
                     epsilon     - 2 ln(2)

If you want to use Maple to show that f is increasing on its domain, you could do: 

restart; f := x-> sqrt(2+5*x):
is( diff(f(x), x) > 0 );
                             false
solve( 2+5*x >0, x ); # finding the domain of f
                          /    /-2\          \
                 RealRange|Open|--|, infinity|
                          \    \5 /          /
assume( x>-2/5); is( diff(f(x), x) > 0 );
                              true


You have misplaced some parentheses, and used pi instead of Pi:

W:=(x,t) -> 8*R/Pi^2*
   sum( 1/(2*n-1)^2*sin((2*n-1)*Pi/2)*sin((2*n-1)*Pi*x/2*L)*cos(c*(2*n-1)*Pi*t/2*L),
        n=1..infinity);

If you want to see the formula you can simply do

W(x,t);

Now, to plot for different values of t:

plot( [seq(W(x,t),t=0..0.001,0.0001)], x=0..2*L );

Because an expression like 0x is immediately simplified to 0 (also for example x0 = 1),

Your second question: Probably you mean sum(0^x * a , x=-3..3 )? But 0-3 is not defined, so I take the sum from x=0. This can be done by evaluating the sum  rx for r=0:

eval( sum(r^x * a , x=0..3 ), r=0 );
                               a


Enter the function y(x,t) as

Y := (x,t) -> A*exp(-beta*(x-L-c*t)^2/(L^2));

(exp(x), not e^x; c*t, not ct)
and the differential equation as

 DE := diff(y(x,t),t,t) = c^2*diff(y(x,t),x,x);

Now evaluate DE for y(x,t)=Y(x,t).

First 16 17 18 19 20 21 22 Last Page 18 of 27