30
votes
Accepted
Add a vector to a list of vectors
I recommend using Transpose twice since it is more efficient than other approaches. Moreover Plus has the ...
27
votes
Accepted
How can I reproduce a beautiful 3D vector plot?
Nice "inverse problem". The angle distribution looks to me like a Gaussian.
...
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.
...
20
votes
Accepted
How to detect loops in a vector field?
Maybe you can transform this into an easier problem: If you were instead looking for lines that are at any point perpendicular to your vector field:
(that's easy, it's just a coordinate ...
17
votes
Accepted
Orthogonal vector in two dimensions
It's already built-in. It's called Cross.
Cross[{1, 2}]
Output is
{-2, 1}
17
votes
Accepted
How to make Mathematica show matrices and vectors nicely
Add this to your notebook or init file
$PrePrint = If[MatrixQ[#], MatrixForm[#], #] &;
Then all matrices will automatically display as ...
17
votes
Add a vector to a list of vectors
To achieve what you need requires to distribute the sum over v2:
(v1 + # &) /@ v2
which is a short form of:
...
15
votes
Accepted
How to find the magnitude of a vector?
Norm in general assumes complex arguments and uses Abs to provide for that:
Norm[{x, y}]
Sqrt[Abs[x]^2 + Abs[y]^2]
For ...
15
votes
Accepted
VectorPlot3D - vectors starting at points
Update V.11.3: In version 11.3+ the new option VectorMarkers can be used with Placed to control the position of vectors:
...
14
votes
VectorScale Explanation
The option VectorPoints determines how many vector boxes there are. The plot domain is subdivided into a grid, whose grid points span the plot domain in each ...
14
votes
Accepted
Defining quantum-mechanical Bra and Ket operations
The definition of the scalar product in your question assumes that all your kets are orthogonal unit vectors. In that case, the most natural approach would be to use the built-in ...
14
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 ...
13
votes
Accepted
How to calculate a list without loop?
Accumulate@Array[b, {3}]
(* {b[1], b[1] + b[2], b[1] + b[2] + b[3]} *)
therefore:
...
12
votes
Is it possible to do vector calculus in Mathematica?
Our package VEST (Vector Einstein Summation Tools) is designed to do exactly this. It's described here and can be downloaded from github along with a tutorial.
I realize this question is now very ...
12
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]]
...
12
votes
Accepted
Complex result for Real vectors in VectorAngle
I believe this is one of the many manifestations of machine precision arithmetic in Mathematica, and it appears because VectorAngle also works with complex values. ...
12
votes
Accepted
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
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 ...
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
"NotAvailable" and "NotApplicable" data points returned by WeatherData[]
NB I think there's a problem with this code, please see this answer by ubpdqn for more information. I'll update these snippets when I get the chance.
Yours is a question with many possible ...
11
votes
Complex result for Real vectors in VectorAngle
Just found this. This is probably a good opportunity to demonstrate the importance of using a numerically stable formula.
I will use a simpler example:
...
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:
...
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
Using the epsilon tensor in Mathematica
The symbol $\epsilon$ is called the Levi-Civita tensor, it is usually written in terms of its components $\epsilon_{i j k}$. Having defined two vectors (i.e. first order contravariant tensors):
<...
10
votes
How to detect loops in a vector field?
The following is far from perfect, just a kickstart:
...
10
votes
Accepted
Derivatives of vectors
Here's how you should probably do this:
vec = Array[v, 3]
D[vec.vec, vec.{0, 0, 1}]
(* {v[1], v[2], v[3]} *)
(* 2 v[3] *)
I'll just make a couple of points about ...
10
votes
10
votes
Plotting a complicated 3D wave on the surface of a sphere
It seems to me that your function depends on too many variables to be represented entirely as a 3D contour. Perhaps we can get to what you need by approximation.
To start off, here is perhaps an ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vector × 581plotting × 148
matrix × 80
vector-calculus × 63
list-manipulation × 52
linear-algebra × 41
differential-equations × 33
equation-solving × 28
graphics × 28
calculus-and-analysis × 24
graphics3d × 24
functions × 22
tensors × 20
simplifying-expressions × 19
symbolic × 16
physics × 16
function-construction × 14
mathematical-optimization × 11
color × 11
performance-tuning × 10
interpolation × 10
operators × 10
table × 9
summation × 9
random × 9