Mathematical vectors, operations on vectors and vectorized programming.

learn more… | top users | synonyms

7
votes
6answers
2k 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?
0
votes
0answers
49 views

Doing vector calculus with element-wise defined formulas and arbitrary-sized vectors [duplicate]

Currently I am trying to make Mathematica handle vector expressions defined element-wise. For example, But I can find no way to do this. Every way I tried requires a fixed-sized vector and returns ...
0
votes
1answer
66 views

Coloring data in Mathematica

I am trying to put color gradient on my data, or want values above some number to appear red and green below that number. For my situation the number is 5.14*10^(-13). I have X, Y, and Z axis data, ...
3
votes
1answer
153 views

Controlling scaling of multiple vector fields in VectorPlot3D

I'm trying to plot the electric and magnetic fields of a relativistically moving electric charge using VectorPlot3D, and apply "Manipulate" to change the velocity. The code I'm using is as follows: <...
4
votes
2answers
212 views

Is it possible to specify the direction of rotation in VectorAngle function?

If I use the function VectorAngle[{1,0},{1,-1}], is it possible to obtain the angle generated by rotating around the axis counter clock wise? In other words, I would move from the first vector to the ...
3
votes
1answer
98 views

Using Vector Operations In Mathematica

I would like to calculate $$ \mathbf T = (\mathbf B \bullet \nabla) \mathbf B$$ Where nabla (the upside down triangle) is the grad operator $(\partial/\partial x,\partial/\partial y,\partial/\...
1
vote
1answer
63 views
2
votes
1answer
71 views

Symbolic vector addition

I'm trying to figure out a nice way to add a mix of symbolic and explicit vectors/matrices without mathematica treating the symbolic vectors as scalars and promoting them to constant arrays. For ...
0
votes
1answer
34 views

Single rows of arrows in VectorPlot [duplicate]

I have two vector fields which have only one component, e.g. the y-component of the graph below. How do I obtain a plot similar to the one uploaded here, by using ...
3
votes
1answer
215 views

NDSolve mixing many scalar and vector equations

I have a set of scalar equations in many unknowns, which I want to combine with a vector equation inside an NDSolve. The equations are a mix of differential and algebraic equations. A set of scalar ...
1
vote
1answer
67 views

Plotting 3-vectors over a 3D lattice [closed]

I am trying to plot a magnetic structure, which is basically using Mathematica to read and plot a .dat file. In the file, each row which has six numbers, the first 3 represents the atomic postion, and ...
0
votes
0answers
41 views

Pass List / Vector argument through NDSolve to a function

I am trying to pass vector or list as argument to the function from NDsolve.And I am getting these error. Also I am pretty new to stack overflow. Apology if this a possible duplicate. Here is my code. ...
1
vote
1answer
52 views

Plot mysteriously not working [closed]

I'm running this code to plot an equation but it simply won't work ...
0
votes
1answer
61 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 ...
-1
votes
1answer
57 views

NDSolve and vectors [closed]

I think I can't find solution of equation below because I need use scalars, not vectors as I have tried. But I don't know how I can do express the problem with scalars. I have read Wolfram Language ...
1
vote
0answers
24 views

How do I add a finite value to one component of a set of vectors [closed]

I have a set of (x,y) values in some *.csv file, when I open them with Mathematica to plot it some of the plots are shifted so I need to add some finite value to one of the components of every vector. ...
0
votes
1answer
93 views

Plotting a function of vectors and sample points [closed]

I need to plot a function of vectors. \begin{equation} 2y\vec{r}\cdot\vec{x}+2y^2+\vec{x}\cdot\vec{x}=1. \end{equation} This is actually an equation of constraint. Given $\vec{r}$, with $|\vec{r}|\...
4
votes
1answer
54 views

Plotting a vector function composed of piecewise scalar functions

I am relatively new to Mathematica, and am having difficulty doing something that is conceptually very simple. I am trying to plot a vector field in which the vector function is composed of piecewise ...
4
votes
2answers
222 views

Plotting a complicated 3D wave on the surface of a sphere [duplicate]

Suppose you have a vectorial wave described by a complicated function of time and cartesian coordinates $t$, $x$, $y$ $z$ (very simple example below) : ...
0
votes
1answer
66 views

NDSolve and a vector function [duplicate]

I'm trying to solve a set of differential equations which include a numerical function that takes a vector and returns a vector. ...
3
votes
5answers
195 views

How to define a set of two random orthogonal unit vectors?

I need to define a random set of two orthogonal unit vectors. The code below doesn't give proper unit and orthogonal vectors : ...
0
votes
3answers
172 views

Plotting a 3D vector field on 2D plane

I want to visualize vector field that is of the form $(v_1(x,y), v_2(x,y), v_3(x,y))$, i.e. there is a three component vector that depends on only two coordinates $x$ and $y$ in the real plane. There ...
1
vote
0answers
41 views

How to pack arguments of a function into a vector for brevity? [closed]

I have a function like the following one: F[a_, b_, c_, d_] := Product[f[x, y, z, j, i], {j, a, b}, {i, c, d}] where ...
3
votes
1answer
57 views

Integrating a gradient and matching terms automatically

I am trying to integrate a function $\nabla w(x,y)$ indefinitely knowing both components of $\nabla w(x,y)$. I have a function dw[x_,y_] that I have defined. I then ...
0
votes
0answers
30 views

Simplify expression?

Suppose I have expressions that involve terms like: p1.p1+p2.p2+p3.p3+p4.p4 p1, p2, p3, and p4 are all elements of an array: ...
3
votes
1answer
157 views

Errors Solving Elliptic PDES with FEM

I am trying to solve the equation below governing transversely isotropic plane strain in cartesian coordinates with the given boundary conditions based on code found here using Mathematica 10.1 on OSX ...
2
votes
1answer
73 views

How to a convert a 2D vector into an angle [closed]

How do you calculate the angle between the line from the origin to a point $(x,y)$ and the horizontal axis?
1
vote
1answer
92 views

Color vectors according to a user-defined function

V[x_,z_]:=x/Sqrt[x^2+z^2]; Ex[x_,z_]=-D[V[x,z],x]; Ez[x_,z_]=-D[V[x,z],z]; The electric field components (Ex,Ez) are to be plotted as a vector field in the x-z ...
1
vote
1answer
71 views

Cross product of three vectors

I am following the answer of Jens from following post: How do I simplify a vector expression? vec /: Cross[vec[x_], HoldPattern[Cross[y__]]] := I want to create ...
1
vote
1answer
136 views

Draw Vectors in Spherical Shell and then Animate

I want to draw three vectors inside a spherical shell. One of the vectors will be moving, the others will be stationary. However, the animation is the next step. For now, I would like to get the ...
1
vote
1answer
410 views

Factor vector out of a matrix

I am wondering how to factor a[1],a[2],...,a[4] out of sim so that I can write sim as the ...
11
votes
2answers
3k 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 ...
0
votes
0answers
201 views

Plotting Phase Space [duplicate]

I have these two Equations \begin{align} x'(t)&=\sin(y)\\ y'(t)&=\cos(x) \end{align} and I'm trying to plot the phase space(plane) for this system... I've tryed Equationtrekker but can't ...
3
votes
3answers
247 views

Plot a vector field over a line

This seemingly simple problem is giving me some trouble. I need to plot a vector field on a line, and for that I'm following what I found here. I try to create a mesh that contains two points and just ...
1
vote
0answers
64 views

Given vector of function plot each of them separately? [closed]

At the moment, I am trying to plot a vector of functions which consists of the change along $x$, $y$, and $z$. Is it possible in Mathematica to give a vector of functions and plot them separately ...
3
votes
2answers
54 views

How to avoid 0 OverVector[F] to be evaluated as 0?

I am fairly new in Mathematica and I am trying to work with scalars and vectors. I decided to denote vectors using OverVector (as example, ...
1
vote
1answer
78 views

How to adjust vector scaling with a specific aspect ratio

I'm trying to create a vector plot with uniform vector scaling. I need the x and y ranges to be very different, because I need to highlight the angle between the vectors and the y=0 axis. This means ...
2
votes
4answers
142 views

How to obtain the gradient of a function as a function?

The Grad function allows me to get the gradient of a function like this: ...
3
votes
2answers
206 views

ListPlot vector 3D circle line

I got a 2D vector with the following code. ...
0
votes
2answers
45 views

Unevaluated derivatives of known functions after replacement

I want to make the following replacement work correctly: Array[(2 D[xM[[#1]][t], t] * D[xM[[#2]][t], t]) &, {3, 3}] /. {xM -> {Sin[ω t], Cos[ω t], 0}} ...
6
votes
2answers
72 views

A problem about matrix/vector extension via $\tt ArrayPad$

Given that I have a vector and matrix as follow: vec = Array[Subscript["P", #] &, 6, 0]; mat = Array[Subscript["P", #1, #2] &, {5, 4}, {0, 0}]; And I ...
0
votes
0answers
44 views

Order of evaluation for numeric functions

I'm trying to plot a 3D vector field to illustrate an electric field of a uniformly charged disk, and I used Manipulate to change the radius R of the disk to see ...
1
vote
1answer
41 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 ...
8
votes
3answers
201 views

Complex result for Real vectors in VectorAngle

I was expecting a real angle using VectorAngle when passing real valued vectors, but I obtained a complex angle: ...
3
votes
4answers
192 views

Pack Solve results into a vector

I am currently using a really easy function to get the eigenvectors of a corresponding eigenspace: ...
1
vote
1answer
89 views

Calculation of tensor structure

I would like to calculate following type of contraction: $$ P_{ij}^{p-k} P_{lm}^{k} ((p_l - k_l) \delta_{ij} + k_j \delta_{il}) (k_n \delta_{im} - p_m\delta_{in}) = ? $$ where p,k are d-...
0
votes
1answer
74 views

Minimization of linear combination of vectors

Suppose I have a vectors in $\mathbb{R}^{6}$. For example, take the vector $v = k(-2,2,4,6,2,2)$. I would like to find some $k$ with the constraint that the last two components are necessarily non-...
5
votes
3answers
414 views

How to calculate a list without loop?

I have pairs of numbers {a1, b1}, {a2, b2}, {a3, b3}, ..., ...
0
votes
2answers
105 views

How to evaluate function in the grid?

I have a function f[a_, b_]: = b^a + a b. a takes values {1,2,3,4}, and ...