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 6044351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:00:06+00:00 2026-05-23T07:00:06+00:00

How could I alter the following code to get a table of data elements

  • 0

How could I alter the following code to get a table of data elements in a text file to be plotted in excel?

 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 = 1

 #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)]
 #print(timeArray)

 for j in range (1000): #j is the time increment
     for i in range (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-23T07:00:07+00:00Added an answer on May 23, 2026 at 7:00 am

    Probably the best way to save a file for opening in Excel is to use the builtin CSV module. It will allow you to save a file that can be imported in Excel and other spreadsheet apps.

    Create a CSV writer and use the writerows method, passing your positionMatrix list.

    Please take a look at python docs: 13.1. csv — CSV File Reading and Writing

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now, I run the following code in Flash to get the raw binary data
I have the following code: $.ajax({ type: 'GET', url: 'edit_slides.php', data: { user_id: user_id
Could somebody point out the necessary rights to do something like ALTER TABLE myTable
I was using the following code to retrieve HTML snippets from a database table
I have the following code inside <table> tags. item is the result of the
First time poster here :). I'm having the following trouble automating Excel 2010 from
I am using the following code to create a file, but it always failed
I have the following code in a stored procedure. .... select ... into #temp
I've the following code in my app. MyEventHandler handler = null; //Declare the handler
With the following code, my browser is returning 'image not created or saved'. I

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.