You appear to have expectations that do not conform to the structure of Mathematica definitions and assignments. As Alan notes in his answer f[1] = value
is already a definition, specifically a DownValues
rule attached to the Symbol f
. Such definitions are common in Mathematica, and at least in some contexts are known as indexed objects:
Many definitions attached to the same Symbol can coexist in Mathematica, and their order of application is determined by certain rules including pattern specificity. Consider for example:
f[a_] = 3;
f[1] = 5;
f[1]
5
This happens because 1
is considered more specific than _
, and this definition is placed higher in the rules list despite being specificed second.
?f
Global`f
f[1]=5
f[a_]=3
fib[1] = fib[2] = 1; fib[n_Integer?Positive] := fib[n] = fib[n - 1] + fib[n - 2]; fib[n_Integer?NonPositive] := fib[n] = fib[n + 2] - fib[n + 1];
Check withAnd @@ (Fibonacci[#] == fib[#] & /@ Range[-25, 25])
$\endgroup$fib[1] = fib[2] = 1
is a definition of the functionfib
. It just defines the specific values of the function at the specific point, 1 and 2, although it doesn't cover all domain of the function. $\endgroup$