I am trying to use a 'Module'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]]
];
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, say I try:
norm[2]
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} contains fun1[p_]:=p^2+p-1;fun2[p_]:=p^3-p^2+p+1, which is not a symbol or an assignment to a symbol
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 surpassavoid this error ? basically i am guessing the problem is I want to define a module with local variables and "local function" ... I want to give functions in the space between { ... }.