Tag Info

New answers tagged

3

args = {{m1, n1}, {m2, n2}, {m3, n3}, {m4, n4}}; f @@@ args {f[m1, n1], f[m2, n2], f[m3, n3], f[m4, n4]} Apply[f, args, {1}] {f[m1, n1], f[m2, n2], f[m3, n3], f[m4, n4]} f @@ # & /@ args {f[m1, n1], f[m2, n2], f[m3, n3], f[m4, n4]} f[Sequence @@ #] & /@ args {f[m1, n1], f[m2, n2], f[m3, n3], f[m4, n4]} % == %% == %%% == ...


0

This is a possible implementation of what I was proposing, to get you started: Plot[ Interpolation[#, InterpolationOrder -> 1][x] & /@ {r1a, r2a}, {x, 0, 9.1}, Evaluated -> True, Epilog -> {{Red, Point[r1a]}, {Blue, Point[r2a]}} ]


1

Yes, for this you can use Map (as operator /@) which is one of the most often used functions when doing the same job for several inputs. For instance creating 3 data sets {g1, g2, g3} = Range /@ {10, 20, 30} and then creating your interpolations {i1, i2, i3} = Interpolation[#, InterpolationOrder -> 1] & /@ {g1, g2, g3} If you don't know what the ...


6

It happens because Compile cannot infer the types returned by the subsidiary functions enn and fF. In the second approach, you partially solved this by specifying it manually for enn. In principle you could have done that in the first approach as well if you had specified it for fF too, but in practice getting the type inference to work out correctly is not ...


6

While I'm not sure why the error you see is generated, you can fix your sumT function by taking the fF call out of the Map form: sumT = Compile[ {{tab, _Real, 2}}, Total[fF /@ Map[enn[#[[1]], #[[2]]] &, tab]], CompilationTarget -> "C"]; This worked fine for me in version 10.1 of Mathematica: sumT[tab] // AbsoluteTiming (* ==> {0.000667, ...


2

This ran fine on a beat-up old loungebook with k=100... (BTW - this does not directly answer the "How do I fix this problem doing things this way..." aspect - sometimes the answer is just "...don't do it that way..." when there's a more direct path to the desired results.) k = 100; size = 4; start = 1; end = 300; howmany = 1; If[howmany =!= All, ...



Top 50 recent answers are included