1

I'm trying to create a C# library (DLL) that calls Mathematica 8 using the .NET/Link protocol. Specifically, I'm using it for things like FFTs, etc. Right now I'm using EvaluateToOutputForm and parsing the resulting string for doubles. Anytime I try using Evaluate() and GetDoubleArray(), it gives the error message (exception) that I'm trying to read from data of the wrong dimensionality. Even using Evaluate("2+2") and then GetInteger() fails with the error that the waiting data isn't an integer (basically).

The problem with EvaluateToOutputForm() is that the numbers I'm parsing from, say, Abs@Fourier[data] are wrong for non-trivial (e.g. fairly long) inputs. I can't tell what's going wrong. Can anyone here help me?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
PrinceBilliard
  • 181
  • 1
  • 17

1 Answers1

2

OutputForm is really only useful for viewing the result. You really want to be using InputForm here, as it maintains the full precision of the numbers in the result. The InputForm syntax is well defined and parseable. InputForm also never results in pseudo-2D formatting like OutputForm.

ragfield
  • 2,486
  • 13
  • 15
  • Well, I've now gotten GetDoubleArray() to work (I forgot WaitForAnswer), so I suppose it's a moot point there. But thanks, I didn't know InputForm was so much better for parsing. But I still have the "wrong answer" problem. And I've opened a Wolfram Support ticket for that. Thank you for the rapid answer. – PrinceBilliard May 03 '11 at 23:23
  • UPDATE: It turns out my parsing was incorrect, and MMA works fine. – PrinceBilliard May 04 '11 at 17:51