Hello! I am new to sage -- but an experienced python user. I have successfully installed sage (except for plotting on mac 10.6 -- but I understand that's being worked on).
I wanted to build a vector of random numbers, and did the following: sage: import random sage: import numpy as N sage: u = random.uniform sage: N.fromfunction( lambda i: u( 0., 1. ), ( 3, ) ) 0.513723977031280 !! why not an array? However, the following works slightly differently.... sage: N.fromfunction( lambda i: u( 0.*i, 1. ), ( 3, ) ) array([ 0.65361094, 0.65361094, 0.65361094]) It would seem that sage is trying to optimize the expression... (but not very systematically, as the difference of the answers shows). Even stranger: sage: N.fromfunction( ( lambda i: u( 0, 1.*i ) ), ( 3, ) ) array([ 0. , 0.92293102, 1.84586204]) Here it seems to have called u once and then scaled the result??? Can I turn this off -- it seems likely to cause bugs?! And in any case, why doesn't it give me an array of 3 constants in the first case? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org