I apologise in advance for such a silly question. Normally, I start to write to the list and work the answer out before sending the mail. Not this time.<div>I&#39;m trying to work out which triangles contain the cartesian origin (0, 0) and have the following: </div>
<div><br></div><div><div>t = [-340, 495, -153, -910, 835, -947]</div><div>print  (0 - t[0])*(t[3] - t[1]) - (0 - t[1])*(t[2] - t[0])</div><div>print  (0 - t[4])*(t[3] - t[5]) - (0 - t[5])*(t[2] - t[4])</div><div>print  (0 - t[4])*(t[1] - t[5]) - (0 - t[5])*(t[0] - t[4])</div>
</div><div><br></div><div>where t is coordinates of triangle a,b,c and the maths is cross-product of vectors - if all are negative then it contains the origin. Unfortunately, when I run the programme, I get:</div><div><br>
</div><div><div>colin@colin-laptop:~/lib/python/euler$ python p102origin.py</div><div>-385135</div><div>904741</div><div>-91345</div></div><div><br></div><div>The second number should be negative ( I WANT it to be negative). For example:</div>
<div><br></div><div>print  (0 - t[4])*(t[3] - t[5]) , (0 - t[5])*(t[2] - t[4])   gives : </div><div><br></div><div>-30895 -935636</div><div><br></div><div>And in the python shell: </div><div><br></div><div><div>&gt;&gt;&gt; -30895 -935636</div>
<div>-966531</div></div><div><br></div><div>But:</div><div><br></div><div>print  (0 - t[4])*(t[3] - t[5]) &lt;  (0 - t[5])*(t[2] - t[4])  gives :</div><div><br></div><div>False</div><div><br></div><div><br></div><div><br>
</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>&gt;&gt;&gt; a = &quot;No Error Message&quot;</div><div>&gt;&gt;&gt; b = &quot;Correct Answer&quot;</div><div>&gt;&gt;&gt; a == b</div>
<div>False</div></div><div><br></div><div><br></div><div>Please forgive an old man a stupid question</div>