Tag Info

New answers tagged

2

Here is how you can do it using NestList and some code vectorization mat1[[1 ;; 2]] = Module[{ct = 1}, NestList[({{const1, const2}, {const3, const4}}.#) mat2[[1 ;; 2, ++ct]] &, mat1[[1 ;; 2, 1]], n - 1] //Transpose]; Assuming that the variables const1 to const4 have numerical values close enough to 1, e.g. const1 = 1.0; const2 = 0.9; const3 = ...


-1

God in Freenode helped to find some material related to this one, important to become more self-aware of things! Tuple ordering is not trivial thing. Starting the succicnt summary here! Summary Pair lists to create tuples in order covering ragged tuple ordering, Python's zip can be implemented with many different methods such as Flatten for ragged case ...


6

The function you want is MapThread - no Transpose needed. MapThread[f[#1, #2, #3] &, {L, A, Inc}] (* {f[874, 120 \[Degree], 0.246091], f[4513, 140 \[Degree], 1.15541], f[1487, 180 \[Degree], 1.15541]} *) And for your function: MapThread[N[{#1*Cos[#2], #1*Sin[#2]*Cos[#3], #1*Sin[#2]*Sin[#3]}] &, {L, A, Inc}] (* {{-437., 734.102, 184.394}, ...


3

You could get the lists you want simply by entering them as a nested list and transposing it: In[60]:= Transpose@{{1, 10, 100}, {2, 20, 200}} Out[60]= {{1, 2}, {10, 20}, {100, 200}} and In[61]:= Transpose@{{1, 10, 100}, {2, 20, 200}, {3, 30, 300}} Out[61]= {{1, 2, 3}, {10, 20, 30}, {100, 200, 300}}


1

Here's an answer to the question you have now erased. questions = {"name", "quest", "favorite color"}; answers = {"lancelot", "the holy grail", "blue"}; "What is your " <> questions[[#]] <> "? It is " <> answers[[#]] <> "." & /@ Range[3] {"What is your name? It is lancelot.", "What is your quest? It is the holy grail.", ...



Top 50 recent answers are included