70 likes | 178 Views
Science and Sensitivity Science & Computers PHY307/PHY607 Oct. 3, 2002. HWK: Work on your proposal. Vector math. Multiply by a number: (each coordinate gets multiplied.). = 1.5 *. Vector math. Adding vectors: [each coordinate gets added: (1,2,3) + (0,4,-1) = (1,6,2).].
E N D
Science and SensitivityScience & ComputersPHY307/PHY607Oct. 3, 2002 • HWK: Work on your proposal. PHY307, Fall 2002
Vector math • Multiply by a number:(each coordinate gets multiplied.) = 1.5 * PHY307, Fall 2002
Vector math • Adding vectors:[each coordinate gets added: (1,2,3) + (0,4,-1) = (1,6,2).] = + PHY307, Fall 2002
Vector math • Subtracting vectors geometrically:[each coordinate gets added: (1,2,3) - (0,4,-1) = (1,-2,4).] = - PHY307, Fall 2002
Functions • Can: • do things (make a sphere, move a box.) • give a value (a reference to a sphere, the sine of a number.) • How do you get your own function to return a value? • Use the return statement. PHY307, Fall 2002
return example from visual import * def minus(a,b): return a–b numa = 1 numb = 2 print minus(numa,numb) veca = vector(0,1,4) vecb = vector(2,1,1) print minus(veca,vecb) PHY307, Fall 2002
Gravity • Is in what direction? • How strong is it? PHY307, Fall 2002