MathGroup Archive 2013

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

Search the Archive

How do you control evaluation when using apply?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130799] How do you control evaluation when using apply?
  • From: Brentt <brenttnewman at gmail.com>
  • Date: Thu, 16 May 2013 03:28:00 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Why does this work

In[0]: = jacobianFunction[func_, vars_List] := Module[{f},
   f = Function[Evaluate[vars], Evaluate[D[func, {vars}]]];
  f
   ];
jacobianFunction[{Sin[x y], Cos[x + y]}, {x, y}] @@ {10, 2}

out[0]:= {{2 Cos[20], 10 Cos[20]}, {-Sin[12], -Sin[12]}}

But this does not (the goal is to make the function take a point as an
argument)


In[0]: = jacobianFunction[func_, vars_List] := Module[{f},
   f = Evaluate[Function[Evaluate[vars], Evaluate[D[func, {vars}]]]];
  f@@ # &
   ];
jacobianFunction[{Sin[x y], Cos[x + y]}, {x, y}][{10, 2}]



I can't get f@@ # & to evaluate properly (I've tried wrapping it in
ReleaseHold and evaluate statements, nothing seems to get it to evaluate.

I know I can just rewrite the function to take the point but I'm just
curious why it won't work.




  • Prev by Date: Re: Data interpolation
  • Next by Date: Re: Work on Basic Mathematica Stephen!
  • Previous by thread: What's the largest index-known prime? On odd-prime-position-constant.
  • Next by thread: Re: How do you control evaluation when using apply?