Computer Programming Instructions – Global Homework Experts

Physics 19 – Winter 2007 Lab 1 Lab 1: Kinematics, Intro to Computer Programming Instructions 1 Kinematics • You will spend the first whour of lab working on a tutorial from the UW “Tutorials in Introductory Physics” workbook called “Representations of Motion”. The goal of this part of the lab is to get more comfortable with the relation between position, velocity, and acceleration. You will make predictions for different types of motion and then test your predictions. Materials and Equipment: motion detector (provided), tutorials workbook (bring it with you to lab), some scratch paper and a pen/pencil. Choose a computer workstation with your group (2-3 students) and work through the tutorial (pages 7-10 in workbook). 2 Introduction to Programming with VPython This exercise is based on the tutorial developed by the Matter and Interactions Group at NCSU. It will guide you through some basics of programming in VPython. VPython is a programming language that allows you to very easily make 3D graphics and animations, so we'll be using it throughout the course to analyze and visualize the behavior of physical systems. For this part of the lab, you can work in the same group with the same computer as in part (1). At the end of the lab period, your TA will show you where to download VPython from the web ( It's relatively easy to install on your own computer. 2.1 Your First Program • Double click on the “IDLE for Python” icon in the “Start” menu. This starts the editing environment (IDLE) for VPython. • Enter the following line of code in the IDLE editor window: from visual import * Every Vpython program begins with this line of code. This line tells the program to use the 3D module called “visual” (which is what the “V” stands for in VPython!) • Save your program: from the “File” menu, select “Save”. Save your file in the “p13.Lab1″ directory including one of your last names in the filename. For example, I would name my file *”. Note: You MUST include the .py extension or VPython will not recognize your program! 2.2 Creating 3D objects • VPython has built-in commands to generate simple 3D objects. On the next line of your program, type: sphere()

order now



Comments are closed.