[Date Index] [Thread Index] [Author Index]
Re: Unevaluated functions
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.