Questions tagged [vector]
Mathematical vectors, operations on vectors and vectorized programming.
117
questions
17
votes
6
answers
5k
views
Vectors with a certain magnitude in Mathematica
For a user-specified magnitude, is there a way to have Mathematica produce any 3D vector with that magnitude?
21
votes
2
answers
6k
views
Is it possible to do vector calculus in Mathematica?
I am trying to rearrange and manipulate some vector differential equations in Mathematica. As far as I understand you have to tell Mathematica that a variable is a vector by specifying the components ...
12
votes
4
answers
1k
views
Complex result for real vectors in VectorAngle
Bug introduced in 10.0 or earlier and fixed in 12.0.0 or earlier
I was expecting a real angle using VectorAngle when passing real valued vectors, but I obtained a ...
27
votes
10
answers
3k
views
Add a vector to a list of vectors
What is the syntax to add a vector v1 to each vector in a list of vectors v2?
I know it has to be simple, but I really have ...
12
votes
4
answers
13k
views
How do I simplify a vector expression?
I am doing vector analysis. I have figured out that the following expression won't be simplified in Mathematica:
Simplify[Dot[x, y] - Dot[y, x]]
I think the ...
7
votes
3
answers
2k
views
NDSolve with vector function
(Possible duplicate yet I still can't understand.)
Basic 2D revolving around origin:
...
27
votes
3
answers
7k
views
Visualizing a Complex Vector Field near Poles
I've been playing around with a visualization technique for complex functions where one views the function $f: \mathbb{C} \rightarrow \mathbb{C}$ as the vector field $f: \mathbb{R^2} \rightarrow \...
9
votes
1
answer
1k
views
How to define an orthogonal basis in the right way?
I am trying to work with the vector notation without defining vector components explicitly.
$Assumptions = (x | y | z) \[Element] Vectors[3]
The vectors ...
3
votes
2
answers
4k
views
Using the epsilon tensor in Mathematica
I'm having a great deal of trouble getting started on a weekly homework assignment in Mathematica. The assignment requires we use the epsilon tensor which is apparently built into Mathematica as ...
18
votes
5
answers
1k
views
Decomposing a matrix with polynomial elements into a polynomial with matrix coefficients
Let's say I have a matrix, $\mathbf{M}$, that is polynomially dependent on a single variable, such as
M = {{15 + a^2, a + 5 a^2}, {a - 5 a^2, 2}}
and I want to ...
14
votes
2
answers
2k
views
VectorScale Explanation
I'm having great difficulty understanding VectorScale. Here are the definitions from the documentation.
With the explicit specification ...
35
votes
2
answers
6k
views
Visualizing vector spherical harmonics
I have painstakingly derived the vector-spherical harmonics $\mathbf{V}_{J,\,M}^\ell(\theta, \phi)$, which are the generalization of ordinary spherical harmonics $Y_\ell^m(\theta, \phi)$ to vector ...
18
votes
3
answers
4k
views
Extract common factor from vector or matrix
I can't believe this hasn't been asked before but I can't find anything.
Is there a way to convince Simplify or FullSimplify to ...
16
votes
3
answers
7k
views
How to declare a 3D vector variable?
How can I do vector calculations without telling Mathematica the vector entries?
I have very many arbitrary linear combinations in $\mathbb{R}^3$ which I want to perform some general calculations on (...
16
votes
2
answers
5k
views
How to represent and manipulate abstract indexed vector (or tensor) expressions?
I have a couple abstract indexed quantities, both differential elements
$dx = dx^\mu e_\mu + x^\mu de_\mu$
$du = du^\mu e_\mu + u^\mu de_\mu$
I can compute the expression $(dx + du) \cdot (dx + du) ...
12
votes
2
answers
12k
views
Defining quantum-mechanical Bra and Ket operations
I have the following ket in the Fock basis: $\vert3, 0 ,1\rangle$, where each entry defines the number of photons in a particular mode and can take any one of the following numbers: 0, 1, 2, 3. As a ...
8
votes
1
answer
2k
views
Exporting 2D projection of 3D graph in SVG form
For 3D, Mathematica does not export SVG as vector graphics, it just puts an encoded png image inside svg file. Same happens if one exports as .eps or .pdf
This question does not address the problem ...
6
votes
1
answer
1k
views
Orthogonalizing without normalizing
Is there a way to make Orthogonalize do the normal Gram-Schmidt procedure without normalizing the result? As far as I've understood this was possible with ...
6
votes
2
answers
340
views
How to add a list of vectors (lists) to a directed graph as an edge weight?
Why does following command not work in Mathematica 11.2?
...
6
votes
1
answer
2k
views
Making a ListVectorPlot3D from data in an external file
I have a .dat file with six columns: {x y z vx vy vz}, where x, y, z are space coordinates and vx, vy, vz are the vector components.
How can I use this file to get ...
44
votes
2
answers
5k
views
Animating a Voronoi Diagram
edit: Excellent answers have been provided and I made an animation which is suitable for my use, however, all the examples rely on bitmap/rasterized data; is there a vector based approach?
I would ...
21
votes
7
answers
997
views
Make a huge vector in a wise way
I need to construct a vector similar to:
v[x_]:={0, 0, x, 0, 0, 2*x, 0, 0, 3*x, ....., 0, 0, n*x};
where n=10^9. How can I ...
9
votes
2
answers
706
views
7-dimensional cross product
How to define a 7-dimensional cross product?
$$\begin{aligned}\mathbf {x} \times \mathbf {y} =(x_{2}y_{4}-x_{4}y_{2}+x_{3}y_{7}-x_{7}y_{3}+x_{5}y_{6}-x_{6}y_{5})\,&\mathbf {e} _{1}\\{}+(x_{3}y_{5}...
5
votes
2
answers
2k
views
How do I do the Minkowski sum of two sets?
I have 2 sets, $X$ and $Y$. How do I find the Minkowski sum of these sets?
3
votes
2
answers
2k
views
Simplify vector expression - is there something like "Factor" for vectors, dot products etc.?
I am looking for a way to simplify dot products etc.
Here is a minimal example: Lets say I have two vectors a and b:
Array[a,2]
Array[b,2]
Now I evaluate their ...
2
votes
1
answer
2k
views
2D vector treatment and visualisation
I'm just trying to define a set of vectors, in the Cartesian plane, draw the vectors originating from the origin $O,$ and be able to add vectors and draw the resulting vector.
I've started doing ...
1
vote
1
answer
8k
views
Append[] is not working for empty list [duplicate]
I am trying to create an empty list and add an element but the list is not being populated.
My code
...
17
votes
6
answers
5k
views
Why can't I define vector v as having subscripted elements v_1, v_2, v_3...?
I'm a very beginner in Mathematica 8 programming. While trying to play a little with tensor analysis I encountered a problem. How to define for example vector in such manner:
v={$v_1,v_2,v_3$}
For ...
16
votes
4
answers
8k
views
What is the cleanest way to prevent divide-by-zero warnings?
If I evaluate {1, 2, 3, 4}/{5, 6, 0, 8}, obviously I get one warning:
...
11
votes
1
answer
2k
views
VectorPlot3D - vectors starting at points
Normally the vectors in VectorPlot3D are attached the middle. How to get them attached at the beginning (what is typical conventions in most textbooks) by use of <...
9
votes
1
answer
2k
views
Introduction to Vectors and NDSolve
I want to use NDSolve for a complicated equation that contains vectors. I am still new to Mathematica, and have really enjoyed what I have learned thus far. Concerning this question, I have already ...
8
votes
3
answers
677
views
"NotAvailable" and "NotApplicable" data points returned by WeatherData[]
I am trying to use ListVectorPlot in combination with WeatherData and CountryData to show ...
8
votes
2
answers
343
views
ListVectorDensityPlot plots outside the data in a very wrong way
I am plotting a vector field data set mydata where the background color indicates the vector orientation and its opacity for the vector magnitude. I use ...
8
votes
2
answers
1k
views
How to make a point's position time-dependent given a formula for the next step?
I've made a program that is just some points on a plane. Red points are cops and green points are robbers. Each point has a vector indicating where it is going to be in the next step of $t$. Right now ...
7
votes
1
answer
1k
views
SliceStreamPlot3D or StreamPlot3D
I know that neither of the two functions listed in the title exist, but I basically replaced vector for stream to give you an idea of what I want. The most ideal would be ...
7
votes
2
answers
288
views
Imposing breaks in contours in a ContourPlot without rasterization
In this question, we are asked to compute breaks in the contours of a ContourPlot so as to place contour labels (values) atop the colored boundaries rather than the ...
6
votes
2
answers
628
views
Is it possible that we can use “+” to add two vectors in polar form?
For example, $a=(2,\pi/4)$, $b=(3,\pi/3)$, if we want to get the result of $a+b$, using + operator will not do, because mathematica will ignore the polar form, and ...
6
votes
2
answers
1k
views
What are current approaches for supporting Dirac notation for quantum mechanics?
I'd like to be able to use Mathematica to preform some basic quantum mechanics and quantum computation operations using Dirac's Bra-Ket notation.
I've seen several solutions to defining basic ...
6
votes
1
answer
2k
views
Factor a Vector
Does there exist a function in Mathematica that simply takes out a common factor from a vector/list of expressions? This seems like such a simple operation that I am surprised that I could not find it ...
6
votes
2
answers
3k
views
Plotting: Is anyone familiar with gradientfieldplot command?
I am trying to plot this graph showing the electric field lines and lines of equipotential based off the electrode configuration(in black) of two parallel lines. This is what I've been using for other ...
4
votes
1
answer
922
views
Symbolic derivatives with vectors and matrices
I'm currently trying to solve some problems using symbolic vectors and matrices of arbitrary size. However, I have some problems with understanding and verifying the results:
I defined the vectors as ...
4
votes
3
answers
2k
views
How to expand a general expression in cross and dot product in Mathematica
I am looking for a way to simply the general expression in cross product and dot product with general vectors. I got a help in How do I simplify a vector expression? but soon I find that it doesn't ...
3
votes
1
answer
218
views
Problems evaluating a simple vectorial field with VectorPlot [duplicate]
I'm trying to plot the electrostatic field generated from a single charge on a plane. Without the $\frac{1}{4\pi\varepsilon_0}$ factor and the value of the charge $q$, as a function of $x, y$ the ...
3
votes
1
answer
1k
views
How can I use a unit vector notation found in physic texts?
In physics (I'm thinking of Taylor's Classical Mechanics or Griffith's Classical Electrodynamics) it is common to use "hat" vectors to denote unit vectors like $\hat{x}$ or $\hat{r}$. If I wanted to ...
2
votes
2
answers
151
views
Problem verifying expression with 3D vectors
I am unable to verify that my vector expressions are equivalent. I want it to say true or false.
...
2
votes
1
answer
991
views
Placing many arrowheads on curves
I can't find anything anywhere on the web to help me with this.
My plot:
...
2
votes
1
answer
531
views
How can I use parts of lists with Dynamic?
I'm a newbie - what am I doing wrong? I want to use parts of lists (vectors) in calculations but Mathematica will not evaluate anything that involves parts of lists that update dynamically. Is there a ...
1
vote
2
answers
407
views
Vector field of charges
I wanted to plot vector field of 12 positive charges Standing in a circular way with a positive charge at the center all same magnitude. I do not know how to start. Can you please help me
Thanks.
0
votes
2
answers
230
views
Graphing a Normal Vector to a Plane from the origin
I'm trying to plot a normal vector to a plane. I know I'm doing something I should know better, but can't seem to find. Vectors {0, 1, 2}, {1, 1, 3} obviously determine a plane. Their Cross Product is ...
0
votes
3
answers
310
views
Problem with finding a potential function of a vector field
I have this code where I try to calculate the potential function of the vector field F.
...