Skip to main content
23 votes
Accepted

What is the definition of Curl in Mathematica?

The definition used (motivated by exterior calculus) is as follows: Given a rectangular array $a$ of depth $n$, with dimensions $\{d, ..., d\}$ (so there are $n$ $d$'s) and a list $x = \{x_1, ..., ...
jose's user avatar
  • 6,683
22 votes

How to make Jacobian automatically in Mathematica

Grad[a,b] also produces the Jacobian. a = {x1^3 + 2 x2^2, 3 x1^4 + 7 x2}; b = {x1, x2}; Grad[a, b] // MatrixForm This has the ...
Conor Cosnett's user avatar
12 votes
Accepted

How to calculate the surface integral of a vector field?

You can try using ImplicitRegion and Integrate: ...
Carl Woll's user avatar
  • 132k
12 votes
Accepted

Why $u\cdot \operatorname{grad}(u)$ is not equal to $\operatorname{div}(u u)$?

I've previously found that Mathematica's arrangement of Grad's output doesn't always agree with fluid mechanics conventions: try transposing it. In general for ...
eyorble's user avatar
  • 9,568
11 votes

What is the definition of Curl in Mathematica?

I fail to find a reference for the definition used by Curl, but manage to figure out how the Curl is defined. I'll use Einstein ...
xzczd's user avatar
  • 68.4k
11 votes
Accepted

Einstein summation convention for symbolic vector calculus

First let me remark that you can unprotect symbols by doing Unprotect[symbol], and then you can define whatever you want to it. This is however not always advised. ...
MannyC's user avatar
  • 820
11 votes
Accepted

'gradient' function in MMA

The two options I see are to either build your own gradient function or to use Interpolation. Using a custom function: ...
MassDefect's user avatar
  • 10.2k
10 votes
Accepted

Finding unit tangent, normal, and binormal vectors for interpolated function

First we get you interpolating function: ...
Daniel Huber's user avatar
  • 56.4k
9 votes

Creating random configurations of spherocylinders or cylinders

Any approach to this will depend on efficiently deciding if two capsules overlap. You could do this using the built-in RegionDisjoint ...
Jason B.'s user avatar
  • 70.2k
9 votes

Summation of Kronecker deltas should give the dimension

You could just do: Sum[KroneckerDelta[μ, ν] KroneckerDelta[μ, ν], {ν, d}, {μ, d}, Assumptions->d>1] d Although it might make sense to use symbolic ...
Carl Woll's user avatar
  • 132k
9 votes
Accepted

Where to find order of arguments for default functions

The "Details" section of that page refers to CoordinateChartData. Now this is a bit dense, but it contains everything you need. First of all, you can try to find ...
Sjoerd Smit's user avatar
  • 24.8k
9 votes
Accepted

Solve the vector-matrix equation. Minimize the length of the desired n-dimensional vector

Really this should have a concrete example in Mathematica copy-pastable format. Anyway, I'll show a few ways using a made-up example. We'll eventually get it down to straight linear algebra. To keep ...
Daniel Lichtblau's user avatar
8 votes
Accepted

Get the vector Norm without absolute values?

That expression is the square root of the dot product of the vector by itself: Sqrt[vec.vec] where vec is your vector.
C. E.'s user avatar
  • 71.2k
8 votes

How to calculate the surface integral of a vector field?

With the new-in-13.3 SurfaceIntegrate: ...
xzczd's user avatar
  • 68.4k
8 votes
Accepted

SphericalPlot3D of an OblateSpheroid via coordinate transformation

I'm afraid your approach is flawed. SphericalPlot3D[r,t,p] plots r[t,p], where t and ...
Itai Seggev's user avatar
  • 14.3k
8 votes

Creating random configurations of spherocylinders or cylinders

Disclaimer In the meantime, user929304 found out that my collision test is incorrect. I posted a new answer with a rather new approach. Strategy I use a Bag to ...
Henrik Schumacher's user avatar
8 votes
Accepted

How does one plot a three-dimensional electric field in spherical coordinates?

Generate the TransformedField and then plot it. ...
eyorble's user avatar
  • 9,568
8 votes

Calculating length of curve based on data points?

Use FindShortestTour Or ReconstructionMesh. ...
cvgmt's user avatar
  • 84.1k
7 votes
Accepted

Does Mathematica 11 have spherical coordinate unit vectors?

Mathematica does all its computations in an orthonormal basis. You simply need to specify what coordinate system you're working in. So for your example, you just multiply by ...
Itai Seggev's user avatar
  • 14.3k
7 votes
Accepted

Confused about the solution obtained from vector linearization

As mikado pointed out, this is a bug and the return value is complete nonsense. Don't invest any time in interpreting it. Better use the time and send a bug report to Wolfram Support. This appears to ...
Henrik Schumacher's user avatar
7 votes
Accepted

Reconstructing a function from its gradients

Problems with code often require the code (or "All unhappy codes are unhappy in their own way"), but here's a somewhat complicated example that works: ...
Michael E2's user avatar
  • 245k
7 votes

How is Grad defined for array particularly in non-Cartesian coordinates?

Indeed, Grad does compute the covariant derivative. This can be seen from the following example given in the documentation In a curvilinear coordinate system, a ...
Natas's user avatar
  • 2,330
6 votes
Accepted

How do I verify a vector identity using Mathematica?

You can use FrenetSerretSystem: FrenetSerretSystem[{x[s], y[s], z[s]}, s][[-1, -1]] //TeXForm $\left\{\frac{y'(s) z''(s)-y''...
Carl Woll's user avatar
  • 132k
6 votes
Accepted

Vector calculus integration identity problem

Here's my guess: With[{s = {x, y, z}, A = {A1, A2, A3}}, Integrate[s (s.A), s ∈ Sphere[]] ] (* {(4 A1 π)/3, (4 A2 π)/3, (4 A3 π)/3} *) --- or this: ...
Michael E2's user avatar
  • 245k
6 votes
Accepted

How do I get actual values from a Jacobian matrix?

ClearAll[f] f[x0_, y0_] := D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}] /. {x -> x0, y -> y0} f[0.3, 0.5] // MatrixForm I would caution you against using <...
MarcoB's user avatar
  • 67.7k
6 votes
Accepted

Cannot derive `Norm` or `Normalize` when recreating Frenet Serret equations

Consider: T[t] {1/Sqrt[1 + 0.04 Abs[t]^2 + 0.09 Abs[t]^4], (0.2 t)/Sqrt[ 1 + 0.04 Abs[t]^2 + 0.09 Abs[t]^4], (0.3 t^2)/Sqrt[ 1 + 0.04 Abs[t]^2 + 0.09 Abs[t]^4]} ...
Daniel Huber's user avatar
  • 56.4k
6 votes
Accepted

Parametric Surface Integral Boundary Code?

Use the definition of surface integral. ...
cvgmt's user avatar
  • 84.1k
6 votes

'gradient' function in MMA

If the target is just to calculate numerical gradient of a matrix rather than reproduce exactly the same behavior of gradient of MATLAB, then we can use ...
xzczd's user avatar
  • 68.4k
6 votes

Quadratic form derivative in Mathematica

You can use VectorSymbol and MatrixSymbol, introduced in version 14.1 as part of the Symbolic Vectors, Matrices and Arrays ...
Domen's user avatar
  • 33.4k
6 votes

Calculating length of curve based on data points?

The simplest thing would be to add up the straight lines between points. But that gives a somewhat too short a length because the line is not straight but curved. A better approach seems therefore to ...
Daniel Huber's user avatar
  • 56.4k

Only top scored, non community-wiki answers of a minimum length are eligible