Tag Info

Hot answers tagged

32

Mathematica wouldn't be much helpful if one applied only formulae calculated by hand. Here we demonstrate how to calculate the desired geometric objects with the system having a definition of the curve r[t] : r[t_] := {t, t^2, t^3} now we call uT the unit tangent vector to r[t]. Since we'd like it only for real parameters we add an assumption to Simplify ...


26

The easiest way to get the Jacobian is D[a,{b}] To get the format of a matrix, you would do MatrixForm[D[f, {x}], or D[f, {x}]//MatrixForm, as the comment by azdahak says. There is no special matrix type in MMA - it's internally always stored as a list of lists. Edit Since this question is partly about the format of the matrix and its elements, I ...


15

Here is the Mathematica proof. I'll leave out the prefactor $\hbar/i$ for simplicity. Also, in case this is a homework problem, I decided not to add too many comments to the code. Instead I'll let you figure it out. The basic idea is to do cross products and gradients in spherical coordinates. The calculation shown here actually gives you a way to calculate ...


15

The easiest thing to do is differentiate the field and use VectorPlot3D and ContourPlot3D to show orthogonality of these. This is from Documentation Center. I will change this a bit from original to polish graphics for your lecture. These are not unit vectors though - do u really need unit ones? It can be done too if you need. Use a contour plot to ...


13

Assuming that we have three-dimensional real vectors : $Assumptions = (u | v | w) ∈ Vectors[3, Reals]; we can use e.g. various tensor functions (new in ver. 9) e.g. TensorReduce to reduce (simplify) a tensor expression, e.g. TensorReduce[ v.v + w.w - (v + w).(v + w) ] TensorReduce[u \[Cross] (v \[Cross] w) ] -2 v.w -w u.v + v u.w We can perform ...


10

Enjoy it! Graphics3D[{ {Lighter[Brown], Cone[{{0, 0, 0}, {0, 0, -1}}, .25]}, {Yellow, Sphere[{0, 0, .1}, .25]}, {Pink, Sphere[{.15, 0, .2}, .26]}, {Orange, Sphere[{-.1, 0, .25}, .25]} }, Boxed -> False]


10

Let's start with a parametrized surface. Any one will do, but I guess being orientable helps in this case. Then calculate the unit normal, and then create a Manipulate object that lets you see how the normal behaves: σ[u_, v_] := {(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]} n[u_, v_] := Evaluate[Normalize[ Cross[D[σ[u, v], u], D[σ[u, v], v]] ]] ...


10

Why don't you pick a random vector on the sphere to be your first vector, instead of $\mathbf{n}$, and then pick a random uniform number between $0$ and $2 \pi$ to orient the second vector aronud the first? Something like this, assuming you have your function randomVectorOnUnitSphere[] already (haven't tested it) generateRandomPositioning[v1_, v2_] := ...


9

You can make use of option VectorScale - see the "More Information" section, and some singular examples at the end. Setting None will cause all the vectors to have the same length. Or you can improvise with a custom function to make the best view of the arrows (#5 the fifth argument is vector's norm): VectorPlot[{-(x/(x^2 + y^2)^(3/2)), -(y/(x^2 + ...


9

Observe that even when the tangent vector $r'(t)$ is not normalized, it is still a linear combination of $T(t)$ and $N(t)$. Thus--operating under the usual assumptions that $r'$ and $r''$ exist and are linearly independent--all we have to do is make an orthonormal frame out of $r'(t)$ and $r''(t)$ (which is very much in the spirit of the entire proceeding). ...


9

Thank you for your interest. I would strongly recommend against trying to modify SymbolicTensors`CoordinateChartDataDump`mappingInfo. It is a very low level function and any changes you make are unlikely to work. There are two sets of operations commonly needed with alternate coordinate systems. One is calculus in the coordinate system - Grad, Div, Curl ...


9

The main issue is simply that your constraint should not be imposed after the integration of the field lines, but beforehand. This means that we should choose the starting points from which the differential equations of the field lines are integrated to lie on the desired cylinder right from the beginning. Then, all you have to do is to impose the ...


8

Let us first define the vector field A = {10 x, 20 y^3, 30 z}; and load the vector analysis package: << VectorAnalysis` SetCoordinates[Cartesian[x, y, z]]; Now let's define $A\cdot \nabla A$ field = (A.Grad[#]) & /@ A (* ==> {100 x, 1200 y^5, 900 z} *) and plot both fields: pl1 = VectorPlot3D[A, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, ...


8

See: Jacobian matrix The Jacobian matrix and determinant can be computed using the Mathematica commands: JacobianMatrix[f_List?VectorQ, x_List] := Outer[D, f, x] /; Equal@@(Dimensions/@{f,x}) JacobianDeterminant[f_List?VectorQ, x_List] := Det[JacobianMatrix[f, x]] /; Equal @@ (Dimensions /@ {f, x}) Some additional info. a = {x1^3 + ...


7

It isn't too hard to roll your own routine, of course: UnitNormalVector[f_, {u_, u0_}, {v_, v0_}] := Block[{f0, g0}, f0 = f /. {u -> u0, v -> v0}; g0 = Transpose[D[f, {{u, v}}] /. {u -> u0, v -> v0}]; Arrow[{f0, f0 + Normalize[Cross @@ g0]}]] (* Möbius strip *) mobius[u_, v_] := {(3 + ...


7

The answer depends a lot on what you mean by "doing" vector calculus. You want results to be displayed without using component notation, and that's in general a difficult thing to achieve. A prerequisite about doing completely symbolic vector calculus is to define the simplification rules. But even in "non-vector" algebra it's often hard to get Simplify to ...


7

There are different ways to do this. The easiest, I think, is to use DerivativeFilter: data = Table[Sin[x]*Cos[y], {x, 0, 2 Pi, 0.2}, {y, 0, 2 Pi, 0.2}]; gradFilter[data_] := Module[{n = ArrayDepth[data]}, MapThread[List, Table[DerivativeFilter[data, UnitVector[n, i]], {i, n}], n]] ListVectorPlot[gradFilter[data]] I made this independent of ...


6

This is mainly an answer to your last question, but I think it will help with your other ones. I assume you know that the $T$ function is vector valued, and that is what you want. To substitute in a specific value of $t$, you probably want replacement rules, specifically the ReplaceAll (/.) construct. For example, if you had defined your expression $T(t)$ ...


6

Well, I had worked out an answer to the question of how to tell if the six points were coplanar: MatrixRank[ Simplify[# - points[[1]] & /@ points, a > 0 && b > 0 && c > 0 && n > 0], ZeroTest -> (Expand@PowerExpand@# == 0 &)] (* 2 *) So they are coplanar. But now the question has changed somewhat, ...


6

It could be that you just neglected to define the function f as a three-component vector, but even if you did, you would have gotten no result. The documentation for Curl in Mathematica version 8 doesn't tell you how to specify the coordinates, and the documentation for version 10 is not applicable in version 8. You can find the correct usage of Curl in ...


5

You have some extra brackets { } that are causing your answer to have the wrong dimensions. f = {x3, x4, -(2 m2 x2 x3 x4 + g Cos[x1] (m2 x2 + m1 r))/(m2 x2^2 + m1 r^2 + J1 + J2), x2 x3^2 - g Sin[x1]} x = {x1, x2, x3, x4} jf = D[f, {x}] jf // MatrixForm Then you get a matrix jf that's 4 by 4


5

Any time you try to execute a command of the form a*b=c, you'll generate this error: Of course, that's exactly what you've done in your last line: ρ Dt[v, t] = -Gradient[p] + μ Laplacian[v] + f We can see the issue more clearly if we examine the left side of the equation in FullForm FullForm[a*b] (* Out: Times[a,b] *) Furthermore, Times is ...


5

There are many ways to de-noise data. A simple one is to use one of the built-in filters. For example here I've applied the MeanFilter separately to the x and y dimensions of the data points that make up the arrows (i.e., your noisydata). This is sensible because your points lie on a regular grid. args = noisydata[[All, 1]]; datVals1 = ...


5

If all that was really wanted was to randomly orient a plane spanned by two vectors while preserving the angle between them, then the simplest way is to generate a Haar-distributed pseudorandom orthogonal matrix, and use that to perform the random orientation. The code for generating a $3\times 3$ random orthogonal matrix is surprisingly simple: ranOrt := ...


5

Update I got a MatrixRank of 4 with the original approximate data, but with the updated exact data, the rank is 3. The basic idea is that Orthogonalize will return an orthonormal basis for the subspace spanned by the vectors, along with some zero vectors interspersed. (Orthonormal means unit length vectors that are pairwise perpendicular.) Deleting the ...


5

T[t_] := {(-Sin[t])/(Sqrt[1 + Cos[t/2]^2]), (Cos[t])/(Sqrt[1 + Cos[t/2]^2]), (Cos[t/2])/(Sqrt[1 + Cos[t/2]^2])} B[t_] := Rationalize@{(-0.5 Cos[t] Sin[t/2] + Cos[t/2] Sin[t]) Sqrt[1.625 + 0.375 Cos[t]], (-Cos[t/2] Cos[t] - 0.5 Sin[t/2] Sin[t])/Sqrt[1.625 + 0.375 Cos[t]], 1/Sqrt[1.625 + ...


5

Let's try to simplify your question. I don't have the definitions for c1, j and v, so I'll just use: K2[s_] := s^3 and h[s_] := D[D[K2[s], s], s] (you could also write D[k2[s], {s, 2}], to get the second derivative, but that's probably a matter of taste.) Now if you evaluate: h[2.] you get the strange result: D[D[8., 2.], 2.] and the error ...


5

another test: f = x^3 + x*z^2 - 3*x^2 + y^2 + 2*z^2; cpts = Solve[Grad[f, {x, y, z}] == 0, {x, y, z}, Reals] {{x -> 0, y -> 0, z -> 0}, {x -> 2, y -> 0, z -> 0}} hesse = D[f, {{x, y, z}, 2}] /. cpts {{{-6, 0, 0}, {0, 2, 0}, {0, 0, 4}}, {{6, 0, 0}, {0, 2, 0}, {0, 0, 8}}} {ev1[l1,l2,l3], ev2[l1,l2,l3]} = Eigenvalues /@ hesse {{-6, 4, ...


4

Your question is not very clearly formulated, but if I understand it correctly: you have the value of a function in a set of points on the plane the points do not form a rectangular lattice you need to estimate the gradient of the function You can do this by interpolating linearly, then taking the gradient of the interpolated function. Example: Let's ...


4

Exclusions is not an option of VectorPlot. As an alternative, you could use Boole to exclude part of the plot: VectorPlot[ Boole[x^2 + y^2 > 0.08] {-(x/(x^2 + y^2)^(3/2)), -(y/(x^2 + y^2)^(3/2))}, {x, -1, 1}, {y, -1, 1} ] Combining this with the potential: Show[ DensityPlot[1/Sqrt[x^2 + y^2], {x, -1, 1}, {y, -1, 1}, ColorFunction -> ...



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