Magnitude of cross product
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to find the magnitude of the cross product C. I tried using norm but that didn't give me the write answer. Also, how would you simplify the k component, with trig dentities?
syms theta phi
r = [2.*sin(phi).*cos(theta) 2.*sin(phi).*sin(theta) 2.*cos(phi)]
P=diff(r,theta)
R=diff(r,phi)
C = cross(R,P)
0 comentarios
Respuestas (1)
John D'Errico
el 19 de Nov. de 2022
Editada: John D'Errico
el 19 de Nov. de 2022
syms theta phi
r = [2.*sin(phi).*cos(theta) 2.*sin(phi).*sin(theta) 2.*cos(phi)];
P=diff(r,theta);
R=diff(r,phi);
C = cross(R,P)
Why not try simplify? It might work.
C = simplify(C)
So a simplify helped. Never assume that ALL computations end with a simplfy.
Norm can introduce some problems, because norm feels the need to introduce an absolute value in there.
norm(C)
But what is the 2-norm of a vector, but a sum of squares of elements, and then a sqrt?
normsquared = simplify(sum(C.^2))
And that is getting pretty close.
sqrt(normsquared)
And there is still a minor problem here, probably because MATLAB is not certain that sin(phi)^2 is a positive number. We can tell it that, by telling MATLAB that phi is itself real valued.
assume(phi,'real')
simplify(sqrt(normsquared))
That seems reasonable now. Symbolic tools just need a little gentle persuasion at times.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!