Adri van der Meer

Adri vanderMeer

1400 Reputation

19 Badges

19 years, 95 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 want i to be a genuine local variable, put it in a procedure:

i := something:
f := proc()
  local i;
  for i to 4 do print(i^2) end do
end proc:


seq(abs(g[i]), i=1..nops([g])) assuming positive;

See also tomleslie's comment; could you give an example of a function b(t)=0 (for all t), but b'(t) <> 0?

Perhaps you intend only to remove the first term in question 1. This can be done by replacing diff(b(t),t) temporally by another variable:

subs( {diff(b(t),t)=db},question1 ): eval(%,{b(t)=0,db=diff(b(t),t)} );

replace plot(...) by plot3d(...)

In your example it is easy to transform the curve in the solution of a pair of autonomous differential equations. Then you can use DEplot:

DF := {diff(X(t),t) =-Y(t), diff(Y(t),t)=X(t)}:
DEplot( DF, [X(t),Y(t)], t=0..2*Pi, {[X(0)=1,Y(0)=0]}, X=-1.5..1.5, Y=-1.5..1.5,
  dirfield=[evalf([x(Pi/4),y(Pi/4)]),evalf([x(3*Pi/4),y(3*Pi/4)])], arrows=smalltwo,
  linecolor=red, thickness=1 );

But in the general case you must explicitly make one or more arrows:

x,y := t->cos(t), t->sin(t):
p1 := plot([x(t),y(t),t=0..2*Pi] ):
p2 := plottools:-arrow( [x(Pi/4),y(Pi/4)], 0.1*<D(x)(Pi/4),D(y)(Pi/4)>, 0.03,0.05,1 ):
plots:-display( {p1,p2}, scaling=constrained );

Remove the line


from your worksheet, or put a # before this line.

(1) rem is for polynomials; use irem
(2) n<0: calculate 1/x^(-n)
(3) is n even, than calculate x^(n/2)*x^(n/2)

So the procedure might be:

option remember;
if n<0 then 1/Puis(X,-n);
elif n=0 then 1;
elif irem(n,2)=0 then Puis(X,n/2)*Puis(X,n/2);
else X*Puis(X,n-1);
end if;
end proc;

Remind that evalb(x=x) returns "true" (I use Markiyan Hirnyk's example):

s := solve({y+u = 1, x+y+z = 0});
             {u = -y + 1, x = -y - z, y = y, z = z}
# [set of solutions,independent variables]
               [{u = -y + 1, x = -y - z}, {y, z}]

plotk := k -> plot( k*x^2, x=-1..1 ):

or even:


(1) Remove the second restart command, because everything is "forgotten" after a restart.
(2) Assign the first time()-st to a variable, so that it can be displayed in the last line.

st := time():
ifactor(49! + 1);
t1 := time() -st;
st := time():
isprime(49! + 1);
t1, time() -st;

Both functions seem to be constant.

The first one:

f := x -> 1+18*(sinh(9*x-9)-sinh(3*x-477))^2/(9*cosh(9*x-9)+cosh(3*x-477))^2;
plot( [seq(f(x),x=-4..4,0.1)],view=18.99..19.01);

I also don't understand why

plot( f, -4..4, view=18.99..19.01 );

doesnt work.

The second function seem also constant. The "weird graph" is caused bij rounding errors.

plot(1+18*(sinh(9*x-9/2)-sinh(3*x-477/2))^2/(9*cosh(9*x-9/2)+cosh(3*x-477/2))^2,x=-1..1, view=18..20);

shows a genuine constant .


This can be done using a tickmarks-option:

plot(..., tickmarks=[[evalf(-Pi)=-180,evalf(-Pi/2)=-90, ....],"default"] );

solve( {limit( (f(x+h)-f(x))/h, h=0 )= (f(b)-f(a))/(b-a), x>a, x<b} ): c := subs(%,x);

You only missed the insequence option in the display command:


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