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 ...


23

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

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

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 ...


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_] := ...


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

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 ...


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

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). ...


8

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 + ...


7

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 ...


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, ...


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

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 + ...


4

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 = ...


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

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 ...


4

Something related from a Christmas notebook I wrote last year: Candle[color_, Pos_] := {color, Cylinder[{Pos, Pos + {0, 0, 0.1}}, 0.013], Black, Thick, Line[{Pos + {0, 0, 0.1}, Pos + {0, 0, 0.12}}], Yellow, EdgeForm[None], Sphere[Pos + {0, 0, 0.12}, 0.013], Cone[{Pos + {0, 0, 0.121}, Pos + {0, 0, 0.16}}, 0.0127]} Graphics3D@Candle[Red, {0, 0, 0}] ...


4

You could specify seed-points for streamlines directly using StreamPoints: only those stremlines will be plotted which pass through these points. Here I set up two point sets: one at $y = 1$ and another at $y = -1$. These share identical $x$ coordinates so they meet at the discontinuity at $y = 0$. One can control the streamline lenghts by the third argument ...


4

Based on the assumption that those F functions produce scalar results… If you just want to manipulate the vectors as entities without considering their components, then you can enter the function for F2s f2s[q_, k1_] := (5/ 14) + (3 (Norm[k1])^2)/(28 (Norm[q])^2) + (3 Norm[ k1]^2)/(28 (Norm[q - k1])^2) - (5)/(28 (Norm[q])^2 (Norm[ q - k1])^(-2)) - ...


4

@Szabolcs is right, use Symbolic Tensors. But in that link it may be a bit confusing to find what you want. There are good examples on 3D vector operations. Read: Vectors TensorExpand Derive and Verify Vector Identities For example, proving an identity: a\[Cross](b\[Cross](c\[Cross]d)) == b a.(c\[Cross]d) - (a.b) c\[Cross]d // TensorExpand True ...


4

Mathematica 10 provides new functionality dealing with curves, (see e.g. the Vector Analysis tutorial) like ArcLength, ArcCurvature and especially FrenetSerretSystem: FrenetSerretSystem[{ x1, ..., xn}, t] gives the generalized curvatures and Frenet-Serret basis for the parametric curve x[t] i.e. it returns {{ k1, ..., k(n-1)}, { e1, ..., en}}, where ki ...


4

The problem is that Norm involves the Abs function whose derivative can't be symbolically simplified: D[Abs[x], x] (* ==> Derivative[1][Abs][x] *) This leads to an indeterminate result that can't be plotted. So you should define the norm more explicitly, for example like this: norm = Sqrt[#1.#1] &; Then replace Norm by norm everywhere. This ...


4

Look at this: VectorPlot[{ x Cos[Sqrt[x^2 + y^2]]/Sqrt[x^2 + y^2], y Cos[Sqrt[x^2 + y^2]]/Sqrt[x^2 + y^2] }, {x, -3, 3}, {y, -3, 3}] Functions start with capital letters, so for example Sin instead of sin. In Mathematica parenthesis aren't used to encapsulate arguments; square brackets are. Write Cos[x] instead of Cos(x).



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