I am trying to use a Module
having "local functions", i.e., those which I need to define only inside this module.
So I tried this:
norm[p_] := Module[{
fun1[p_] := p^2 + p - 1;
fun2[p_] := p^3 - p^2 + p + 1
},
Max[fun1[p], fun2[p]]
];
The function is compiling, but when I try to evaluate it--say, I try:
norm[2]
Its giving me an error telling:
Module::lvsym
: Local variable specification{fun1[p_]:=p^2+p-1;fun2[p_]:=p^3-p^2+p+1}
containsfun1[p_]:=p^2+p-1;fun2[p_]:=p^3-p^2+p+1
, which is not a symbol or an assignment to a symbol
How do we avoid this error? I want to give functions in the space between { ... }.
{ }
button above the edit box to indent your code as a code block. Also see editing help. $\endgroup$Ctrl+K
$\endgroup$