Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
How to change this: A := <g(round(x*ln(x+1)), 16)>; pointplot(A, style = point)?... It does plot points of sequence properly rather arbitrarily it seems. –  laovultai Dec 5 '12 at 10:15
    
Did you instead mean something like A := <g(round(x*ln(x+1)), 16)>; plots:-listplot(A, style = point); –  acer Dec 6 '12 at 1:54
    
Or, if you insist on using pointplot, then something like A := <<seq(i,i=1..16)>|<g(round(x*ln(x+1)), 16)>>; plots:-pointplot(A, style = point); –  acer Dec 6 '12 at 1:58
    
What does A := <<seq(i, i = 1 .. 16))>|<g(round(x*ln(x+1)), 16)>> mean –  laovultai Dec 7 '12 at 10:12
    
It assigns to A a 16-by-2 Matrix, whose first column consists of the integers from 1 to 16, and whose second column contains the result from calling g in that way. The Matrix is constructed from two 16-by-1 column Vectors. –  acer Jan 30 '13 at 1:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.