MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Calling abbreviated functions nested within other functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41005] Calling abbreviated functions nested within other functions
  • From: gauer at ras.sk.ca
  • Date: Mon, 28 Apr 2003 02:31:40 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I have the functions

f1[var1_,var2_,var3_]:=var1+x*(var2+var2)+y*(var2+var3)==0
f2[var1_,var2_,var3_]:=var1+x*(var2+var3)+y*(var3+var3)==0

defined and will at times create more abbreviated functions, say

g1:=var2+var2, g2:=var2+var3, g3:=var3+var3
..
I've tried leaving the gi's defined as constants, and then also later as
functions (of gi[var1_,var2_,var3_]), and would later redefine f1 and f2
as:

f1[var1_,var2_,var3_]:=var1+x*g1+y*g2==0
f2[var1_,var2_,var3_]:=var1+x*g2+y*g3==0
..
The preference here is that since my gi's are more complicated than the
ones given, I would like to abbreviate my fi definition so that f1 will
find the value of g1 and g2, and not just the variables associated with
the gi.

For instance f1[2,3,4] -> 2+x*(2*var2)+y*(var2+var3)==0, and not
2+6*x+7*y==0 as expected. The call will need to happen many times (so I
don't want the gi's to be permanently assigned a value once they catch a
value), but the prefernece is to not to want to have to paste the variable
tail set behind the each call of the function gi. Can I get the fi call to
nest the same tail to all function calls within f (namely, the gi's) which
need a tail to evaluate?

The second application I have of this would be to call a modified
ImplicitListPlot function in the following syntax:

ImplicitListPlot[{curve, line_segment, point}, {dummy_var1, min_var1,
max_var1}, {dummy_var2, min_var2, max_var2}][var_1, var_2, var_3]:=
ImplicitListPlot[{curve[var_1, var_2, var_3], line_segment[var_1, var_2,
var_3], point[var_1, var_2, var_3]}, {dummy_var1, min_var1[var_1, var_2,
var_3], max_var1[var_1, var_2, var_3]}, {dummy_var2, min_var2[var_1,
var_2, var_3], max_var2[var_1, var_2, var_3]}]

I am not sure if this part will work because I haven't tested it yet, and
of course, I would rather copy and paste off (er ... I mean "write out" -
let's not be too lazy) the LHS whenever I need to plot (since the vari's
are much easier to change if I can rewrite the Plot command in postfix,
not infix notation).

<Here, curve is the implicit curve being plotted, line_segment can be
thought of as our other boundary of integration, point might be a centre
of symmetry that could be useful to mark, and the dummy_vari's would set
the standard axes, where min_vari and max_vari might later be able to be
expressed as functions of the length of the line_segment and the position
of the centre of symmetry>

What it should mean is that later on, if I would ever want to integrate
the function y=2*x^3+1 on x in [a,b], and that if I only want to draw a
plot for the interval [a,b]x[2*a^3+1,2*b^3+1] using implicitplot, that
perhaps I can avoid graphical estimation problems (sometimes I get machine
precision errata when trying to plot some tougher curves, a common
occurrence being hyperbolic asymptotes that presumably, a symbol-based
definition of the Plot family of functions could avoid - in effect, plot
would only sample symbols, and not values) by having the graph only label
this box, and not a particular value set of [a,b] associated with this
box. In effect, I only want to know the shape of the curve on the box
interval, and not the values associated for when we later choose values of
[a,b] for which to integrate on after the curve is plotted.

Does anyone have a package or code or ideas out there already that does
this for version 3 that I could look at?
                                               -- Kai G. Gauer --




  • Prev by Date: Re: Dealing with sums
  • Next by Date: eqiprobable intervals
  • Previous by thread: RE: slant lines (and pasted forms of Mathematica expressions)
  • Next by thread: eqiprobable intervals