MathGroup Archive 1997

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

Search the Archive

f + g

  • To: mathgroup at
  • Subject: [mg7120] f + g
  • From: murray at (Murray Eisenberg)
  • Date: Sun, 11 May 1997 02:57:18 -0400 (EDT)
  • Organization: University of Massachusetts, Amherst
  • Sender: owner-wri-mathgroup at

In mathematics, we define the sum f + g of two arbitrary real-valued
functions f and g (with the same domain) by the rule (f + g)(x) = f(x)
+ g(x), so that, for example, (cos + exp)(0) = 2.  Similarly, for a
constant c and an arbitrary function f we define the product cf by the
rule (cf)(x) = c (f(x)).  [Generalizations to other kinds of values
and to other operations, such as the product of two functions, are
possible but not of interest to me in this question.)

My question is:  is there some way directly to express this in
Mathematica (3.0)?  That is, I would like to input

   (Cos + Exp)[0]

and get result 2 -- WITHOUT having to give first a specific rule for
the sum of that particular pair of functions.  The sort of thing I
have in mind is a general rule such as

    (f_ + g_)[x_] := f[x] + g[x]

but that certainly won't be acceptable to Mathematica (Tag Plus is

The only thing I could come up with was:

   (f_ + g_)[x_] := f[x] + g[x]

But I find that most unsatisfactory: it seems to me that such a basic,
common operation in mathematics ought to be directly accessible in "a
software system for doing mathematics"!

Any other ways except the above, which I regard as something of a

  Murray Eisenberg                       Internet:  murray at
  Mathematics & Statistics Dept.            Voice:  413-545-2859 (W)
  University of Massachusetts                       413-549-1020 (H)
  Amherst, MA 01003                           Fax:  413-545-1801

  • Prev by Date: Re: Graphics`Graphics3D`Shadow
  • Next by Date: Re: scaling 3D axes?
  • Previous by thread: Re: Graphics`Graphics3D`Shadow
  • Next by thread: Re: f + g