thelamecamel wrote:
> On Mar 3, 4:46 am, Jason Grout <jason-s...@creativetrax.com> wrote:
>> You are missing a closing bracket and comma at the end of this line
>> (i.e., "],").  The number looks a little smaller as well.  Was something
>> chopped off?
>>
>> Jason
> 
> Oh man, that's what's happening.  When I print another failing string
> from mathematica, the original string looks fine, but the replace()d
> version is munged:
> 8.553921460041636*^-14 - 0.034517073945669455*I,
> 6.438460875557439*^-13 - 0.2507643434931489*I,
> becomes
> 8.553921460041636e-14 - 0.0 6.438460875557439e-13 -
> 0.2507643434931489*I,
> And of course, when I try to sage_eval the latter, it fails.  So this
> seems to be a problem with replace().
> 
> This all happens inside a loop, and doesn't happen when I try it out
> of that loop (except with really long inputs, so the code to reproduce
> it isn't as simple as I would have liked.
> 
> First, download http://www.physics.usyd.edu.au/~felix/sage/res.m
> Save the file somewhere.
> Then run:
> sage: mathematica('SetDirectory["/path/to/file"]')
> sage: mathematica("<< res.m")
> sage: res = mathematica('res')
> sage: for i in range(84):
> ....:     resel_s = repr(res[i+1][1]).replace('{','[').replace
> ('}',']').replace('*^','e').replace('\n',' ')
> ....:     resel = sage_eval(resel_s)
> ....:
> ------------------------------------------------------------
>    File "<string>", line 1
>      [[-RealNumber('0.9018796952509034') + RealNumber
> ('0.9018804701526122')*I,
> <SNIP>
> SyntaxError: invalid syntax
> 
> Run the loop three times in the same sage session, and on the third
> time you'll get the error occurring in a different place in the loop.
> Weird!
> 
> Any ideas?


My guess is it is a problem with the pexpect interface with Mathematica. 
    There is some way to turn on logging of the pexpect interface to see 
exactly what Sage is sending and receiving from Mathematica; you'll 
probably see the problem there.  I don't know how to turn it on; I've 
never used it.  Can anyone help with that?

(Sorry; at the moment I am pressed for time, otherwise I'd go figure out 
how to turn it on.)

Jason


--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to