3

I generated a long polynomial using the Wolfram command line, with divisions and exponents. But the divisions look like this:

4
-
5

And the exponents are on a different line:

  -6
10

And I need to copy the output to GeoGebra, so I need to have the output format like this:

4/5

And:

10^-6

How can I do this?

ProgramFOX
  • 143
  • 6
  • 2
    Try wrapping your expression in InputForm – shrx Jul 28 '14 at 10:28
  • @shrx Thanks, that worked! – ProgramFOX Jul 28 '14 at 10:29
  • @shrx I just noticed that it gave 3.932502727915577*^-9*x^9. There should be a 10 between the * and the ^ chars, but there isn't and now I have to manually add it. Is there a way to add this 10 automatically? – ProgramFOX Jul 28 '14 at 10:37
  • See http://reference.wolfram.com/language/guide/Syntax.html, and look for "scientific notation"; also http://reference.wolfram.com/language/tutorial/OutputFormatsForNumbers.html might be helpful. – Michael E2 Jul 28 '14 at 10:50

1 Answers1

3

By default in the terminal interface expressions are printed in OutputForm:

OutputForm is an approximation to StandardForm which uses only ordinary keyboard characters.

As you observe this multi-line pseudo-2D output cannot (easily) be used as input.
InputForm formats expressions in a way that can be input to Mathematica:

InputForm always produces one-dimensional output, suitable to be typed as lines of Wolfram Language input.

However there is absolutely no certainty that this output can be used unmodified as input to other applications. This is why you see e.g. 1.234*^-9 -- that is valid Mathematica syntax.

There is no output format which is both compatible with other applications and which is capable of handling all expression types, so you will need to specify more clearly the output you are creating and the application that it is for. Some possibly useful functions: FortranForm, CForm, ExportString.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371