Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6064273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:15:44+00:00 2026-05-23T09:15:44+00:00

This python program is supposed to simulate an object being thrown off a 50

  • 0

This python program is supposed to simulate an object being thrown off a 50 meter building, with some initial velocity and constant gravitational acceleration.
I am using arrays to store the different components, but when it’s time to do my computations, my resulting matrix is not turning out like it should. In fact, the resulting matrix is for the most part still empty. What could be causing this problem?

 x = z = vz = vy = ax = ay = time = 0.0
 y = 50 #Initial Height: 50 meters
 vx = 25 #Initial velocity in the x direction: 25 m/s
 az = -9.8 #Constant acceleration in the z direction: -9.8 m/s^2
 deltaTime = .000001

 #Initializes a matrix with 3 columns and 1000 rows for each column: Will hold the corresponding x,y,z coordinate of the particle at time t
 positionMatrix = [[None]*1000 for x in range(3)] 

 posArray = [x, y, z] 
 velArray = [vx, vy, vz] 
 accArray = [ax, ay, az]
 timeArray = [i*deltaTime for i in range(1000)]

 j = 1 #time increment

 for j in range (1,500): #j is the time increment
     for i in range (1,3): #i is each component (x, y, z)

         #x = x + vx*time + .5*ax*(time*time); #y = y + vy*time + .5*ay*(time*time); #z =    z + vz*time + .5*az*(time*time)
         positionMatrix[i][j] = posArray[i] + velArray[i] * timeArray[j] +  1/2*accArray[i] * timeArray[j] * timeArray[j]
         print(positionMatrix)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:15:45+00:00Added an answer on May 23, 2026 at 9:15 am

    Your ranges are wrong – posArray is indexed from 0 to 2 (so posArray[0] = x, posArray[1] = y, posArray[2] = z). Also, you’re printing out the matrix every time, so you’ll see lots of None there.

    You also put 1000 rows in the array, but then only fill 500 of them in.

    You should replace the last block of code with:

     for j in range (1000):
         for i in range (3):
             positionMatrix[i][j] = posArray[i] + velArray[i] * timeArray[j] +  1/2*accArray[i] * timeArray[j] * timeArray[j]
    
     print(positionMatrix)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable
Consider this python program: import sys lc = 0 for line in open(sys.argv[1]): lc
I have a Python program (with Django - does this matter?) that I want
Writing a python program, and I came up with this error while using the
I wrote a basic Hippity Hop program in C, Python, and OCaml. Granted, this
Recently I was trying some practice programs in python and I came across this
I'm using the Excel.Application COM object from a Python program to open a CSV
How is this implemented at a python level? I've got an object that pretends
This is my first python program - Requirement: Read a file consisting of {adId
I have a program that is run from the command line like this python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.