Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a function that gives me a number of meters; how do I attach "meters" to it and send it to WolframAlpha?

The function generating the result isn't a unit-aware calculation or anything:

distance := someFunction[AstronomicalData["Mercury", "Radius"]]

The result is about 6.07x10^15

Now I want to ask WolframAlpha[] to give me context for that number of meters. (Show me the number converted it to various units, show me comparisons, etc; all the stuff W|A is great for.)

I figured I'd say something like


But no way that I format that number into a string gives me a result that WolframAlpha[] understands, and I can't find anything in the manual explaining a better way to format it.

I've tried the Quantity[] function, and all kinds of variations on

x := NumberForm[N[distance], 10]
WolframAlpha[ToString[x] <> "meters"]

But it just interprets it as "15x6.068x10 meters"

I've tried Googling every variation on "format a number to send to the wolframalpha function" and found nothing.

Is there an easy way to do this that I'm missing?

share|improve this question
Try ToString[_, InputForm]. –  Chip Hurst Nov 18 '13 at 15:32
Thank you! That worked perfectly. –  user10632 Nov 18 '13 at 15:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.