On Monday, June 6, 2011 10:54:57 AM UTC-7, kcrisman wrote:
>
> I'm using R matrices to use an R program and then do things with it in 
> Sage.  For some reason Sage doesn't get the "right" answer for 
> matrices above a certain size. 
>
> The first one is right (it gives the space that is in the returned 
> string) while the second one makes no sense; ZZ='' is what actually 
> comes back.  But there is no real reason for this - what's special 
> about the length? - and doing these in Sage's r_console() gives normal 
> results for the matrix. 
>
> So I feel like pexpect must be doing something naughty.  Does anyone 
> have any ideas what might be going on so I can use more data? 
>

I tried this experiment: I added spaces to the first string to be 
evaluated.  When the string has length <= 1024, it seems to work, and when 
the string has length > 1024, it doesn't.  For example:

    sage: s = 'matrix(c(1, 1, 1, 1,' + ' '*987 + '2,2,2,2), ncol=4)'
    sage: len(s)
    1024
    sage: r.eval(s)
    '     [,1] [,2] [,3] [,4]\n[1,]    1    1    2    2\n[2,]    1    1    
2    2'
    sage: s = 'matrix(c(1, 1, 1, 1,' + ' '*988 + '2,2,2,2), ncol=4)'
    sage: len(s)
    1025
    sage: r.eval(s)
    ''

I don't know why, but maybe that can help you track it down.

-- 
John


-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to