70 likes | 182 Vues
This document outlines fundamental concepts in vector mathematics and functions relevant to PHY307/PHY607. It covers essential operations, including multiplication, addition, and subtraction of vectors, alongside practical examples demonstrating each operation. The text also introduces the concept of functions, illustrating their capability to perform actions and return values, exemplified through Python code. Additionally, the document briefly discusses the nature of gravity, focusing on its directionality and strength, providing an integrated understanding of these core physics topics.
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