Re: eval differential expressions
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: eval differential expressions
- From: rubin at msu.edu (Paul A. Rubin)
- Date: Mon, 20 Jun 94 12:39:42 EDT
>Is there an easy way to evaluate differential expressions for various >functions? >For example, if I have D[f[x],x]^2+f[x] in Mma, I'd like to evaluate it for >various functions f[x]. This can be done via naming the expression and >then letting f[x_]=<desired fn of x> and typing the expressions name >upon which its evaluated - but this seems awfully clumbsy! > >Any suggestions? >Thanks. > > Two possibilities: 1. Make your expression an operator (on f): g[ f_ ] := D[f[x], x]^2 + f[x] g[ <your function here> ] or g /@ { <list of your functions here> } 2. Name your expression and then use the replacement operator to substitute other functions for f: g = D[f[x], x]^2 + f[x] (* f as yet unspecified *) g /. {f -> <your function here>} ************************************************************************** * Paul A. Rubin Phone: (517) 336-3509 * * Department of Management Fax: (517) 336-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE