Register to reply

Mathematica: output an expression without evaluating it first

by HJ Farnsworth
Tags: evaluating, expression, mathematica, output
Share this thread:
HJ Farnsworth
#1
Feb20-13, 06:28 PM
P: 123
Greetings,

I recently discovered Mathematica's Format function, and it has been of great use to me. However, there is one thing that I want to use it to do, that I have yet to be able to. I could do this easily, though, if there is some Mathematica function that works as follows...

If I put a semicolon after inputting something in Mathematica, it evaluates what I input without outputting the result. The function that I am looking for is sort of the inverse of this.

I will call the function DoNotEvaluate[] for the rest of this post. Some simple input and output examples for the function that I am looking for would be...

Input: DoNotEvaluate[Sqrt[4]]
Output: Sqrt[4] - note that the output is not 2.

Input: DoNotEvaluate[Sqrt[2*2]]
Output: Sqrt[2*2] - note that the output is neither Sqrt[4] or 2.

Input: x=2*2; DoNotEvaluate[Sqrt[x]]
Output: Sqrt[4]

Does anyone know of a Mathematica function, or other Mathematica technique, that does what my made-up DoNotEvaluate[] function does?

Thanks for any help you can give.

-HJ Farnsworth
Phys.Org News Partner Science news on Phys.org
New type of solar concentrator desn't block the view
Researchers demonstrate ultra low-field nuclear magnetic resonance using Earth's magnetic field
Asian inventions dominate energy storage systems
Bill Simpson
#2
Feb20-13, 07:53 PM
P: 1,037
Perhaps one of these or some combination?

http://reference.wolfram.com/mathema.../HoldForm.html
http://reference.wolfram.com/mathema...f/HoldAll.html
http://reference.wolfram.com/mathema...dComplete.html
http://reference.wolfram.com/mathema...lComplete.html
http://reference.wolfram.com/mathema...evaluated.html

There are even more of these, but I don't think the process of shielding some things from evaluation while getting other things done has been explained in any documentation that I have seen.
HJ Farnsworth
#3
Feb20-13, 09:28 PM
P: 123
Thank you for the very quick and complete response. That's pretty much what I wanted.

-HJ Farnsworth


Register to reply

Related Discussions
Evaluating expression involving permutation symbol and Kronecker delta Introductory Physics Homework 0
Evaluating a simple complex expression Calculus & Beyond Homework 1
What is the truth? I am evaluating some UPS with main subject output Electrical Engineering 2
Evaluating an expression when x=infinity Calculus & Beyond Homework 5
Evaluating expression for e General Math 10