Re: Unevaluated functions
- To: mathgroup at smc.vnet.net
- Subject: [mg109358] Re: Unevaluated functions
- From: Rui <rui.rojo at gmail.com>
- Date: Fri, 23 Apr 2010 03:48:51 -0400 (EDT)
- References: hqou0u$9g5$1@smc.vnet.net
On Apr 22, 4:31 am, mokambo <alexandrepassosalme... at gmail.com> wrote: > Hello, > > In Mathematica when a function returns unevaluated the "return value" > is the name of the function with arguments. > How do we control such output? Can we suppress it? How do we change > the usual string for something like "N/A"? > Advise please. > > Alex Totally agree with Albert. I wanted to note too that Mathematica is symbolic. That means that some results you expect to get are symbols and numbers combined in a certain way (Imagine expanding (x+1)^2 to get x^2+2x+1 as a result) Therefore, you cannot tell Mathematica something like "All results that are of the form something[something] should be replaced by "N/A"" because you would get "N/A" in everything you do. However, I'm guessing perhaps it is possible (don't know if it makes sense) to tell Mathematica to return "N/A" every time it tries to replace an expression and finds no rule to do so. Perhaps setting $Pre to a function that stores the expression unevaluated and $Post to another one that compares the result and decides what to do. Or perhaps with a general Format, not sure.