## 1400 Reputation

17 years, 295 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

## Make a procedure...

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:
f();
1
4
9
16
i;
something

## simplify/zero...

`simplify(DC,zero);`

## Assuming all variables positive?...

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

## Perhaps you mean......

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)} );

## plot3d...

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

## Use plottools:-arrow...

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:

with(DEtools):
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 );

## Tutor window...

Remove the line

Student[Precalculus][PolynomialTutor]();

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

## Several problems...

(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:

Puis:=proc(X,n::integer)
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;

## Select independent variables...

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]
[remove(evalb,s),rhs~(select(evalb,s))];
[{u = -y + 1, x = -y - z}, {y, z}]

## ...or make a function...

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

or even:

plots:-display(plotk~([1,2,3,4]));

## No restart...

(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.

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

## Constant function...

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 .

## Tickmarks...

This can be done using a tickmarks-option:

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

## Use inequalities...

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

## insequence option...

You only missed the insequence option in the display command:

display(F(1),insequence);

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