8
votes
Accepted
Generate vectors with a certain property
Solution without recursion.
gen[n_Integer?Positive] := FoldList[#2 (#1 + #2) &, 0, #] & /@ Tuples[{0, 1}, n - 1]
For ...
4
votes
2
votes
Accepted
How to sum with respect to partitions
This isn't very performant, but maybe it'll get you started. I'd start by defining a helper function to create the partitions.
...
1
vote
Accepted
1
vote
Accepted
Add a new column based on the complement of column data in a table
Let's build this up bit by bit. At each step, there are probably several alternate ways to do it, so you might want to experiment to figure out exactly what you want.
First, we need a representation ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
programming × 1596list-manipulation × 215
functions × 111
performance-tuning × 111
function-construction × 98
evaluation × 57
equation-solving × 55
plotting × 48
graphics × 48
matrix × 48
dynamic × 48
syntax × 45
mathematical-optimization × 40
notebooks × 39
functional-style × 37
front-end × 36
scoping × 34
graphs-and-networks × 33
pattern-matching × 33
differential-equations × 32
manipulate × 32
algorithm × 32
recursion × 31
core-language × 31
probability-or-statistics × 29