InputForm

InputForm[expr]

prints as a version of expr suitable for input to the Wolfram Language.

Details and Options

  • InputForm always produces one-dimensional output, suitable to be typed as lines of Wolfram Language input.
  • The typeset form of InputForm[expr] is interpreted the same as expr when used in input. »
  • When an input evaluates to InputForm[expr], InputForm does not appear in the output. »
  • Put (>>) produces InputForm by default.
  • Short[InputForm[expr]] can be used, but may generate skeleton objects that cannot be given as Wolfram Language input.
  • The option NumberMarks can be used to specify whether ` marks should be used to indicate type, precision, or accuracy of approximate numbers. »

Examples

open allclose all

Basic Examples  (2)

InputForm of a typeset expression:

InputForm of a graphic:

Scope  (8)

Basic Objects  (2)

Integer, Rational, Real, and Complex numbers:

Arbitraryprecision Real and Complex numbers:

Special constants:

Characters and strings of characters:

Control characters for strings:

Special Input Forms  (4)

Different ways of representing Power expressions:

Special typeset expressions:

Different list structures:

Input without special interpretation:

With special characters in the same positions, there may be special interpretations:

In the case of superscripts, most things get interpreted as Power:

Special Output Forms  (2)

Some objects use a special output representation:

Some objects use an elided output representation:

The elided parts are visible using InputForm:

Options  (3)

NumberMarks  (3)

Machine numbers format without number marks by default:

The same number with number marks:

Extended-precision numbers include number marks by default:

Without number marks:

A mixed symbolic and numeric expression:

Include number marks for all numbers:

Omit all number marks:

Properties & Relations  (4)

The typeset form of InputForm[expr] is interpreted the same as expr when used in input:

Copy the output and paste it into an input cell. The x^2 is interpreted as x2:

When an input evaluates to InputForm[expr], InputForm does not appear in the output:

Out is assigned the value x2, not InputForm[x^2]:

InputForm has a linear formatting:

FullForm has linear formatting without special syntax:

OutputForm, StandardForm, and TraditionalForm all provide two-dimensional formatting:

Use ToString to generate a string in input form:

Possible Issues  (1)

Even when an output omits InputForm from the top level, it is not stripped from subexpressions:

The output does not have InputForm in it:

However, the variable e does have InputForm in it, which may affect subsequent evaluations:

The product is not evaluated due to the intervening InputForm:

Assign variables first and then apply InputForm to the result to maintain computability:

Wolfram Research (1988), InputForm, Wolfram Language function, https://reference.wolfram.com/language/ref/InputForm.html (updated 1996).

Text

Wolfram Research (1988), InputForm, Wolfram Language function, https://reference.wolfram.com/language/ref/InputForm.html (updated 1996).

CMS

Wolfram Language. 1988. "InputForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/InputForm.html.

APA

Wolfram Language. (1988). InputForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InputForm.html

BibTeX

@misc{reference.wolfram_2023_inputform, author="Wolfram Research", title="{InputForm}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/InputForm.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_inputform, organization={Wolfram Research}, title={InputForm}, year={1996}, url={https://reference.wolfram.com/language/ref/InputForm.html}, note=[Accessed: 19-March-2024 ]}