Tag Info

Hot answers tagged

4

OK, as an after-meal exercise, I fixed your code. The main modifications I've done are: 1. Based on trick mentioned in this post, change your pattern-matching function into pure function. 2. Change qsum = MapThread[Plus, #] &@Rq(for some unclear reason it can't be compiled, maybe it's because Rq isn't a "explicit" list? ) into qsum=Total@Rq. 3. ...


1

You can do that this way: Values = {{1, 2}, {3, 4}, {5, 6}}; VariableS = {{x1, x2}, {x3, x4}, {x5, x6}}; MapThread[Set, {VariableS, Values}, 2]; Integrate[Sin[x], {x, x1, x2}] Cos[1] - Cos[2] Your way is not working because VariableS[[1]] = Values[[1]]; sets the value of the first element of VariableS not the symbol names stored there.


1

With 1. the note about the behavior of ReplacePart inside Compile made by Daniel Lichtblau and Albert Retey in the comments above, 2. the correction for the simple mistake {a2, _Real} {a3, _Real}, 3. the note about All inside Compile here, 4. a modification for the uncompiled definition of qr i.e. changing qr = MapThread[Join[#1, {#2}, #3, {#4}] ...



Only top voted, non community-wiki answers of a minimum length are eligible