Question: Object - Oriented Programming In this lab, we will learn to: Overload operators Create a representation of the mathematical concept of a vector Perform operations

Object-Oriented Programming
In this lab, we will learn to:
Overload operators
Create a representation of the mathematical concept of a vector
Perform operations on vectors.
In mathematics, a vector is a quantity with both direction and magnitude. In an Euclidean plane (xy-plane) a vector can be represented as the amount of movement in the x direction plus the amount in the y direction. Some examples of vectors are
v1=3x+2y,
v2=-2x+6y, and
v3=4x(which is the same as v3=4x+0y).
In this lab we are going to write a Vector class.
A generic vector is of the form v=ax+by where a and b are constants.
You must implement the instance variables and methods described below.
You may implement any others to make the class work more effectively.
Create the Vector class in a file named
VectorClass.py
\table[[Vector],[],[init__],[magnitude],[_],[],[str_],[]]
Download the
VectorTester.py from D2L.
In the
VectorTester.py file, you'll need to implement the three vectors defined above (v1,v2,v3).
Once each test passes, upload your
VectorClass.py file to D2L.Object-Oriented Programming
In this lab, we will learn to:
Overload operators
Create a representation of the mathematical concept of a vector
In mathematics, a vector is a quantity with both direction and magnitude. In an Euclidean plane (xy-plane) a vector can be represented as the amount of movement in the x direction plus the amount in the y direction. Some examples of vectors are
v1=3x+2y,
v2=-2x+6y, and
v3=4x(which is the same as v3=4x+0y).
In this lab we are going to write a Vector class.
A generic vector is of the form v=ax+by where a and b are constants.
You must implement the instance variables and methods described below.
You may implement any others to make the class work more effectively.
Create the Vector class in a file named
VectorClass.py
\table[[Vector],[],[init__],[magnitude],[_],[],[str_],[]]
Download the
VectorTester.py from D2L.
In the
VectorTester.py file, you'll need to implement the three vectors defined above (v1,v2,v3).
Once each test passes, upload your
VectorClass.py file to D2L.
A 1-D, Two-phase flow simulation is used to demonstrate the IMPES method
1.12710-3deldelx[KAKrooBodelPodelx]+qo**=OA5.615Bo[delSodelt+So(Co+Cr)delPodelt](oil balance)
1.12710-3deldelx[KAKrwwBwdelPwdelx]+qw**=OA5.615Bw[delSwdelt+Sw(Cw+Cr)delPwdelt](water balance)
First, the 'pressure equation' will be obtained by (BdBw) oil balance + water balance. If we neglect the capillary pressure and assume that Bo=Bw=1, the obtained pressure equation is:
deldelx[5.6151.12710-3KAKroodelPdelx]+5.615qo**+deldelx[5.6151.12710-3KAKrwwdelPdelx]+5.615qw**=
OACtdelPdelt
Then discrete the pressure equation using implicit scheme )=(5.6151.12710-3 :
1xi[(KAKroodelPdelx)xi+0.5-(KAKroodelPdelx)xi-0.5]+1xi[(KAKrwwdelPdelx)xi+0.5-(KAKrwwdelPdelx)xi-0.5]
+5.615q=OAiCtPin+1-Pint
Transmissibility, To=KAKroox,Tw=KAKrwwx,T=To+Tw, then the above equation can be written as:
[Ti+0.5o(Pi+1n+1-Pin+1)-Ti-0.0o(Pin+1-Pi-1n+1)]+[Ti+0.5w(Pi+1n+1-Pin+1)-Ti-0.5w(Pin+1-Pi-1n+1)]+5.615Q
,=OViCtPin+1-Pint
,-Ti-0.5Pi-1n+1+(Ti-0.5+Ti+0.5)Pin+1-Ti+0.5Pi+1n+1+ViCttPin+1=ViCttPin+5.615Qi
If i=1 :
-T0.5P0n+1+(T0.5+T1.5)P1n+1-T1.5P2n+1+V1CttP1n+1=OV1CttP1n+5.615Q1
If i=2N-1
Object - Oriented Programming In this lab, we

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!