MathGroup Archive 1998

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

Search the Archive

Re: Problem with ->



Hans Steffani wrote:
> 
> I want to substitute R[s] by k s.
> I tried:
> R[s] / R'[s] /. R[s] -> k s
> and got
> k s / R'[s]
> instead of the expected
> s
> 
> What am I doing wrong?
> 
> Hans Friedrich Steffani
> --
> Hans Friedrich Steffani
> Institut fuer Elektrische Maschinen und Antriebe, TU Chemnitz
> mailto:hans.steffani@e-technik.tu-chemnitz.de
> http://www.tu-chemnitz.de/~hfst/


Transformation rules ( /.x->y ) do not carry over to functional
evaluations.  In other words, the substitution R[s]->k s is just
pattern matching like in a word processor search routine.  R'[s] is not
in the pattern.  A transformation rule does not make any sort of a
global definition, it just searches your expression for a pattern and
makes the substitution.  If you want to DEFINE R[s] as k s,which is
very different from a transformation rule, then you need to make the
assignment as in:

R[s]:=k s;
R[s]/D[R[s],s]

which does return s.

By the way, the notation R'[s] for derivative is only used in DSolve and
NDSolve etc.  It does not instruct mathematica to evaluate a symbolic
or numerical derivative in general.  See page 78 of the 3.0 Mathematica
book for proper notation on total, partial and regular derivatives.

-- 
Remove the _nospam_ in the return address to respond.



  • References:
    • Problem with ->
      • From: hans.steffani@e-technik.tu-chemnitz.de (Hans Steffani)
  • Prev by Date: Re: Defining a Function??
  • Next by Date: Re: [Q] how to use simple notation to combine many graphics
  • Prev by thread: Re: Problem with ->
  • Next by thread: Re: Problem with ->