Skip to main content
14 votes

How to plot an imaginary number, i, power tower as done in the following way?

Plot the left graph. ...
cvgmt's user avatar
  • 77.9k
13 votes
Accepted

How can I iterate this process?

Here's one way: ...
C. E.'s user avatar
  • 70.9k
13 votes

How to recreate this complex iteration

The theorem is talking about disks and you've plotted a Julia set which doesn't involve transforming any disks, but instead iterates at every point and testing if that point reaches the escape radius. ...
flinty's user avatar
  • 25.6k
13 votes

Reproduce the annulus fractal

There is some bug in ConicGradientFilling if more than 2 colors are used. (see line at right of each annulus) Bellow are images ...
azerbajdzan's user avatar
  • 20.1k
12 votes
Accepted

Simple Fractal square

...
kglr's user avatar
  • 399k
12 votes
Accepted

Create a regular polygon with n vertices given two points

AnglePath. For two point {x1,y1} and {x2,y2}, at first we locate at ...
cvgmt's user avatar
  • 77.9k
12 votes
Accepted

Reproduce the annulus fractal

First, a variation on @azerbajdzan's approach to subdivide an annulus: ...
kglr's user avatar
  • 399k
11 votes
Accepted

Using Nest to build continued fraction

This is what you need: Nest[x/(1 + #) &, x, 3]
Lotus's user avatar
  • 2,671
10 votes
Accepted

Iteration on a matrix

NestList[x \[Function] 2 x + 4, {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, 100]
Henrik Schumacher's user avatar
10 votes

What is the most efficient way to define a Loop until function?

Here's a simpler version: SetAttributes[Until,HoldAll] Until[body_, test_] := While[body; !test]
Carl Woll's user avatar
  • 131k
10 votes
Accepted

FixedPoint not working, despite quick convergence of sequence

$Version (* "13.0.1 for Mac OS X x86 (64-bit) (January 28, 2022)" *) The Possible Issues section of the ...
Bob Hanlon's user avatar
  • 161k
10 votes
Accepted

Using multiple hashtags in NestList

Use Apply. NestList[Apply[{#1 + #2, #1 - #2} &], {100, 75}, 5]
cvgmt's user avatar
  • 77.9k
10 votes

Create a regular polygon with n vertices given two points

You can use CirclePoints. You just need to transform them: ...
flinty's user avatar
  • 25.6k
9 votes

Simple Fractal square

...
Henrik Schumacher's user avatar
9 votes
Accepted

Coding the Mandelbrot Set for Beginners

Something like ...
Roman's user avatar
  • 49k
9 votes
Accepted

What is the most efficient way to define a Loop until function?

I tend to use While[True, body; If[condition, Break[]] ] but what you show is equally good. This is just an alternative. Try to avoid procedural loops in ...
Szabolcs's user avatar
  • 236k
9 votes
Accepted

What's a functional alternative to nested Do loops?

Defining a function with some side-effect for demonstration purposes. f[i_, j_] := Echo[{i, j}] Here are some more WL-esque options: ...
George Varnavides's user avatar
8 votes
Accepted

Iterate over deepest values in a nested Association

Level[assoc, {-1}] (* {0, "one", 2, 3, 4} *)
Roman's user avatar
  • 49k
8 votes

How can I iterate this process?

C.E.'s answer is great already. I would just like to point out that we may exploit here that floating point addition is usually significantly faster than floating point multiplication that ...
Henrik Schumacher's user avatar
8 votes

Best way to count nest depth in e.g. f[f[f[...[f[x]]...]?

You can define a simple function to do this: fdepth[f[u_]] := 1 + fdepth[u] fdepth[_] = 0; For example ...
mikado's user avatar
  • 16.8k
8 votes

Replacing elements at a single level in a nested list

I am sure there are a hundred other solutions, but this one does the job and should be reasonably efficient: ...
a20's user avatar
  • 912
8 votes

Using multiple hashtags in NestList

The argument being supplied to the function is a list. It's a single argument with head List. So, #2 cannot be bound to anything. You can either use Apply (per cvgmt's answer) or use Part: ...
lericr's user avatar
  • 30.5k
8 votes

How to plot an imaginary number, i, power tower as done in the following way?

Plotting the real part on the horizontal and the imaginary part on the vertical axis, as is common: ...
Roman's user avatar
  • 49k
7 votes

Delete repeating elements across sublists

You may use a pattern approach with ReplaceRepeated using RandomChoice and Nothing to ...
Edmund's user avatar
  • 42.5k
7 votes

Iteration on a matrix

Another possibility is to write the problem via a recursion: f[n_] := 2 f[n - 1] + 4; f[1] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; To get any power, you then ask ...
bill s's user avatar
  • 69.4k
7 votes
Accepted

NestList: How to have a parameter that is changing as a function of nest index, n?

You can use FoldList: FoldList[STEP[#, #2] &, m0, Table[ii/NT, {ii, 1, NT}] ]
kglr's user avatar
  • 399k
7 votes
Accepted

How to create a nested list of variable depth with indexed elements

You can try Array: Array[c, {3, 3, 3, 3}] ...
kglr's user avatar
  • 399k
7 votes
Accepted

Heat transfer with functions defined on different domains

As I understood the question, the polymer is cooled on two sides by the mold. This implies a symmetry condition at the center of the polymer as shown in the image below. Create mesh In multi-material ...
Tim Laska's user avatar
  • 16.4k
7 votes

Using the Fold function with multiple parameter inputs

You could use Nest instead: Nest[f[a, b, c, #]&, x, 6] f[a, b, c, f[a, b, c, f[a, b, c, f[a, b, c, f[a, b, c, f[a, b, c, x]...
Carl Woll's user avatar
  • 131k
7 votes
Accepted

Defining a function iteratively without Mathematica getting stuck in a recursion loop

You can define the function(s) recursively: ...
bill s's user avatar
  • 69.4k

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