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}; ...
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 ...
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
...
22
votes
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:
...
20
votes
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 ...
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 ...
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 ...
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, ...
17
votes
How to visualize the Cremona method for cardioid generation
Using CirclePoints, Mod, Throughand Range
More than ...
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:
...
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 ...
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 ...
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 ...
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.
...
15
votes
Accepted
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 ...
14
votes
Accepted
Making the number 12345...n
FromDigits@Flatten[IntegerDigits /@ Range[15]]
123456789101112131415
A function to do it:
...
13
votes
How to create effect like Van Gogh's stroke brush?
Now there's a built-in function for this called ImageRestyle
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 ...
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
...
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$
...
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 ...
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$-...
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:
...
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,...
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}} *)
...
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.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
code-request × 507list-manipulation × 71
code-review × 69
plotting × 59
differential-equations × 40
graphs-and-networks × 34
equation-solving × 32
graphics × 27
matrix × 25
performance-tuning × 21
calculus-and-analysis × 20
image-processing × 18
programming × 18
geometry × 17
charts × 15
function-construction × 14
string-manipulation × 14
physics × 14
number-theory × 14
code-generation × 13
probability-or-statistics × 12
fitting × 12
functions × 11
manipulate × 11
mathematical-optimization × 11