34
votes
Accepted
How can I reproduce a beautiful 3D vector plot?
Nice "inverse problem". The angle distribution looks to me like a Gaussian.
...
29
votes
Accepted
Visualizing gravity warping the fabric of spacetime
Here my physicist approach to the problem: I consider a cloud/grid of test-particles which get attracted to a reference point by a force. In the following I assume attraction by gravity -- i.e. the ...
21
votes
Accepted
Animate a circle "rolling" along a complicated 3D curve
EDIT
As OP wishes (and as Rahul correctly points out) my original answer puts unit circle in TB plane (my error as labels suggest) and what is desired is TN plane.
...
15
votes
Accepted
Remove Abs from Norms of Vectors
expr = Norm[{a, b*c}]
Sqrt[Abs[a]^2 + Abs[b c]^2]
Since ComplexExpand assumes all its variables to be real, we ...
14
votes
How can I reliably plot ellipse-field streamlines?
Use NDSolve to solve for y(x)
Perhaps this serves as a starting point. Shown below is the case when b = -1.
Each streamline is obtained from ...
14
votes
Accepted
Speeding up cross and dot products for a list of vectors
Almost the fastest way would be to use Compile to generate a CompiledFunction.
...
12
votes
How do I determine if two 2d vector parallel?
Based on the definition of the scalar product for $d$-dimensional vectos
\begin{equation}
a \cdot b = |a| |b| \cos(\phi)
\end{equation}
you can create a test based only on vector operations. The ...
12
votes
Accepted
Can we turn this for loop into a more elegant Mathematica code?
Apparently, you try to apply a permutation given by list indirection to a vector duplicate.
Here are several ways to do it, ...
11
votes
Remove Abs from Norms of Vectors
If you have to use FullSimplify or Simplify, you can use the option ComplexityFunction to ...
10
votes
Divide column of a matrix by a specific number
How about this?
de.DiagonalMatrix[{1.,0.5}]
If de is a matrix with many columns then
...
10
votes
Dot Product and Simplification
You'll want to use TensorReduce or TensorExpand with appropriate assumptions for reducing expressions involving ...
9
votes
Accepted
How do I determine if two 2d vector parallel?
$a$ and $b$ are parallel if $a = \kappa b$. Try
MatrixRank[{a, b}] == 1
for an easy way to test this. This works only if neither of the vectors have norm ...
9
votes
Accepted
What is the operator **?
Since this was missing from What are the most common pitfalls awaiting new users? I'll answer. ** is shorthand for ...
9
votes
Accepted
Exporting 2D projection of 3D graph in SVG form
In principle, this all is not difficult but there are some obstacles in the way that will make life hard:
In a 2d projection of a 3d polygon graphics, many of the polygons are not visible since they ...
9
votes
Accepted
How to simplify tensor expression with symbolic coeficients?
$Assumptions = {(a | b | c) ∈ Vectors[3], g ∈ Reals}
TensorReduce[g b.a\[Cross]c - g c.b\[Cross]a]
0
9
votes
Accepted
Multiplying list of matrices with vector of scalars
An easy way to achieve this, is to use Inner with a level specification. In this case, you want the inner product to work only on the first level:
...
9
votes
Summation of Kronecker deltas should give the dimension
You could just do:
Sum[KroneckerDelta[μ, ν] KroneckerDelta[μ, ν], {ν, d}, {μ, d}, Assumptions->d>1]
d
Although it might make sense to use symbolic ...
9
votes
Accepted
9
votes
Accepted
3d Vector Wrap of Half sphere
The lighting is a bit hard to get right without ray-tracing (though possible in Mathematica on Mac). Here is a first attempt, feel free to improve.
...
9
votes
Accepted
Mimicking Günther Uecker's nail art
Just an idea about using VectorPlot3D with a custom nail marker:
...
9
votes
How to create an array from all combinations of the vector components?
Try
Flatten[Outer[{#1, #2} &, {a, b, c}, {w, x, y, z} ], 1]
(*{{a, w}, {a, x}, {a, y}, {a, z}, {b, w}, {b, x}, {b, y}, {b, z},{c,w}, {c, x}, {c, y}, {c, z}}*)
8
votes
8
votes
Accepted
multiplication of vector spaces
Here's a take that allows one to keep track of the order of things carefully. Note that this is similar in nature to the answer here.
Annihilation operators
We first construct the annihilation ...
8
votes
Accepted
Divide column of a matrix by a specific number
de[[All, 2]] /= 2;
de
Or if you can't replace the old values
deNew = de;
deNew[[All, 2]] /= 2;
deNew
8
votes
Accepted
How does one plot a three-dimensional electric field in spherical coordinates?
Generate the TransformedField and then plot it.
...
8
votes
Accepted
Using `Euclidean Distance` to calculate total distance
Total[Sqrt[Total[Differences[N@hops]^2, {2}]]]
If performance matter then
...
8
votes
Accepted
Rotating Vectors in space
I think you want a single transformation function for all points, rather than one for each point independently as kglr's answer currently shows.
...
8
votes
Accepted
multiply two vectors, component by component
No need to do anything fancy. This is just how ordinary list multiplication works:
{a1, a2, a3} {b1, b2, b3}
yields
...
8
votes
Accepted
Using DeleteCases to delete vectors with particular index as 0
DeleteCases[set, {___, 0}]
{{0, 1, 1, 0, 1}, {1, 0, 1, 1, 1}}
In this case Pick also ...
8
votes
Accepted
Plotting single vectors in parametric plots
The problem is that Epilog creates a 2D graphic that is overlayed on top of the main image. From the Details section of the documentation
In three-dimensional ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vector × 679plotting × 168
matrix × 98
list-manipulation × 68
vector-calculus × 68
linear-algebra × 51
differential-equations × 38
graphics × 35
equation-solving × 33
calculus-and-analysis × 30
graphics3d × 30
simplifying-expressions × 25
functions × 24
physics × 23
tensors × 22
symbolic × 18
function-construction × 17
mathematical-optimization × 14
color × 14
performance-tuning × 13
operators × 12
manipulate × 11
summation × 11
interpolation × 10
random × 9