Skip to main content
46 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
  • 75k
28 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
  • 20.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
22 votes

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

Show it: ...
yode's user avatar
  • 26.8k
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
  • 68.7k
20 votes

How to make a spiroglyphic?

Update In case your want to get your coloring on: ...
b3m2a1's user avatar
  • 46.9k
20 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
  • 18.8k
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
  • 42.3k
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
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
  • 36.1k
18 votes
Accepted

How can I make this pipe network shape?

A spline solution: ...
martin's user avatar
  • 8,678
17 votes

How to visualize the Cremona method for cardioid generation

Using CirclePoints, Mod, Throughand Range More than ...
rhermans's user avatar
  • 36.7k
17 votes

Can Mathematica perform logical reasoning?

This may be close. ...
Bill Watts's user avatar
  • 8,227
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,774
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,345
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
  • 113k
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

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,892
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
  • 48k
14 votes
Accepted

Making the number 12345...n

FromDigits@Flatten[IntegerDigits /@ Range[15]] 123456789101112131415 A function to do it: ...
murray's user avatar
  • 11.9k
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.5k
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
  • 67.3k
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
  • 57.5k
13 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
  • 19.4k
13 votes
Accepted

Can Mathematica perform logical reasoning?

Just a slight variation on the excellent answer given by Bill, which is too long for a comment. Boolean Variables The truth values of gr, ...
gwr's user avatar
  • 13.5k
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
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.5k
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
  • 237k
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
  • 55.4k
12 votes

How can I make this pipe network shape?

A couple of years ago, I wrote a (somewhat general) function to make Sankey diagrams. The top-level function (parseSankeyAssociation) doesn't seem to work out of ...
George Varnavides's user avatar

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