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's user avatar
  • 7,349
22 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,133
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
  • 130k
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,343
11 votes
Accepted

Plotting a parametrically defined vector field

You can plot the surface and the vector fields separately and then combine them together. Here is an example. Consider the spherical radius r can be written as function $r(\theta,\phi)$: ...
xslittlegrass's user avatar
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
  • 63.5k
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
  • 810
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.1k
9 votes
Accepted

How to expand dot product by applying properties

Some time ago I developed a function for these sort of symbolic vector computations, called dotExand. For example, it will expand ...
Fred Simons's user avatar
  • 10.1k
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
  • 67.3k
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
  • 130k
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
  • 21.9k
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
9 votes
Accepted

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

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

How to find the limit of a function of two variables

As already mentioned in a comment this limit does not exist without saying more about the way you'd like to approach the point {0,0}. First of all, I shall take the y^2 in the numerator seriously and ...
Dr. Wolfgang Hintze'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
  • 70k
8 votes

How to calculate the surface integral of a vector field?

With the new-in-13.3 SurfaceIntegrate: ...
xzczd's user avatar
  • 63.5k
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
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,343
8 votes

Calculating length of curve based on data points?

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

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

Being an anti-obfuscatorian by nature, I recommend f[x_, y_] = Grad[Function[{x, y}, x + y^2][x, y], {x, y}]; or ...
m_goldberg's user avatar
  • 107k
7 votes

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

How about this?: Evaluate@Grad[#1 + #2^2, {#1, #2}] & (* {1, 2 #2} & *) Or for pure obfuscatory fun: I'd like to reinstate to my first answer (see ...
Michael E2's user avatar
  • 233k
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
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
  • 233k
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,290
6 votes
Accepted

Finding scalar potential function

The typical approach is ...
bbgodfrey's user avatar
  • 60.7k
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
  • 130k
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
  • 233k

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