ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 16 Mar 2015 09:32:08 +0100define new vectorhttps://ask.sagemath.org/question/26198/define-new-vector/ hi i'm new in sage , I have two vectors
v1=vector([8,-10,12]) <br>
v2=vector([9,4,-6])
i want to create a third one which is parallel with v1 and also the scalar product of v2 and v3 is equal to 1440
(x,y,z)=var('x,y,z') <br>
v3=vector([x,y,z])
solve([v1.dot_product(v3)==1440,v2.cross_product(v3)==0],x,y,z)
i want to get something like this: [x= , y= , z= ] <br>
but the result: []
Mon, 16 Mar 2015 03:15:30 +0100https://ask.sagemath.org/question/26198/define-new-vector/Answer by nbruin for <p>hi i'm new in sage , I have two vectors </p>
<p>v1=vector([8,-10,12]) <br/>
v2=vector([9,4,-6])</p>
<p>i want to create a third one which is parallel with v1 and also the scalar product of v2 and v3 is equal to 1440</p>
<p>(x,y,z)=var('x,y,z') <br/>
v3=vector([x,y,z])</p>
<p>solve([v1.dot_product(v3)==1440,v2.cross_product(v3)==0],x,y,z)</p>
<p>i want to get something like this: [x= , y= , z= ] <br/>
but the result: []</p>
https://ask.sagemath.org/question/26198/define-new-vector/?answer=26200#post-id-26200Vectors with symbolic entries are not themselves "symbolic", so you can't put them in places where symbolic equations are expected:
sage: v2.cross_product(v3)==0
False
You can work around that, though:
sage: solve(v2.cross_product(v3).list() + [v1.dot_product(v3)==1440],x,y,z)
[[x == -324, y == -144, z == 216]]
Mon, 16 Mar 2015 09:32:08 +0100https://ask.sagemath.org/question/26198/define-new-vector/?answer=26200#post-id-26200