Hi David, I haven't looked into these since #3587 rewrote MathematicaElement._sage_() for mathematica objects, but I did a bit of work getting the generic ExpectElement._sage_() to work with mathematica lists. Mathematica does return different results depending on whether it's running in 32-bit or 64 bit modes. This was on a mac.
Furthermore I recall seeing complex numbers from mathematica commonly printed with the imaginary part first. Futhermore for particularly long outputs from mathematica, it would seemingly randomly intersperse '\n' new line characters with '\r\n' new line characters, which would mess up any sage_eval()s. So don't expect mathematica to give consistent, well-behaved output! BTW sage: def math_bessel_K(nu,x): ... return mathematica(nu).BesselK(x).N(20).sage() ... sage: math_bessel_K(2,I) now gives me an error: NotImplementedError: Unable to parse Mathematica output: -2.5928861754911969781676606702635284285719718407749199115289`20.149465350282203 + 0.1804899720669620266296208808560650432663536549483055754141`18.99213497581376*i Does this work on anyone else's machine? I think #3587 may be responsible for the breakage. I'll look into this. Cheers, Felix On Mar 10, 3:35 am, "Dr. David Kirkby" <david.kir...@onetel.net> wrote: > Nick Alexander wrote: > > > On 8-Mar-10, at 6:03 PM, Dr. David Kirkby wrote: > >> I'm a bit puzzled by this one: > > >> sage: def math_bessel_K(nu,x): > >> ... return mathematica(nu).BesselK(x).N(20).sage() > >> ... > >> sage: math_bessel_K(2,I) # optional - mathematica > >> 0.180489972066962*I - 2.592886175491197 # 32-bit > >> -2.592886175491196978 + 0.1804899720669620266*I # 64-bit > > >> What is supposed to be 32 or 64-bit ? Sage or Mathematica? > > > In this case, the # XXX-bit flag refer to whatever environment sage > > thinks it is executing in. > > > I had this issue with Mathematica on multiple machines, and just wrote > > > sage: complex.Real, complex.Imag() to force the order and not deal with > > Mathematica's formatting at all. > > Someone sent me by private email the output from Version 5.2 of Mathematica on > Windows. That was 32-bit, and it had the real before the imaginary component. > A > book based on version 3 of Mathematica shows the real before the imaginary. > > I'm not saying it might not be possible to configure Mathematica to output > some > weird way, but it is far from the norm, and certainly has nothing to do > whether > Mathematica is 32-bit or 64-bit. > > > In this example, isn't the sage() function supposed to convert this to a > > sage data type, which has fixed order printing on all architectures? > > I don't know what it is supposed to do. If you can write an improvement (just > as > a reply in this email), I'll create a trac ticket and patch for it. > > I notice many packages have the version information available > > gap_version > gp_version > kash_version > magma_version > matlab_version > octave_version > qepcad_version > r_version > sage0_version > singular_version > version > > but Mathematica is not one of them. That is quite easy to get too. > > > > > Nick -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org