Re: How to operate on strictly numerical functions ?
- To: mathgroup at smc.vnet.net
- Subject: [mg24115] Re: How to operate on strictly numerical functions ?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 28 Jun 2000 02:11:39 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
atleast your example works with
tstFn1[x_?NumericQ] := x^2
ND[N[tstFn1[u]], u, 1.]
Mark Harder wrote:
> Some of the Mathematica functions made for numerical procedures
> appear to actually evaluate by substitution of symbolic variables with
> replacement rules. An example of this, which has blocked me for more
> than a week now, is NonlinearRegress, which seems to evaluate the
> user-supplied model function symbolically, then evaluate the resulting
> expression through replacement of the independent variables and the
> current set of adjustable parameters through replacement rules that it
> constructs. My model function requires evaluation of the SVD (with
> SingularValues ) of a matrix computed from the independent variables
> and the parameters of the model, and so NonlinearRegress fails, since
> SingularValues can't accept a non-numeric matrix. A simpler example I
> have encountered is the numeric derivative function, which I'll use to
> illustrate my problem.
> First, construct a simple test function which, through an If test,
> won't evaluate for non-numeric arguments:
> ClearAll[x, tstFn1]
> tstFn1[x_] := If[NumericQ[x ], Return[x^2];, Print["NonNumeric x
> and/or y."];]
> & try to use ND on this function:
> In:=ClearAll[u, v]
> ND[tstFn1[u ], u, 1.]
> Out= 0
> So, I'm looking for some means of modifying testFn1 to cause ND to
> evaluate it only after numeric substitution for u. Is there some way of
> Hold-ing evaluation until numeric values are assigned to arguments of a
> function? Is this sort of thing impossible in Mathematica? Do I have
> to write my own numeric routines for finding derivatives, gradients,
> Jacobians, least-squares fits, etc. by procedural routines ala FORTRAN?
> Thanks for any help you can offer.
> mark e. harder
> harderm at ucs.orst.edu
Prev by Date:
Re: Conditionals with multiple tests?
Next by Date:
Re: Gradient in FindMinimum
Previous by thread:
Fw: How to operate on strictly numerical functions ?
Next by thread:
RE: How to operate on strictly numerical functions ?