Questions tagged [vector-calculus]

Questions on dealing with vector calculus functions of Mathematica such as Grad, Div, Curl, Laplacian and their representations in various coordinate systems.

52 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
9 votes
0 answers
178 views

Symbolically evaluating gradients/Hessians

I'm taking a machine learning course, which involves taking a lot of analytical gradients and Hessians. It would be ideal if I could perform these calculations in Mathematica. However, I am only aware ...
user48151's user avatar
8 votes
0 answers
1k views

Visualizing the Lagrange Multiplier Solution

This question is based on work in Susan Colley's Vector Calculus, 4th ed. The question is to find and classify critical points of $f(x,y,z)=3xy-4yz+5xz$ subject to the constraint $g(x,y,z)=3x+y+2z=13$...
David's user avatar
  • 14.8k
5 votes
0 answers
352 views

How to verify the convexity of a function?

I have an optimization problem with the following objective function in $(x,y)$ $$ A\log \left(\sum_{i=1}^n x_i\right)+\log\left(1-\frac{f}{n}\left(\sum_{i=1}^n\frac{x_i}{y_i}\right)\right) $$ where $...
user_lambda's user avatar
4 votes
0 answers
674 views

Is there a 3D version of ListStreamPlot[] (analogous to ListVectorPlot3D[])

Is there is straightforward way to visualize streamlines given a series of discrete samples of a 3D vector field? There is a generalization of ListVectorPlot --> <...
wil3's user avatar
  • 253
4 votes
0 answers
391 views

Complex boundary conditions and NDEigensystem

I am having difficulties implementing a Neumann value when numerically solving the Navier equation using NDEigensystem. The Navier equation is given by $\nabla^2 \vec u + (p^2 - 1) \nabla(\nabla\...
Red's user avatar
  • 53
3 votes
0 answers
145 views

Summation variables aren't recognised as dummy variables

I'm trying to write this expression in Mathematica, and calculate the following quantity However, when I tried the following ...
Our's user avatar
  • 229
3 votes
0 answers
274 views

Finding possible lattice planes of a crystal structure

After generating a crystal structure from a crystallographic data and duplicating it to a larger crystal system I would like to find possible lattice planes of this crystal. It is well-known that the ...
PhilG's user avatar
  • 31
2 votes
0 answers
79 views

12.1 VectorPlot - How to show differing magnitudes in the new implementation

I'm graphing vector fields for a class. Magnitude is important at least initially. In 12.0 and earlier VectorPlot plotted the different magnitudes as length. In 12.1 VectorPlot represents magnitude by ...
Gerald Bilodeau's user avatar
2 votes
1 answer
157 views

Plotting list data of cross product of field vectors

I have some experimental data points of electric Ey(t, value) and magnetic field Hz(t, value). I am trying to calculate the ...
Gopal Verma's user avatar
  • 1,025
2 votes
0 answers
118 views

How can I make NDSolve aware of vectorial nature of an ODE?

I am trying to solve the equilibrium equation $\text{DIV } \mathbf P(\textbf{u}(x,y)) = \mathbf{f}$, where $\mathbf P$ is the stress tensor defined by $$ \mathbf P = \mathbf F + (1-\det\mathbf F)^...
rmk236's user avatar
  • 21
2 votes
0 answers
61 views

Find vectors describing two interconnected pyramids in Euclidean space

I need the help of competent linear algebra specialists in Mathematica. In the Euclidean space, two tetrahedrons are turned at different angles. Their vertices coincide with the beginning of the base ...
dtn's user avatar
  • 2,344
2 votes
0 answers
64 views

How to get results in terms of vector operations?

Is there a simple way to simplify an expression in terms of vector operations? For example, when I evaluate this; ...
Mahmut Akkuş's user avatar
2 votes
0 answers
261 views

Computing quadratic differential trajectories with Mathematica

There was a question about a particular case of this, Quadratic differentials; seemingly it contained too little information, so let me try again. This will be also a second take on my previous ...
მამუკა ჯიბლაძე's user avatar
2 votes
0 answers
203 views

Extracting the curl-free component of a vector field

I am trying to extract the curl-free component of a discrete vector field. My plan is to take the Fourier transform of the vector field and then extract the radial component in Fourier space. The ...
Roshan Mammen Abraham's user avatar
2 votes
0 answers
785 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 ...
bonanza's user avatar
  • 167
2 votes
0 answers
341 views

Derivative of vector dot product with respect to a vector

I have the expression: Transpose[gvecI, {2, 1}].x (m[1] + m[2]) gvecI and x are [3x1] ...
space_voyager's user avatar
1 vote
0 answers
63 views

Vector Potential Function of Vector Field with DSolve?

(This is a redux of this.) Why doesn't this work? I have a vector field F1 whose div is 0 with a known vector potential function A2, and I try to get DSolve to solve the differential equation for A2 ...
Jeffrey Rolland's user avatar
1 vote
0 answers
81 views

How to define a vector operator?

I know how to define a single-variable differential operator like Clear[Op] Op[x_] := a D[#, {x, 1}] & and I can do operations like ...
z.v.'s user avatar
  • 189
1 vote
0 answers
47 views

Using `GradientFilter[]` and `GradientOrientationFilter[]` to reproduce Matlab's `gradient()` function

In 'gradient' function in MMA, two methods are given to reproduce Matlab's gradient() function. I thought that ...
ZachB's user avatar
  • 1,200
1 vote
0 answers
87 views

StreamPlot works slow with analitical functions

I'm day to day user in Mathematica, that's I will be happy to any kind of help in code optimisation. So, I try to plot gradient for beatings between two laser modes and plot intensity, phase and phase ...
FSP's user avatar
  • 11
1 vote
0 answers
108 views

How to plot integral of a gradient function

For $f : \mathbb{R} \longrightarrow \mathbb{R}$ continously differentiable and $\phi \in [0,\pi/2]$ let $$F(x) = \int \frac{f'(x)-\cot \phi}{1+ f'(x) \cot \phi} d x$$ be a clockwise 'rotation' of $f$. ...
JHT's user avatar
  • 1,005
1 vote
0 answers
165 views

How to write a program on gradients and the path for steepest ascent?

I'm given two functions f[x ,y ]=Cos[x]*Cos[y]/(6+x^2+y^2) and df[x ,y ]=Grad[F[x,y],{x,y}] I was given a note that ...
imarben007's user avatar
1 vote
0 answers
89 views

How to reproduce `JacobianMatrix` function

I want to use the JacobianMatrix function in package VectorAnalysis, but I get the following warning message after running the ...
A little mouse on the pampas's user avatar
1 vote
0 answers
61 views

Obtain the vector potential and magnetic vector of infinite wire carrying charge

I'm working on the question above, but I'm really stuck for days. my goal is to implement the following Problem in Mathematica. Any help would be appreciated. I want to evaluate the following ...
Farhad's user avatar
  • 23
1 vote
0 answers
120 views

Error when trying to solve elastic PDEs using FEM: "Compile::argcompten: The comparison, LessEqual, is invalid for tensor arguments."

I'm trying to solve the following linear elastic problem: The pairs of numbers beside each node is the coordinates in meters. The loads are in Newtons. The part of codes that probably have no ...
Yukai Qian's user avatar
1 vote
0 answers
39 views

keep variables in the correct position when TensorExpand

I would like to expand a tensor expression of 3-d vectors. However, the code runs really slow, the problem is asked here: Why is TensorExpand so slow for vector operations? However, I found that by ...
ZHANG Juenjie 's user avatar
1 vote
0 answers
586 views

Integrating over a sphere

We are trying to integrate a vector function over a sphere. To do this we changed it to spherical coordinates and then tried to integrate it. Unfortunately we get the error message shown on the image ...
DidierDrogba's user avatar
1 vote
0 answers
124 views

How does this `Tagset` /: defined function work?

This came up in an assignment problem. I am tasked to use 1) ▽ /: ▽[f_] := {D[f, x], D[f, y], D[f, z]} 2) ...
Physkid's user avatar
  • 670
1 vote
0 answers
189 views

Using NMinimize to solve the Multi Commodity Flow problem

I have the following optimization problem and I was hoping to solve it with NMinimize. Unfortunately, I don't get the desired result. I would like to get an optimal vector for $d_{e}$. This is how ...
Julian's user avatar
  • 75
1 vote
0 answers
247 views

Simple Jacobians, Gradients, etc. with arbitrary length vectors/matrices?

Is there any way (or a package built for it) can do simple operations with vectors and matricies of arbitrary size, but conforming extents? For the simplest example to test, given an arbitrary vector ...
jlperla's user avatar
  • 957
0 votes
0 answers
25 views

Why won't this magnetic field plot?

I have been having some longstanding trouble in getting a 2D vector plot of a magnetic field to show up. For context, I am working with Lienard-Wiechert potentials and as such trying to plot the curl ...
JDRobin's user avatar
  • 13
0 votes
0 answers
132 views

Find Vector Potential from Vector Field with Div = 0?

This works to compute the scalar potential function of a vector field whose curl is 0 (using the DifferentialForms.m package): ...
Jeffrey Rolland's user avatar
0 votes
0 answers
106 views

Implementing the 3D Radon transform

I am wondering how to implement the Radon transform, the 3D Radon transform, that is, given a 'density' function $f: \mathbb{R}^3\to \mathbb{R}$ The Radon transform of $f$ is $$Rf(s,w)= \int_{x\cdot w=...
NotaChoice's user avatar
0 votes
0 answers
58 views

How to express elemental operations in matrix form?

I ran the following code: X = Array[x, {5, 4}]; W = Array[w, {4, 3}]; Y = Array[y, {5, 3}]; D[Norm[X.W-Y, "Frobenius"]^2, {W}]//MatrixForm However, mma ...
ADEric's user avatar
  • 1
0 votes
0 answers
52 views

How to input a specific three-variable function into this definition?

I have the following expression: ...
Dispersion's user avatar
0 votes
0 answers
58 views

Calculation of SolidAngle not recognizing region?

Basically I'm trying to calculate the solid angle of a square seen from the origin. I defined the region (in two different ways) and tried running the function but it does not give any output. Why is ...
Claudio Mora's user avatar
0 votes
0 answers
45 views

Output of expressions unable to have operations be performed on the expression

I am currently trying to use the code linked in the catalog of spacetimes pdf to calculate chirstoffel symbols for a metric which follows as n := 4 ...
aygx's user avatar
  • 119
0 votes
0 answers
61 views

Algorithm: Permutations & Signature

Theoretical side Simple example: If I have two sets $A_1=\{1,3\} ,A_2=\{2,3\}$ and Permutations[{1, 2, 3}]= $\left( \begin{array}{ccc} 1 & 2 & 3 \\ 1 &...
Emad kareem's user avatar
0 votes
0 answers
61 views

Difference in covariant derivative and divergence?

defining polar Minkowski metric (with indecies down in polar coordinates) as gdd = {{-1, 0, 0, 0},{0, 1, 0, 0},{0, 0, r^2, 0},{0, 0, 0, r^2 Sin[\[Theta]]^2}} ...
Nitaa a's user avatar
  • 612
0 votes
0 answers
86 views

How would you write a electric field in cylindrical coordinates?

I am new to Mathematica and I am trying to automate the process of finding electric and magnetic fields for TE and TM modes in a cylindrical superconducting cavity. I could not find documentation ...
Aarav Mande's user avatar
0 votes
0 answers
79 views

Is it possible to generate a random vector space in Mathematica?

The idea is that I’d like to try to use Mathematica to work through proofs. So if a proof says, “Let there be a vector space V…”, I would like to see a concrete representation of that vector space in ...
hmltn's user avatar
  • 101
0 votes
0 answers
57 views

High-dimensional second-order differential matrix equations

I am working on Lagrangian derived high-dimensional motion equations for a robot in matrix form. The structure of such an equation is known: $M(q)\ddot{q}+C(q,\dot{q})\dot{q}+G(q)=0$ where $q=[\dot{\...
dtn's user avatar
  • 2,344
0 votes
0 answers
50 views

Scaling vectors by their norm in VectorPlot3D

I'm trying to generate a 3D vector plot in which the length of the vector is really it's norm. This is my code: ...
NA PV's user avatar
  • 1
0 votes
0 answers
41 views

Picking elements from separate lists and multiplying them

So I'm doing some instruction items about surface integrals. I've written the following code. it calculates curl and partial derivatives of the surface. I now want to create the following function, ...
Abcderia's user avatar
  • 115
0 votes
0 answers
54 views

Eliminate doesn't work

I tried to define r by the polynomials a,b,c only. The result which I want is r=4/3 a. But this eliminate doesn't work! It is continue running without stop and without any output. Eliminate[{a == x[1] ...
Zai's user avatar
  • 1
0 votes
0 answers
94 views

Functions of several variables composition

If we have two functions $G,F:\mathbb R^2\to\mathbb R^2$ then the mechanism $F\circ G(x,y)=F(G(x,y))$ gives us a new map $F\circ G:\mathbb R^2\to\mathbb R^2$ called its composition. In a "...
janmarqz's user avatar
  • 201
0 votes
0 answers
65 views

How do you get a partial derivative of a vector to another vector?

I have a translation function between Cartesian and Polar coordinates: xi[xPrime_] := {xPrime[[1]]*Cos[xPrime[[2]]], xPrime[[1]]*Sin[xPrime[[2]]]} I now want to ...
Quark Soup's user avatar
  • 1,560
0 votes
0 answers
93 views

Vector calculus expression formatting

I have the following example vector calculus code ...
RFS's user avatar
  • 201
0 votes
0 answers
65 views

How do I change the axes?

...
Michael's user avatar
0 votes
0 answers
343 views

Curl in Polar Coordinates

I was trying to figure out Curl in other coordinates. The Curl documentation (https://reference.wolfram.com/language/ref/Curl.html ) didn't really say how Mathematica interpreted the input. Anyway, I ...
ions me's user avatar
  • 751