Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Function argument

  • To: mathgroup at
  • Subject: [mg66991] Re: Function argument
  • From: Helen Read <hpr at>
  • Date: Tue, 6 Jun 2006 06:27:55 -0400 (EDT)
  • References: <e60o3q$g5s$>
  • Reply-to: read at
  • Sender: owner-wri-mathgroup at

Bonny wrote:
> I would like to define a function g that evaluates another function f at a 
> given value. That is,
> g[a, f[x]] := f[a]
> For example, I might want the function f[x]=ax^2+bx+c to be evaluated at x=1 
> and get the result a+b+c. That is,
> g[1, ax^2+bx+c] should evaluate to a+b+c.

Presumably you mean a x^2+b x + c, right? (Note the spaces between a and 
x^2, and between b and x).

> Again, I might want the function f[x]=Sin[x] to be evaluated at x=pi and get 

You mean x=Pi, right?

> the result 0. That is,
> g[pi, Sin[x]] should evaluate to 0.
> Is there a way to accomplish this in Mathematica? Any help would be 
> appreciated.


will do what you want.

Helen Read
University of Vermont

  • Prev by Date: Re: Function argument
  • Next by Date: Re: Division by Zero (Error Handling)
  • Previous by thread: Re: Function argument
  • Next by thread: RE: Function argument