How do I calculate the triple scalar product in Matlab?

In summary: This is a column vector in MATLAB (the vector is expressed in one column): c = [ 1, 2, 3 ]The function cross(B,C) produces the same type of vector (column vector or row vector) as the inputs. If B and C are column vectors, cross(B,C) will be a 3x1 column vector. If A is also a column vector, then the notation A.'*cross(B,C) does produce the scalar triple product.If A, B, and C are row vectors (1x3), cross(B,C) is 1x3 and A.' is 3x1. Following the rules of matrix multiplication, the product
  • #1
sara_87
763
0

Homework Statement



i have 3 vectors a,b,and c. on matlab, i have to find the triple scalar product:
b.(c x a)

Homework Equations





The Attempt at a Solution



i typed it in the script file as:
b'*cross(c,a)
but i got a 3x3 matrix...shouldn't the answer be one fixed value since when i calculate it myself, i get one number instead of a matrix.
did i type it wrong?
 
Physics news on Phys.org
  • #2
Yes, the answer should be a number. I think your command '* may be incorrect. A quick google search tells me that the scalar triple product [itex]A\cdot (B\times C)[/itex] should be entered like this dot(A,cross(B,C)).
 
  • #3
cristo said:
Yes, the answer should be a number. I think your command '* may be incorrect. A quick google search tells me that the scalar triple product [itex]A\cdot (B\times C)[/itex] should be entered like this dot(A,cross(B,C)).

Matlab will always "do the right thing" with dot(A,cross(B,C)) if A,B,C are three vectors.

The function cross(B,C) produces the same type of vector (column vector or row vector) as the inputs. If B and C are column vectors, cross(B,C) will be a 3x1 column vector. If A is also a column vector, then the notation A.'*cross(B,C) does produce the scalar triple product.

OTOH, if A, B, and C are row vectors (1x3), cross(B,C) is 1x3 and A.' is 3x1. Following the rules of matrix multiplication, the product of a 3x1 matrix with a 1x3 matrix is a 3x3 matrix. If you are using row vectors, the appropriate expression is A*cross(B,C).'

If A, B, C are of mixed row/column type (not a recommended practice), use dot(A,cross(B,C)).
 
  • #4
uuummmm, a=i-2j+0k
b=2i+4j-k
c=3i+0j+2k
so do i use A*cross(B,C)
or dot(A,cross(B,C))
it's the second one right?
;)
 
  • #5
dot(A,cross(B,C)) will always work. To use the matrix multiplication operators you need to ensure you have things dimensioned properly.

Do you know the difference between row vectors and column vectors?

This is a row vector in MATLAB (the vector is expressed in one row): a = [ 1,-2,0 ]
 
  • #6
ah ok
thax v v much
 

1. What is the triple scalar product in matlab?

The triple scalar product in matlab is a mathematical operation that involves three vectors. It calculates the volume of a parallelepiped formed by the three vectors. It is also known as the scalar triple product or mixed triple product.

2. How is the triple scalar product calculated in matlab?

The triple scalar product in matlab is calculated using the dot product and cross product of the three vectors. The formula for the triple scalar product is given by: A ⋅ (B x C), where A, B, and C are vectors. This can be easily implemented in matlab using the dot() and cross() functions.

3. What is the significance of triple scalar product in physics?

The triple scalar product has several applications in physics, particularly in mechanics and electromagnetism. It is used to calculate the work done by a force on an object, the torque produced by a force on a rigid body, and the magnetic moment of a current-carrying loop.

4. Can the triple scalar product be negative?

Yes, the triple scalar product can be negative. This depends on the orientation of the three vectors and the order in which they are arranged in the product. A negative value indicates that the three vectors form a left-handed coordinate system, while a positive value indicates a right-handed coordinate system.

5. How can I plot the triple scalar product in matlab?

In matlab, the triple scalar product can be plotted using the quiver() function. This function plots arrows representing the three vectors, and the magnitude of the triple scalar product is represented by the length of the resulting arrow. The direction of the arrow indicates the orientation of the coordinate system.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
919
  • Precalculus Mathematics Homework Help
Replies
5
Views
536
  • Calculus and Beyond Homework Help
Replies
5
Views
948
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
846
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
978
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top