Skip to main content
34 votes
Accepted

How can I reproduce a beautiful 3D vector plot?

Nice "inverse problem". The angle distribution looks to me like a Gaussian. ...
Henrik Schumacher's user avatar
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 ...
N0va's user avatar
  • 3,440
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. ...
ubpdqn's user avatar
  • 64.9k
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 ...
NonDairyNeutrino's user avatar
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 ...
Taiki's user avatar
  • 5,279
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. ...
Henrik Schumacher's user avatar
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 ...
Mauricio Fernández's user avatar
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, ...
Henrik Schumacher's user avatar
11 votes

Remove Abs from Norms of Vectors

If you have to use FullSimplify or Simplify, you can use the option ComplexityFunction to ...
kglr's user avatar
  • 401k
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 ...
Henrik Schumacher's user avatar
10 votes

Dot Product and Simplification

You'll want to use TensorReduce or TensorExpand with appropriate assumptions for reducing expressions involving ...
thorimur's user avatar
  • 9,080
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 ...
Szabolcs's user avatar
  • 236k
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 ...
Mr.Wizard's user avatar
  • 273k
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 ...
halirutan's user avatar
  • 113k
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
kglr's user avatar
  • 401k
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: ...
Sjoerd Smit's user avatar
  • 24.8k
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 ...
Carl Woll's user avatar
  • 132k
9 votes
Accepted

3D Vectors wrap on the Sphere

Create a mesh ...
yarchik's user avatar
  • 19.8k
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. ...
SHuisman's user avatar
  • 3,617
9 votes
Accepted

Mimicking Günther Uecker's nail art

Just an idea about using VectorPlot3D with a custom nail marker: ...
vindobona's user avatar
  • 6,326
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}}*)
Ulrich Neumann's user avatar
8 votes

Extract common factor from vector or matrix

A toy approach is as follows: ...
E. Chan-López's user avatar
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 ...
march's user avatar
  • 24.2k
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
Coolwater's user avatar
  • 20.5k
8 votes
Accepted

How does one plot a three-dimensional electric field in spherical coordinates?

Generate the TransformedField and then plot it. ...
eyorble's user avatar
  • 9,568
8 votes
Accepted

Using `Euclidean Distance` to calculate total distance

Total[Sqrt[Total[Differences[N@hops]^2, {2}]]] If performance matter then ...
Henrik Schumacher's user avatar
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 ...
John Doty's user avatar
  • 14k
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 ...
Mr.Wizard's user avatar
  • 273k
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 ...
NonDairyNeutrino's user avatar

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