Friday, March 20, 2015

Introduction to Vpython Program

Homework Assignment: 3-D Modeling in Python

Purpose: 
The purpose of this activity is to learn how to use the 3-D modeling program called Vpython by being able to use the sequencing editor to develop spheres and arrows using vector quantities. This program is used as a tutorial to help master the basic functions of sequencing and create a visual model.

Experiment:
In order to start the program, I started off by typing in the code [from visual import *] and saved the initial file, The initial file was named Vectors1.py which modeled three different spheres with arrows pointing in different directions that were identified from the instructional video.

Challenge Task 1: Vectors1.py
The results gave a 3-D projection with three different colored spheres. The arrows were pointed in random positions that were manipulated through the vector quantity in 3 dimensions (x,y,z).




Next I used the option using # adding comments that was seen to not affect the code listed.



Challenge Task 2: Vectors2.py
In the next task, by assigning names to the spheres, it made it easier to develop the arrows used to connect the spheres in a counterclockwise direction.




Then, one of the spheres was moved twice as far from the y-axis and the three arrows remained connected, By changing the y-axis value and labeling the vector positions, the arrows adjusted to the connected positions.


By adding a new line using the print command, the printed value of the vector position was displayed in the python shell screen.  This allows the value of any sphere (variable) to be identified. 




Conclusion:

In this program, I was able to manipulate the tools using the editor, shell, and visual representations available to create the structures dependent on a vector quantity. By using the Vpython program, the 3-D shapes of spheres connected by arrows were displayed which is important in identifying electrical fields and charges. It visualized the simple basic shapes that would be used a lot in electric fields and forces where the motion of the spheres can be animated.

No comments:

Post a Comment