How to change command: g:=(f,n) -> seq( subs(x=i, f) mod 12, i=1..n)?

272 Views Asked by At

How to change command:

g:=(f,n) -> seq( subs(x=i, f) mod 12, i=1..n)?

Maple says: Error, illegal use of an object as a name...

I try to create a melody generator that creates desired length of sequence of pitch numbers as output, when you have as input: function( function of x) and length of sequence.

for example: seq(modp(12, subs(x = i, x^2)), i = 1 .. n), but then Maple says: Error, unable to execute seq.

But for example with this: f := proc (g) options operator, arrow; round(g) end proc; a := seq(mod(f(i*log(i+1)), 12), i = 0 .. 30), you get( output):

g -> round(g)

0, 1, 2, 4, 6, 9, 0, 3, 6, 9, 0, 3, 7, 10, 2, 6, 9, 1, 5, 9, 1, 5, 9, 1, 5, 9, 2, 6, 10, 3, 7

1

There are 1 best solutions below

5
On BEST ANSWER

These work for me in Maple 16.01, pasted in as either 1D Maple Notation or as 2D Math input.

restart:

g:=(f,n) -> seq( eval(f, x=i) mod 12, i=1..n):

g(round(x*ln(x+1)),16);                       

             1, 2, 4, 6, 9, 0, 3, 6, 9, 0, 3, 7, 10, 2, 6, 9

seq(modp(eval(round(x*ln(x+1)), x = i), 12), i = 1 .. 16);     

             1, 2, 4, 6, 9, 0, 3, 6, 9, 0, 3, 7, 10, 2, 6, 9