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,410
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
  • 62.1k
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
13 votes

Vectors with a certain magnitude in Mathematica

RandomPoint makes this a one liner (as of version 10.2): RandomPoint[Sphere[{0, 0, 0}, 4]] ...
Greg Hurst's user avatar
  • 36.4k
12 votes
Accepted

stream plot 2d cross section

You may use SliceVectorPlot3D. ...
Edmund's user avatar
  • 42.4k
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

How do I sum the products of the elements of a vector?

SymmetricPolynomial is the built-in way to get the sums you want: ...
JimB's user avatar
  • 41.9k
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
  • 398k
10 votes

How to show a time-dependent vector (velocity) with Manipulate?

You can do it thus: Manipulate[ Show[trayectoria, Graphics3D[Arrow[{pos, pos + vel} /. t -> α]]], {α, 0, 10 Pi}]
Feyre's user avatar
  • 8,617
10 votes
Accepted

How to show a time-dependent vector (velocity) with Manipulate?

By defining your kinematics equations as top-level expressions (rather than as functions of the relevant quantities), you invite scoping problems. I recommend working with functions and making the <...
m_goldberg's user avatar
  • 108k
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,020
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
  • 272k
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
  • 398k
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
  • 23.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
  • 131k
9 votes
Accepted

3D Vectors wrap on the Sphere

Create a mesh ...
yarchik's user avatar
  • 19.1k
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,448
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
  • 4,961
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
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
  • 23.9k
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.3k
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,488

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