fractals - “Expecting a constant value” error when constructing a NetLogo list -


i working create pictorial representation of levy c-curve in netlogo using ifs construction scheme. have found 2 functions describe how iteratively map locations of 2 turtles , should result in desired curve after thousands of iterations. here code far:

 ;;;;;; useful complex operations   ; take re(z) of complex number + bi inputed list of coordinates [a b]   to-report re [z]  report first z  end    ; take im(z)   to-report im [z]  report last z  end   ; multiply 2 complex numbers   to-report complex_mul [z1 z2]  report list (re z1 * re z2 - im z1 * im z2)               (re z1 * im z2 + im z1 * re z2)   end    ; add complex numbers   to-report complex_add [z1 z2]  report list (re z1 + re z2)              (im z1 + im z2)  end    ; dilate complex numbers scalar fraction   to-report complex/real [z1 real]  report list (re z1 / real)              (im z1 / real)  end    ; initialize   setup  ca  setup-turtles  reset-ticks  end    ; create 2 turtles located @ initial set of points {0, 1}   setup-turtles  crt 2  ask turtle 0 [ setxy 0 0]  ask turtle 1 [ setxy 1 0]  ask turtles [ pd]  end    ; create first function transform turtle's location   to-report nextz_1 [z]   report complex/real (complex_mul [1 -1] z) 2  end     ; create second function transform turtle's location   to-report nextz_2 [z]  report complex_add [1 0]                      (complex/real (complex_mul [1 1]                                                  (complex_add z [-1 0]))                                    2)   end   ; creating levy curve   levy   ask turtles [ run one-of (list task setxy re (nextz_1 [xcor ycor]) im (nextz_1 [xcor ycor])                                  task setxy re (nextz_2 [xcor ycor]) im (nextz_2 [xcor ycor])                                )            ]   end 

however, i'm receiving error message in "levy" code block call re (nextz_1 [xcor ycor]) etc., saying netlogo expecting constant value in place of xcor , ycor.

how fix issue?

at http://ccl.northwestern.edu/netlogo/docs/faq.html#listexpectedconstant netlogo faq says:

if list contains constants, can write down putting square brackets around it, [1 2 3].

if want list contain items may vary @ runtime, list cannot written down directly. instead, build using list primitive.

you got right in other places in code, in levy procedure, need replace e.g. [xcor ycor] list xcor ycor.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -