Linked Questions

69
votes
7answers
5k views

Partitioning with varying partition size

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$. For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning ...
55
votes
4answers
7k views

Create a torus with a hexagonal mesh for 3D-printing

I am new to Mathematica, and I'm looking for a way to create patterns on the surface of 3D objects. One thing I have not been able to do is to create a hexagonal mesh on a torus. What I would like to ...
7
votes
4answers
1k views

Drawing a trihexagonal tiling

I am trying to draw a trihexagonal tiling of the following form using Mathematica. I attempted to begin by using the result given in this Stack Overflow Q & A. However, I couldn't figure out how ...
8
votes
4answers
1k views

How can I get the number of slots in Function?

Suppose that I define f = Function[#1 + #2]; And I want to define a new function, argsNum, so that it returns a number of ...
7
votes
2answers
331 views

HoldForm[Operator ##] on some list

Recently in response to this question Mr.Wizard suggested an unusual way to summing numbers. This doesn't seem to be documented. ...
4
votes
3answers
817 views

How can I reorder the factors in the terms of a polynomial?

How can I reorder the factors in the terms of a polynomial? Consider ...
8
votes
1answer
993 views

Finding all length-n words on an alphabet that have a specified number of each letter

For example, I might want to generate all length n=6 words on the alphabet {A, B, C} that have one ...
7
votes
3answers
172 views

Creating MeshRegions of various 2D lattices

This is a soft question about the best approach to design a function that creates MeshRegion objects of various 2D lattices, e.g. kagome or hexagonal, all through ...
1
vote
2answers
147 views

How would I add together any list of arguments as a pure function?

Let's say I have a list of arguments, of any length. How would I add them all together? f = Evaluate[Plus @@ Array[Slot, 3]] & f[1, 2, 3] This would add ...
7
votes
1answer
107 views

Why doesn't defined MakeBoxes display what is constructed in RHS?

Inspired by the @ybeltukov 's answer to this question, if I have the following polynomial poly = a^2 + (a^2 + b^2 - c^2)*x + b^2*x^2; var = x; this generates ...
3
votes
1answer
268 views

Why does pattern test not work in this case to restrict the function parameters?

I was looking at this Q&A about using pattern test (pattern_?test) vs pattern condition (pattern_/;cond) and came across ...
0
votes
1answer
145 views

How to understand the extensional usage of Flatten? [duplicate]

Recently, I have been reading Mathematica program that written by many advanced Mathematica user, like Mr.Wizard, J.M., Kuba,etc to improve my programming capacity In the On generalizing Partition[] (...