Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Do NOT understand arguments (in 4.2)' topicStudent Support Forum > General > Archives > "Do NOT understand arguments (in 4.2)"

Next Comment >Help | Reply To Topic
Author Comment/Response
Dennis Geller
07/19/03 5:51pm

I have a function f defined. It needs some local variables. I defined a function setup to define them. This works. I defined a second function lf that is based on f. This also works. However
(1) ?f shows the definition of f with some of the globals as their actual names and some as their argument names in setup
(2)lf has to be redefined everytime I run setup. This is not true of f.
(3) I tried to put the definition of f in a module, and nothing worked right.
[I've made frantic efforts to correct these symptoms with Evaluate in various ways, to no avail]. It's clear i don't understand how arguments are used. Help much appreciated.

Snippets follow:
f[x_] := (a x + b)/(c x + d);
f[Infinity] := Mod[a PowerMod[c, -1, p], p];
y = Mod[-d*PowerMod[c, -1, p], p];
f[y] := Infinity

lf[x_] := Mod[Numerator[f[x]]*PowerMod[Denominator[f[x]], -1, p], p]

setup[aa_, bb_, cc_, dd_, pp_] := (a = Evaluate[aa];
b = Evaluate[bb]; c = Evaluate[cc]; d = Evaluate[dd]; p = Evaluate[pp];)
<use of Evaluate doesn't make any difference that I can see>

? f gives this -- well, this is what I get when I copy as text; you can probably read it although it isn't what shows up on the screen)

\!\(\*
InterpretationBox[GridBox[{
{GridBox[{
{\(f[6] := \[Infinity]\)},
{" "},
{\(f[9] := \[Infinity]\)},
{" "},
{
RowBox[{
RowBox[{"f", "[",
InterpretationBox["\[Infinity]",
DirectedInfinity[ 1]], "]"}],
":=", \(Mod[a\ PowerMod[c, \(-1\), p], p]\)}]},
{" "},
{\(f[
Mod[\(-dd\)\ PowerMod[cc, \(-1\), pp],
pp]] := \[Infinity]\)},
{" "},
{\(f[x_] := \(a\ x + b\)\/\(c\ x + d\)\)}
},
GridBaseline->{Baseline, {1, 1}},
ColumnWidths->0.999,
ColumnAlignments->{Left}]}
},
GridBaseline->{Baseline, {1, 1}},
ColumnAlignments->{Left}],
Definition[ "f"],
Editable->False]\)
========
here's the mdoule definition that I tried (in a different notebook)
lf[x_] = Module[{y}, f[z_] := (a*z + b)/(c*z + d);
f[Infinity] := Mod[a* PowerMod[c, -1, p], p];
y = Mod[-d*PowerMod[c, -1, p], p];
f[y] := Infinity; Mod[Numerator[f[x]]*PowerMod[Denominator[f[
x]], -1, p], p]]
If I evaluate lf (same definition; also setup was the same) I get
Mod[(4+bb) PowerMod[2 cc+dd,-1,pp],pp]


URL: ,

Subject (listing for 'Do NOT understand arguments (in 4.2)')
Author Date Posted
Do NOT understand arguments (in 4.2) Dennis Geller 07/19/03 5:51pm
Re: Do NOT understand arguments (in 4.2) VL 07/21/03 3:50pm
Next Comment >Help | Reply To Topic