Mathematica 9 is now available
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 1997

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

Search the Archive

Re: Derivative Evaluation

  • To: mathgroup at
  • Subject: [mg6060] Re: [mg6017] Derivative Evaluation
  • From: go.gators at
  • Date: Sun, 16 Feb 1997 01:12:02 -0500
  • Organization: MindSpring Enterprises
  • Sender: owner-wri-mathgroup at

John Cigana <giotto at> wrote:


>I have a 7 parameters multivariate function. i.e. y = f(x1..x7).

>I am able to correctly find the partial derivative for each parameter.

>However, I can't seem to be able to evaluate my derivative at a given
>point. i.e. f'(x1=0.01, x2=0.5, x3=0.02, ... x7=0.05) = Value !

>Any insight on the subject ?? Any help appreciated !



Hi John.  Sorry about the blank reply (If it got posted) I had to
configure my newsreader. I had this same question when I first started
using MMA.  Here's the best I can do by way of an answer.

First Clear[] and symbol definitions you've made in the current
context using Clear[y,yVars,yVarRules,x1,x2,x3,x4,x5,x6,x7,partials].
You don't need to do this if you start a new session.


Here is a function that takes partials of a function with respect to
each variable in vars.

partials[fnc_,vars_]:=Map[D[fnc, #] &,vars]
Now define  your function y=f(x1,...,x7)


\!\(\((x1\ x2\^2 + x3\^3\ x4)\)\ x5\ x6\^2\ x7\)

Now define a list of the variables in y.

Now define some replacement rules for the variables.  I think this is
all you really need to know but I thought the function definition for
partials[] might be useful and/or give you some things to think
about.I took me a long time to realize the usefullness of replacement
rules.  Play with them, read about them in the BOOK, and you will
learn to love them.   They allow you to replace symbols with other
things while keeping the symbols undefined.  i.e., you can
 continue doing algebraic operations on y even after checking the
numerical value with the replacement rules.  Also, you can define a
replacement rule of the form x1->Sqrt[x]  or x2->somestuff, play with
them and all will become clear.


Now evaluate partials[y,yVars] and you get the symbolic result.


\!\({x2\^2\ x5\ x6\^2\ x7, 2\ x1\ x2\ x5\ x6\^2\ x7, 
    3\ x3\^2\ x4\ x5\ x6\^2\ x7, x3\^3\ x5\ x6\^2\ x7, 
    \((x1\ x2\^2 + x3\^3\ x4)\)\ x6\^2\ x7, 
    2\ \((x1\ x2\^2 + x3\^3\ x4)\)\ x5\ x6\ x7, 
    \((x1\ x2\^2 + x3\^3\ x4)\)\ x5\ x6\^2}\)

Now evaluate partials[y,yVars]/.yVarRules to get a numerical result.



The "/."  operator applies replacement rules.  Read about it, learn
it, and you will wonder how you ever lived without it.  
Here is the example so you can cut and past it into a nootbook.  In
this example, I use the % operator to refer to the previous output
line.  i.e.,  %/.yVarRules simiply means take the last output, %, and
apply /.yVarRules to it.  I hope this is not too confusing but the
info I've presented here is really important (I think anyway) so work
at understanding it!  It will payoff!!!
=======================Cut below==================
partials[fnc_,vars_]:=Map[D[fnc, #] &,vars]
======================Cut above==================

Hope this was more helpfull than confusing!

  • Prev by Date: Re: System of Equations
  • Next by Date: HELP!!!
  • Previous by thread: Re: Derivative Evaluation
  • Next by thread: Formatting Text