Question: Modifying A Loop

N := 8;

b := 2 ∗ P i;
data := [];
for n f rom 0 to N do
data := [op(data), [n ∗ b/N, sin(n ∗ b/N)]];
od;

Since exact points are not needed, changed the loop (and reinitialize) to:

data := [];

for n from 0 to N do
data := [op(data), [evalf(n ∗ b/N), sin(evalf(n ∗ b/N))]];
od;

Modify the second example so that it can be used to graph the sin function
over any interval from a to b. (You should suppress the output from the for-loop in your
example, so that you do not fill up the worksheet with an unwieldy amount of output.)

Please Wait...