MathGroup Archive 2003

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

Search the Archive

Re: Define a function and its derivatives

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43531] Re: [mg43267] Define a function and its derivatives
  • From: Omega Consulting <info at omegaconsultinggroup.com>
  • Date: Fri, 19 Sep 2003 03:41:54 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

You can define the derivative to override the normal definition with

Derivative[m_][R] := D[E^(-#^4), {#, m - 1}]&

This works because the head of an expression is evaluated first. So the 
above definition acts before the normal derivative can be triggered.

At 07:08 AM 8/23/2003, Martin Manscher wrote:
>I wish to define a function and its derivatives. The function expression is
>complicated, but the derivatives are fairly simple (full cut-and-paste
>notebook expression below). The problem is that the definition of the
>function itself seems to shadow the definition of the derivatives. How can I
>make Mathematica prefer my definition of the derivative over the one derived
>from the definition of the funtion?
>
>In[1]:= n=4;
>In[2]:= Derivative[m_][R][z_] := D[E^(-z^4), {z, m - 1}]
>In[3]:= {R'[z],R''[z],R'''[z]}
>Out[3]= {E^(-z^4), -4 E^(-z^4)  z^3, -12 E^(-z^4) z^2 + 16 E^(-z^4) z^6}
>In[4]:= R[z_] = (2  UnitStep[z] - 1) (Gamma[1 + 1/n] - Gamma[1/n,
>Abs[z]^n]/n);
>In[5]:= {R'[z],R''[z],R'''[z]}
>Out[3]= <long expressions involving UnitsStep, DiracDelta etc.>
>
>Sincerely,
>
>Martin Manscher

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"
http://omegaconsultinggroup.com


  • Prev by Date: Re: Re: Fills in StackGraphics ?
  • Next by Date: Re: Mathematica 5.0 for students.
  • Previous by thread: Re: Re: Fills in StackGraphics ?
  • Next by thread: Re: Mathematica 5.0 for students.