16
votes
Graphene bilayer rotation
Update: I just noticed you wrote Mathematica 7 and CirclePoints was introduced in v10.1. I am updating my code to eliminate it. I think what remains should work ...
14
votes
Graphene bilayer rotation
This solution should work normally on Mathematica 7.
It first generates a hexagonal grid and then removes every third point. Finally two grids are combined in one figure.
I have fine-tuned the ...
13
votes
How to plot $x^2$ over $-5<x<-1\cup1<x<5$
You can also define f conditionally:
f[x_] := x^2 /; (-5 < x < -1 || 1 < x < 5)
12
votes
How to plot $x^2$ over $-5<x<-1\cup1<x<5$
With
reg = ImplicitRegion[-5 < x < -1 || 1 < x < 5, x]
or
reg = Interval[{-5, -1}, {1, 5}]
do
...
11
votes
Accepted
11
votes
7
votes
Accepted
7
votes
Accepted
7
votes
Boundary conditions at infinity for 1+2D wave equation in Mathematica 7
Aha, finally here comes a chance to share my implementation of 2nd order absorbing boundary condition (ABC). To understand why the b.c. is implemented in this way, one may refer to Chapter 6 of Lloyd ...
7
votes
Accepted
How can I add a few specific mesh (altitude-like level) curves to a plot?
You can use multiple mesh functions in a plot, each with its own mesh definitions:
...
6
votes
Accepted
How to introduce random correlations in a 3D uniform distribution of points?
Here is a simple first approach:
We seed our "universe" by some random mass points (aka dark matter). Then the next mass point is chosen by an empirical distribution consisting of the ...
6
votes
Accepted
How to define a smooth function of random bumps in a plane?
Pick up the points
tt = Table[{x, y, RandomReal[{-1, 1}]}, {x, 0, 5}, {y, 0, 5}];
Interpolate
...
5
votes
How can I add a few specific mesh (altitude-like level) curves to a plot?
All the methods below add three styled curves, "while all other curves stay in the default style."
ContourPlot
1. You can use the options MeshFunctions ...
5
votes
How can I add a few specific mesh (altitude-like level) curves to a plot?
3D
Set the Mesh to
Mesh -> {{{-1, {Thick, Red}}, {0, {Thick, Green}}, {1, {Thick,
Blue}}}}
...
5
votes
Accepted
5
votes
How to get fuzzy points in a 3D view?
As OP already suggested, an image sprite based approach could be a solution, except a special rendering option ...
5
votes
What is the right way to rotate an array?
Quarter turn, where m any matrix.
Counterclockwise (positive direction):
Transpose @ (Reverse /@ m)
Clockwise (negative ...
5
votes
How to draw random colorfull domains in a plane?
Thanks @Cham @kglr, the ListContourPlot is a good idea.
I think we can also does not change the original points in the plane,so we append the three coordinate with ...
4
votes
How to draw random colorfull domains in a plane?
Well, I just found a nice trick, but it's not fully satisfying yet, since the cell color isn't random. How can I modify this code to get random colors in all cells?
...
4
votes
How can I improve this code?
First, get rid of AppendTo and replace it with a preallocation of the array because you know the size in advance.
Second, use ...
4
votes
Accepted
How to insert variable height in this random bumps function?
Update 2: If you don't need the mesh lines, the surface can be rendered very fast using BSplineSurface + Graphics3D (rather than ...
3
votes
How to simplify this sum of random waves?
To make it more Mathematica-y, we don't even need to define functions to call the parameters/the parts of the individual parameter lists. Instead we can create all the parameters at the same time and ...
3
votes
Randomly oscillating surface is not working well
The main bug is that you specify randomBumps[t_] := ... instead of randomBumps[t_] = ... This creates a new surface every time the time changes.
Further, you have some syntax errors. Here is a ...
2
votes
Accepted
2
votes
How to generate randomly curved and twisted strings in 3D?
Here is an attempt where you can specify the curvature and torsion.
The start point is chosen at random around the origin. The direction is also random.
With these data the Frenet-Serret formula is ...
2
votes
Accepted
2
votes
Accepted
2
votes
How to make this moving surface a continuous and derivable function?
We need some small modification of the code to plot derivatives
...
2
votes
How to define the density of random 3D points and plot it?
The following is an example based on a uniform distribution of points/galaxies, which can be adapted to any desired distribution. Also, some notes:
The code is given here only for educational ...
2
votes
How to define the density of random 3D points and plot it?
Here is an approach that I hope gets after your objective of
I would like to define the local number of particles per unit volume
V=ℓ3, on a variable scale ℓ, and plot it as level curves (i.e
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
version-7 × 95graphics × 21
random × 19
plotting × 17
generative-art × 15
manipulate × 12
graphics3d × 11
differential-equations × 9
list-manipulation × 7
function-construction × 7
bugs × 7
numerical-integration × 6
formatting × 6
output × 6
parametric-functions × 5
calculus-and-analysis × 4
functions × 4
performance-tuning × 4
graphs-and-networks × 4
distributions × 4
animation × 4
gui-construction × 4
version-8 × 4
matrix × 3
front-end × 3