Physics Project

--Originally published at Hackerman's house

Hey guys, I wanted to sshare a really interesting project that I did for the Physics class with the teacher Juan Quezada. The project was to create a program that could add vectors, not an arranged amount of vectors but the amount the user wanted to.

To do this I had to use the for loop, which would get the data of each vector, the loop would repeat as many times as the user wanted to. The data of the vectors was then added to a list, the list contain the data deppending on the type of data that was obtained trough the procedure.

Here is the code.

vectores

Here is how it works.

vectores-2

Thank you for your attention.


Physics homework

--Originally published at Hackerman's house

For this project I worked with Jona Cabrera who is also in my physics class. The teacher’s assignment was to create a programm that could solve a vectors addition.

The specific problem included three vectors, and the program should be able to add it and obtain the magnitude of the final vector, as well as the components in x and y, finally the program had to obtain the angle of the final vector in reference of the x-axis.

quezada

To create this program we had to import the math library. This allowed us to work with angles, use Pi and also use square root. The program is really simple, is basically ask the user for the data that will be replaced in formulas that we already know.  The only tricky part was the angles, due python works with radians and we use degrees, but this was solved transforming the input data to radians and transforming the result given by the computer to degrees.

This is how it works.

quezada-result

Check out the blog of my partner Jona Cabrera. http://turtlingturtlousturtle.tumblr.com/

giphy-6


Sum of vectors program

--Originally published at Hector Martinez Alcantara

Today I finished a program that can tell you the sum of three, or as many vectors as you want and the vector that balance the system.

There is a menu that shows two options.

In the case A you type 3 forces with their angles, and then the program shows the sum of components in X, components in Y, the resulting vector with its angle, and the vector with the angle that balances the system.

In the case B you type how many forces you want, then you type the forces with their angles, and then the program shows the sum of components in X, components in Y, the resulting vector with its angle, and the vector with the angle that balances the system.

import math
#------------------SHOWS THE VECTOR AND IT'S COMPONENTS-----------------
def Vector(compx,compy):
 magnr=math.hypot(float(compx), float(compy))
 print("\nSumatoria de componentes en X " + str(compx))
 print("Sumatoria de componentes en Y " + str(compy))
 print("\nVector Resultante:")
 if compx<0.0 and compy>0.0:
 print("Segundo sector")
 angr=math.degrees(math.atan(compy/compx)) + 180.0
 elif compx<0.0 and compy<0.0:
 print("Tercer sector")
 angr=math.degrees(math.atan(compy/compx))+ 180.0
 elif compx>0.0 and compy<0.0:
 print("Cuarto sector")
 angr=360+math.degrees(math.atan(compy/compx))
 else:
 print("Primer sector")
 angr=math.degrees(math.atan(compy/compx))
 print("La magnitud del vector resultante es "+ str(magnr) +"N")
 print("El angulo del vector resultante es "+ str(angr) +"° del eje +x")
 print("\nVector Complementario:")
 if compx<0.0 and compy>0.0:
 print("Cuarto sector")
 angr= angr + 180.0
 elif compx<0.0 and compy<0.0:
 print("Primer sector")
 angr= angr - 180
 elif compx>0.0 and compy<0.0:
 print("Segundo sector")
 angr= angr - 180.0
 else:
 print("Tercer sector")
 angr= angr + 180.0
 print("La magnitud del vector complementario es "+ str(magnr) +"N")
 print("El angulo del vector complementario es "+ str(angr) +"° del eje +x")
#--------------MAIN PROGRAM--------------------------------
y=0
while y!=1:
 print("\nCasos:")
 print("A) Tres fuerzas, encontrar la fuerza 
Continue reading "Sum of vectors program"