I am a novice user, trying to work through some examples given in book about Mathematica, and I am confused about the output I am receiving. Here is what I am entering, and the output is the same as my input - any idea what I am doing wrong? I have attached the notebook - called “Input equals output”
In[1]:= UnitConvert[26.2 mi, km]
Out[1]= UnitConvert[26.2 mi, km]
In[2]:= CurrencyConvert[$10 .00, Quantity[1, "Euros"]]
During evaluation of In[2]:= Quantity::compat: DimensionlessUnit and Euros are incompatible units
Out[2]= CurrencyConvert[0., Quantity[1, "Euros"]]
I dont know if this is what youre asking, but if the input code has been written incorrectly, the output (the result) will be the same as the input code. And usually Mathematica will tell you what you did wrong. Example: PersonData[BrianJacques, NotableBooks the output would be: PersonData[BrianJacques, NotableBooks and then Mathematica would tell you that you didnt type an ending right square bracket.
As a newcomer to WL it is important to understand that unlike most programming languages, WL uses term rewriting. When you define a function, you are actually defining a rewriting or replacement rule.
This defines a replacement where f[] is replaced by ^2.
Clear[f, a, b]
f[x_] := x^2
f[2]
(* 4 *)
f[a + b]
(* (a + b)^2 *)
A replacement rule may also restrict the patterns to which it applies. This definition will only apply if the argument to f is an Integer. a + b is not an Integer so no replacement is performed (output = input).