43 votes
Accepted

Draw impossible figure with MMA, how can it be done?

Edit Since TernaryListPlot is new in 13.1 version,for old version,we use ternary[{p1_, p2_, p3_}] = {p1 + 1/2 p2, Sqrt[3]/2 p2}; ...
cvgmt's user avatar
  • 63.3k
27 votes
Accepted

Catmull-Clark and Doo-Sabin Subdivision Implementations

Catmull-Clark Subdivision Indeed, I have some code for Catmull-Clark subdivision and I planned to post it here for quite some time. This seems to be a good opportunity. The code is optimized for ...
Henrik Schumacher's user avatar
26 votes

Lyapunov Exponent

Update May 3, 2022: Added c, i, j as local variables Update Mar 12, 2022: Fixed mistake in implementation of PlotExponents ...
Chris K's user avatar
  • 19.5k
22 votes

How to draw a certain region and calculate its area and perimeter?

Show it: ...
yode's user avatar
  • 26.3k
21 votes

3D surface that looks like a virus

Another way to tackle this is to download 3D mesh files of actual viruses. Here is a page with many such files. First you grab the links to STL files: ...
Jason B.'s user avatar
  • 67.2k
20 votes

How to make a spiroglyphic?

Update In case your want to get your coloring on: ...
b3m2a1's user avatar
  • 46.6k
19 votes
Accepted

Programmatically annotate code?

You may use Interpretation. You will need some fancy formatting function that I will proxy here with Style. The following will ...
Edmund's user avatar
  • 41.7k
19 votes

Catmull-Clark and Doo-Sabin Subdivision Implementations

Doo-Sabin Subdivision To my own surprise, Doo-Sabin subdivision is in many ways much easier to implement than Catmull-Clark subdivision. The only real problem I met was to compute the faces created at ...
Henrik Schumacher's user avatar
19 votes

Draw impossible figure with MMA, how can it be done?

This is based on @cvgmt's unfinished try with AnglePath. And also using, I think, more appropriate coloring - based not on three different rotations of one object ...
azerbajdzan's user avatar
  • 9,568
18 votes
Accepted

Image segmentation by pixel value

Update: If you want 4-neighborhood, you can use MorphologicalComponents to do most of the work, which is fast and easy to implement (that was my original attempt, ...
Niki Estner's user avatar
17 votes

How to visualize the Cremona method for cardioid generation

Using CirclePoints, Mod, Throughand Range More than ...
rhermans's user avatar
  • 36.2k
16 votes
Accepted

How do I split a list of numbers to monotonic sequences?

Starting at 10.1, there's a fairly neat solution using SequenceCases: ...
Martin Ender's user avatar
  • 8,734
16 votes
Accepted

Visualizing convolution and deconvolution layers in mathematica

Okay lets do this: first we'll build a ground structure. Some Variables to define our Rectangle sizes. Next a variable to store our frames and a Table which ...
Julien Kluge's user avatar
  • 5,335
16 votes
Accepted

Code for an iteration method

I have seen your question on math.SE and I know how it is when you don't find the right place to ask a question. Consider this a one-time present. If you truly want to learn Mathematica, you need to ...
halirutan's user avatar
  • 112k
15 votes

How can this type of optical illusion be created in Mathematica?

I decided to take a slightly different approach. Instead of transforming an image, I thought of constructing a function that will look like the illusory figure in the OP after performing the log-polar ...
J. M.'s eventual burnout's user avatar
15 votes

How to visualize the Cremona method for cardioid generation

For this I like to use GraphicsComplex to be able to think about the points using their index instead of dealing with the coordinates. ...
Brett Champion's user avatar
15 votes
Accepted

How can I make this pipe network shape?

A spline solution: ...
martin's user avatar
  • 8,152
15 votes
Accepted

Speed up replacement of very large alternatives expression

Update: The Thread trick is not necessary any more in v13.3 to achieve full performance improvement; this trick is now effectively built-in behaviour. See the ...
Roman's user avatar
  • 45.9k
14 votes
Accepted

Making the number 12345...n

FromDigits@Flatten[IntegerDigits /@ Range[15]] 123456789101112131415 A function to do it: ...
murray's user avatar
  • 11.8k
13 votes

How to create effect like Van Gogh's stroke brush?

Now there's a built-in function for this called ImageRestyle
M.R.'s user avatar
  • 31.2k
13 votes
Accepted

Creating a bifurcation diagram of the logistics map

George has already provided a solution, but let's try and build up to it piece by piece so we can understand what we are doing. Coming from the worlds of loops, Mathematica's programming style can be ...
MarcoB's user avatar
  • 65.7k
13 votes

How can I make this pipe network shape?

Outline Gallery Method 1 : TreePlot with EdgeShapeFunction straightfoward to use Method 2: Stack parametric plots ...
userrandrand's user avatar
  • 5,727
13 votes
Accepted

Automating interesting ways to write 2023

I would like to point out FrobeniusSolve, e.g. this yields nonnegative solutions $(x_1,x_2)$ of this equation $20 x_1 +23 x_2 =2023$ ...
Artes's user avatar
  • 56.7k
12 votes
Accepted

How to work with Date calculations?

Using Mr Wizard's data the complete list of away days is away = Join @@ DateRange @@@ Reverse @ data; The 540th most recent ...
Simon Woods's user avatar
  • 84.6k
12 votes
Accepted

Drawing the hyperbolic geodesics joining pre-images

By a Blaschke product, I guess we mean a function of the form $$B(z) = \beta \prod_{k=1}^n\frac{z-a_k}{1-\overline{a_k}z},$$ where $|\beta|=1$ and $|a_k|<1$ for each $k$. These are exactly the $n$-...
Mark McClure's user avatar
  • 32.4k
12 votes
Accepted

How to visualize the Cremona method for cardioid generation

Using complex-number geometry and a sort of "converse" use of GraphicsComplex to @Brett's: ...
Michael E2's user avatar
  • 233k
12 votes
Accepted

Sum a number's digits until only one digit remain

Clear[s, t, n] t[n_] := NestWhileList[Total[IntegerDigits[#]] & , n, # > 10 &] Test: t[649134976] {649134976, 49,...
Syed's user avatar
  • 41.4k
12 votes

How to replace selected elements of a list of rules with another unbalanced list of rules

Replace[aa, newVnames,2] (* {EGW -> {5, 2}, HLT -> {2, 2}, AGF -> {2, 3}, WHS -> {1, 2}, TSC -> {1, 1}, CO12 -> {2, 1}, FIN -> {1, 1}} *) ...
user1066's user avatar
  • 15.5k
11 votes
Accepted

Drawing a figure showing an $n$-gon and its dissection into triangles

This is how I would implement the geometry demonstration you want to make. Perhaps it will work for you too. ...
m_goldberg's user avatar
  • 107k

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