Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14510
| From | Brentt <brenttnewman@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | How do you control evaluation when using apply? |
| Date | 2013-05-16 07:28 +0000 |
| Message-ID | <kn21qq$1hl$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
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.
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
How do you control evaluation when using apply? Brentt <brenttnewman@gmail.com> - 2013-05-16 07:28 +0000 Re: How do you control evaluation when using apply? Roland Franzius <roland.franzius@uos.de> - 2013-05-17 08:34 +0000
csiph-web