Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

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: <8j9dpq$51p@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

atleast your example works with

ClearAll[x, tstFn1]
tstFn1[x_?NumericQ] := x^2

<< NumericalMath`NLimit`

ClearAll[u, v]
ND[N[tstFn1[u]], u, 1.]

Out[2]=2.

Regards
  Jens

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:
> In[804]:=
> ClearAll[x, tstFn1]
> tstFn1[x_] := If[NumericQ[x  ], Return[x^2];, Print["NonNumeric x
> and/or y."];]
> 
> In[808]:=tstFn1[2]
> Out[808]=4
> In[809]:=tstFn1[u]
> 
> & try to use ND[] on this function:
> 
> <<NumericalMath`NLimit`
> 
> In[806]:=ClearAll[u, v]
>             ND[tstFn1[u ], u, 1.]
> Out[807]= 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 ?