Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: Write a program that moves the object with a constant momentum in the x-direction. Then give Fnet a small force in the y-direction and

Goal: Write a program that moves the object with a constant momentum in the x-direction. Then give Fnet a small force in the y-direction and observe the results.

*I need help writing this program. It's related to physics and it's in VPython. Below is some information that is helpful to what is required from it. Thanks.

image text in transcribed

Another introductory assignment to get you used to using vryther First, I hope you are aware of the help link on the glowscript.org site. This gives access to all sorts of useful tutorials and videos. Be certain to use them. The goal of this assignment is to introduce motion with a force. But critical to keep in mind is that we are applying some very fundamental physics to create a simulation of motion. The idea is that projects build upon one another. In this case you will be creating a sphere. As you did in Computational O, you use the same command. Object1 = sphere(pos=vec(0,0,0), radius = 0.25 color = Color.red) Object1 names the sphere. The other items inside the parenthesis are called attributes. Notice the wonderful use of veg, short for vector. In ves we have the x, y, and z coordinates (or a vector for the origin) describing the center of the sphere. Vectors are really important in everything we do. If we wanted to create a force, we might say something like: Force = veclex, Ex. Ez) where Exeta are the components of the force. If we want to change the position of Object1, we simply enter something like: Object1.pos = verloewx vewy, newz) If we only wanted to change the x components we could enter something like: Object1.pos.x = newx pos is an attribute of Object1. Attributes are a great way to keep track of specific properties of an object. We can create our own attributes. For example we could create a "charge" attribute, a "mass" attribute, and a "momentum" attribute. Object1 = sphere(pos=vec(0,0,0), radius = 0.25 color = calorced, charge = 2e-9, mass = 1, momentum = ves (0.1,0,0)) What we care about for this assignment is the attributes of mass and momentum. We are going to simulate motion. We will start by setting an attribute of momentum in the +x direction of 1 m/s. We will set up to have a netforce, but initially that will be zero. Here is the physics: we will use the momentum principle. dp* = *Fnet ******dt If we wanted an analytical solution, we would then integrate this to find the change in momentum. We are going to allow the computer to do this for us. We define a small time interval: 0.1 seconds will do for now. Then we have to use a loop. I happen to like while loops. The command for a while loop is. while (condition): The condition tells the loop when to keep going (the condition must be true to keep looping). So you could set the condition to be for while t

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

lkkkkkkkkkkkkkkk

Answered: 1 week ago