Register to reply

Triple scalar product: matlab

by sara_87
Tags: matlab, product, scalar, triple
Share this thread:
sara_87
#1
Nov8-07, 02:17 PM
P: 773
1. The problem statement, all variables and given/known data

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

2. Relevant equations



3. 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???
Phys.Org News Partner Science news on Phys.org
Fungus deadly to AIDS patients found to grow on trees
Canola genome sequence reveals evolutionary 'love triangle'
Scientists uncover clues to role of magnetism in iron-based superconductors
cristo
#2
Nov8-07, 02:40 PM
Mentor
cristo's Avatar
P: 8,316
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)).
D H
#3
Nov8-07, 03:26 PM
Mentor
P: 15,153
Quote Quote by cristo View Post
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)).

sara_87
#4
Nov8-07, 03:47 PM
P: 773
Triple scalar product: matlab

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?
;)
D H
#5
Nov8-07, 04:00 PM
Mentor
P: 15,153
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 ]
sara_87
#6
Nov8-07, 04:56 PM
P: 773
ah ok
thax v v much


Register to reply

Related Discussions
Scalar Product Explanation Introductory Physics Homework 18
Vector Triple Product Calculus & Beyond Homework 3
Triple Scalar Product Calculus & Beyond Homework 4
The scalar product Precalculus Mathematics Homework 1