Questions tagged [vector]
Mathematical vectors, operations on vectors and vectorized programming.
644
questions
1
vote
2
answers
82
views
Can you recover the original vectors that, when summed together, achieved a particular criteria
I am wondering if it is possible to take the binary strings of length $3$ (tuples) whose sums have weight $2$ (i.e they have $2$ non-zero entries)(binary case, meaning they have two $1$'s entries) $$u ...
1
vote
1
answer
23
views
How to find and delete the duplicates from lists of vectors
What I want to do is to take a list of vectors:
u={{1,0,0,0},{0,1,0,0},{0,0,1,0}}
v={{1,1,1,1},{1,0,0,0},{0,1,0,0}}
I want to find the duplicates between u and v ...
1
vote
0
answers
65
views
Mapping two pure functions over different lists
Say if I have two lists of vectors of the same length, for example:
u = {{1,0,0},{0,1,0},{0,0,1}}
v = {{1,0,1},{1,1,0},{1,1,1}}
I want to add (modulo 2) ...
0
votes
1
answer
46
views
Labelling vector state variables for solution of system of ODEs
This might be a duplicate, but I have not seen this problem addressed for DSolve usage.
I have a system of ODEs of the form
Y' = AY + B
When we put this into Mathematica as a vector variable:
...
1
vote
2
answers
42
views
How to delete duplicate lists of vectors (in any order) from a list of lists?
I have a list of vectors:
v={{{0,0,0},{0,0,1},{1,1,0}},
{{1,0,0},{1,1,1},{0,1,1}},
{{0,0,1},{0,0,0},{1,1,0}}}
Clearly, the first entry and the third entry contain the same vectors. I want to delete ...
1
vote
1
answer
94
views
Extend the code for more variables (at least 100)
I have this code (not in best shape) for a problem in 3 variables. It does the job. The problem is I want to extend this to more number of variables around 100 at least. It is very painful to extend ...
0
votes
2
answers
55
views
Understanding SetDelayed, ":=" [closed]
Consider the example below,
p = {1, 2, 3};
x = {x1,x2,x3};
fun[x_] := {{1, 0, 0}, {0, 1, 1}} . (p + x);
fun2[x_] = {{1, 0, 0}, {0, 1, 1}} . (p + x);
I expected <...
14
votes
1
answer
1k
views
Visualizing gravity warping the fabric of spacetime
What is a stable way of creating a set of points that are attracted to a single moving point? I have tried the following:
...
1
vote
1
answer
83
views
Vector 3d Plotting with New Mathematica Version
Hi Used to use the old version of Mathematica back in 2020. Now the new version is updated and I am trying to run the old code in the new version. My vector plots are very different. I wonder what I ...
2
votes
1
answer
181
views
3d Vector Wrap of Half sphere
How I can plot the flowing image using Mathematica?
Thanks,
2
votes
1
answer
45
views
NMaximize with generic domain
I want to have a function that gets generic domain and function and does maximum on this domain.
For this I tried the following straight-forward code:
...
4
votes
2
answers
165
views
Two simple vector partition rules
We have a vector of zeros and other numbers, f.e:
vector = {0, 0, 0, 9, 0, 2, 0, 5, 0, 4, 0, 5, 6, 2, 0};
The two rules:
Partition the vector in such a way that (1)...
0
votes
0
answers
40
views
How to find linearly independent linear combinations of a set of vectors (general case)
If I have a list of vectors, say $v=\{v_{1}, v_{2}, \dots ,v_{n}\}$.
Is there a way that I can get all linearly independent linear combinations of these vectors, such that if I change the content of ...
2
votes
1
answer
74
views
Differentiating unit tangent vector does not work
I am new to Mathematica and I want to visualize the tangent and normal vector field of a particular embedding of the circle. In my code it is [CapitalGamma][s]. When I put the unit tangent vector (uT[...
4
votes
1
answer
92
views
Building projection operators efficiently
The projection operator $P$ is defined in quantum mechanics as $$
P=\sum_i^n \vert\psi_i\rangle \langle \psi_i\vert, $$
where $\vert\psi_i\rangle$ is a column vector and $(\langle
\psi_i\vert=(\...
2
votes
0
answers
39
views
Coloring Vector if it points at (0,0,0) or (1,1,1)
I'm trying to plot a 3D vector field on a cubic space between [0,1]. I wanted to color the vectors based on their direction, where if they point towards (0,0,0) or the closer corners (1,0,0), (0,1,0), ...
1
vote
2
answers
97
views
Generate family of linear inequalities from vector variable for use in `FindInstance`
Suppose that I have a vector variable xvec = Array[x, 10].
How do I generate the family of linear inequalities
$$F = \{ {x\in\mathbb{R}^{10}:x_1\geq x_2,\ldots,x_9\...
0
votes
1
answer
76
views
Taking the inverse Laplace Transform as a vector operation
I am solving a system of first-order equations using matrix operations and the Laplace Transform. I begin with the matrix equation that represents the solution to my system, like this:
$$ \underline{\...
0
votes
1
answer
92
views
put vectors inside a vector
I have an empty vector like U = {}.
In an iteration, I get u1 = {a, b} and I want to put the vector in U to have {{},{a,b}}. I can do this simply with U = {U, u1} command.
But in another iteration, I ...
0
votes
2
answers
86
views
How to get Mathematica to carry out my computation of a vector norm fully?
I am relatively new to Mathematica, and I have come across the problem where Mathematica often doesn't seem to carry out calculations fully. For example: I have a vector v and want to find its norm, ...
4
votes
1
answer
151
views
ConjugateTranspose[#] vs Conjugate[Transpose[#]] for lists [duplicate]
Bug introduced in 12.3 or earlier, fixed in 13.0.
I'm getting contradictory behavior for eigenvectors of a matrix when using Conjugate, Transpose and ConjugateTranspose. I'll demonstrate using an ...
1
vote
2
answers
62
views
How to keep arrowheads in successive vectors?
I am generating successive arrows to represent vectors, but when they coincide all the arrowheads disappear except the last. But since they are vectors I want to keep all arrowheads to show direction. ...
0
votes
0
answers
28
views
Optimization over nested variables, vectors and matrices
I am trying to optimize a function that is fairly complicated, but at the end I just want to solve a parametrized assignment problem using integer linear optimization with Mathematica.
The main ...
8
votes
2
answers
341
views
Dot Product and Simplification
How to simplify the expression
a b . x/((a b) . x)
Where a is a scalar and b and x are vectors.
I have tried the usual Simplify, FullSimplify, TensorExpand etc. ...
1
vote
0
answers
47
views
Positioning of Text in a Graphics3D
I have an interesting problem to solve. I want to have Text in a Graphics3D. This can easily be done in the following way:
...
3
votes
1
answer
80
views
ReplaceAll Elements in an Indexed Vector
Following up on how to define symbolic vectors
Let x be an n-dimensional symbolic vector, where n is a positive integer large enough to be a massive pain in the butt.
...
4
votes
2
answers
354
views
How are Symbolic Vectors Defined?
It is my understanding that undefined symbols are considered scalars, so I can't index variables that aren't defined.
It is possible to define a symbol as a vector of symbols as follows, allowing ...
0
votes
1
answer
80
views
Could Mathematica analytically work with operators (such as $\nabla$) and vectors?
I have the following expression: $$(\nabla+\vec{P})^2$$
where $P=(r\cos\theta sin\phi,r^4\sin\theta,r\cos^3\phi)$
I would like to open the brackets and simplify the expression.
Are there in ...
0
votes
0
answers
59
views
Functions for translating a vector from one coordinate system to another
I have a vector $\vec{H}$ with components in Cartesian coordinate system $(x,y,z)$: $\vec{H}=(0,0,H)$. I would like to obtain coordinate of this vector in Spherical coordinate system $(r,\theta,\phi)$....
5
votes
1
answer
53
views
Assumptions about indexed variables
I am interested in the most efficient way to impose assumptions on indexed variables. In the following stylized problem, the following code
...
3
votes
1
answer
89
views
Verifying matrix exponential identity
I wish to verify the following matrix exponential identity using Mathematica:
$$ \mathbb{e}^{i.x.\hat{n}.\sigma}= \cos{x}.\mathbb{I}+ i\sin{x}(\hat{n}.\sigma) $$
where $\mathbb{I}$ is the $2\times2$ ...
1
vote
1
answer
158
views
VectorQ with "mathematical" typography
Define a matrix by:
where the "mathematical" typography is crucial here.
Then MatrixQ[mm] yields True (as expected).
...
0
votes
1
answer
44
views
How to calculate vectors? [closed]
Given
vector a=(m, 3), vector b=(1, m+1),
if vector a is perpendicular to vector b, calculate the value of m?
2
votes
1
answer
115
views
Increase precision of matrix multiplication [closed]
I am computing U.U......U.x, where x is a vector, U a square matrix and the product involves N times U, i.e., (U^N).x if you like. One way to do this is
...
1
vote
2
answers
79
views
(vector)Rotation for A to point towards B [closed]
Assuming,
Point A=vector2( 210,400)
B=vector2(-120,480)
Is there a short formula to find the angle to rotate A towards B ?
(A is currently heading towards the Y-axis)
Currently, using Pythagorean ...
3
votes
3
answers
145
views
I need to manipulate a line that can rotate in (-1,7) right where the dashed arrow touches the blue line by changing the direction of the red arrow
Graphics[{{Blue, Line[{{-5, 3}, {5, 8}}]}, {Dashed, Arrow[{{0, 0}, P}]}, Red, Arrow[{{0, 0}, v}]}, Axes -> True, AxesLabel -> {x, y}]
I've tried combining ...
1
vote
1
answer
55
views
How to test scalar product variables against each other?
Curious if there is a way to save time with scalar product multiplication with several variables?
I have a 8x4 matrix and i wanna check if all the columns are orthogonal with each other, so ive taken ...
1
vote
2
answers
188
views
How to find vector in the subspace 𝑊 that is the closest to y in mathematica
New to mathematica and have looked into the matrix page but can't find anything to help.
y= (4,3,3,1), u1=(1,1,0,1), u2= (-1,3,1,-2), u3=(-1,0,1,1)
2
votes
1
answer
81
views
Matricization of a vector
Definitions
Define a vector Tuples[a[0, 1], n] of elements $a[i_1,...,i_n], i_j \in \{0,1\} ~\forall j$, that is for instance
...
7
votes
2
answers
373
views
Why do some functions require its arguments to be in a list while others accept these as a sequence? [closed]
With Midpoint[{{4, -2}, {2, 5}}], the vectors must be in a list.
But with EuclideanDistance[{-2, 2}, {3, -6}], they don't.
These ...
0
votes
1
answer
69
views
Empty VectorPlot3D in Magnetic Field of Solenoid
I have been trying to plot the 3D magnetic field of a solenoid, with the below expression 1:
With C, the generalised complete elliptic integral, defined as follows:
I have implemented all of this in ...
0
votes
1
answer
67
views
ListVectorPlot3D not plotting anything nor giving any error, just empty 3D axes
It's as simple as the title says.
My code is:
...
0
votes
0
answers
52
views
How to improve VectorDensityPlot ColorFuntion resolution?
Whenever I use VectorDensityPlot I get presented with extremely poor resolution colour function with cuboid shape:
...
3
votes
3
answers
122
views
Checking conditions of 2 dimensional table
I have a 2 dimensional table and I would like to test if for each vector, x^2 + y^2 > 5.
vector is an element (x.y) of the table.
Is it possible to manipulate the elements of a table this way?
<...
5
votes
2
answers
117
views
Issue with the norm of a vector
Consider two vectors v1 = 1/Sqrt[2] {{Exp[I y/2]}, {Exp[-I y/2]}}; and v2 = I/Sqrt[2] {{Exp[-I y/2]}, {-Exp[I y/2]}};, such that ...
3
votes
2
answers
227
views
Linear dependence of two vectors is a necessary and sufficient condition for an equality
This is an example in the textbook.
To prove: for any real number** $a_1, a_2, \cdots, a_n, b_1, b_2, \cdots b_n$, linear dependence of the two vectors $\left(a_1, a_2, \cdots, a_n\right)$ and $\left(...
1
vote
2
answers
116
views
Showing each component of velocity in a helix
In this animation, I want to show each component of velocity (V_x, V_y and V_z) with arrows ...
2
votes
1
answer
59
views
Simplifying expressions with dot or non-commutative product (without the help of NCAlgebra)
I have two expressions (with dot and non-commutative product):
$f=J^T.x+J.x$
$g=J^T**x+J**x$
I want to simplify them and get the following expressions:
$f=(J^T+J).x$
$g=(J^T+J)**x$
In an attempt to ...
8
votes
1
answer
193
views
Weird black line appears in vector density plot
Bug introduced in 13.0, persisting through 13.1.
I am plotting a vector field data where the background color indicates the vector orientation. I use ...
3
votes
1
answer
143
views
Calculating power series of quantum operators on kets
I am using the "Quantum" add-on package to perform some quantum mechanical calculations using SU(1,1) generators. The code that I've developed reads
...