« first day (3239 days earlier)      last day (96 days later) » 

2:01 AM
ok this question is too embarrassing for the main site and I can't think of how to search for it
I'm implementing a little discrete-time fitness maximizing simulation with NestList
fitness:
w[x_] := 1 - x^2;
fitness gradient:dw = D[w[x], x]
function to be NestListed:
xnew[x_] := x + 0.1 dw
doesn't work, because the x in dw is not the same local x as in xnew[x_] I suppose
but, short of copying and pasting the algebraic expression for dw, how do I make this work?
(real problem has an uglier expression for w[x] and also is multivariate)
 
 
1 hour later…
3:06 AM
@ChrisK How bout this:
w[x_] := 1 - x^2;
(xnew[x_] := x + 0.1*#) &[D[w[x], x]]
So you make the definition of xnew a function that needs the evaluated version of dw as a parameter. So in the last [...] bracket, the derivative is evaluated and then injected.
 
 
11 hours later…
2:29 PM
@halirutan Thanks, that's a good way to sneak my dw in there.
 
 
1 hour later…
3:57 PM
The CASP competition is declaring protein folding to be "solved". Pretty exciting.
4
 
 
2 hours later…
6:17 PM
 

« first day (3239 days earlier)      last day (96 days later) »