3
$\begingroup$

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?

$\endgroup$
4
  • 2
    $\begingroup$ Try wrapping your expression in InputForm $\endgroup$
    – shrx
    Jul 28 '14 at 10:28
  • $\begingroup$ @shrx Thanks, that worked! $\endgroup$
    – ProgramFOX
    Jul 28 '14 at 10:29
  • $\begingroup$ @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? $\endgroup$
    – ProgramFOX
    Jul 28 '14 at 10:37
  • $\begingroup$ See reference.wolfram.com/language/guide/Syntax.html, and look for "scientific notation"; also reference.wolfram.com/language/tutorial/… might be helpful. $\endgroup$
    – Michael E2
    Jul 28 '14 at 10:50
3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks for your answer! I updated my question by adding that GeoGebra is the program that I need it for. $\endgroup$
    – ProgramFOX
    Jul 28 '14 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.