2.3 Solving Linear Equations

Linear Equations --- any variables must appear with exponent 1 and cannot be multiplied by any other variable.

Ex:  x+y-2z=4 
Ex: A-2B=3C-4D

Not Ex: 3x-4y = (2/z)
Not Ex : 3A*B = 2C+3
Not Ex: 3X-2(Sqrt[Y]) = 7Z + 1

Equations:  Must include an equal sign!
Fact: If A = B, then A+C = B + C
Fact: If A = B, then A*C = B*C (here we agree that we should not multiply by zero, thus C≠ 0)

Example 2.5

Renting a car: base fees are $38, and then $12 per day

Part 1

We will let R(t) be the cost to rent a car for t days. Then R(t) = 38+12t

Part 2

We will not create a function for this one single calculation. We simply want to solve R(t) = 200, which results in 13.5 days. Since we cannot go over budget, we can rent the vehicle for 13 days.

NSolve[38+12t==200,t]

Example 2.7

Alpha company: monthly fee of $5.00, and $0.99 per download
Beta company: monthly fee or $7.00, and $0.79 per download

Part 1

We will let Ca(d) be the function for company alpha, d is number of downloads, Ca is measured in dollars.

Ca[d_]:=5.00+0.99d

Part 2

We will let Cb(d) be the function for company alpha, d is number of downloads, Cb is measured in dollars.

Cb[d_]:=7.00+0.79d

Part 3

Here, we simply set Ca(d) = Cb(d) and solve.  The calculation is performed below, and 10 downloads is the number of downloads where the two plans cost the same amount.

Solve[Ca[d]==Cb[d],d]

Ca[10]

Cb[10]

Part 4

Plot[{Ca[d],Cb[d]},{d,0,20},AxesLabel->{"downloads", "Price ($)"}, PlotLegends->{"Company α", "Company β"}]

Part 5

We choose which company to use based on how many downloads we think we would make per month.  If we make 10 or less downloads per month, we should pick Company Alpha, if we download 10 more more per month, we pick Company Beta.

Exercise 3

We have a formula for GDP, where GDP = GDP(CX, PI, GI, NE), where the variables are defined as in the problem, all measured in billions of dollars.

Part a.

The formula is simply the sum of all the variables...

GDP[CX_, PI_, GI_, NE_]:=CX+PI+GI+NE

Part b.

Here we want to examine GDP(11930, 2852, 3175, -538).  Since net exports is calculated as exports minus imports, and NE = -538 million dollars, there were more imports than exports.

GDP[11930, 2852,3175,-538]

So the GDP for these values is $17419 billion dollars.

Part c.

Solve[G == GDP[CX, PI, GI, NE],NE]

Rewriting the above as an actual equation gives: N = -C+GDP-I-P or in our variables, NE = -CX+G-GI-PI

Part d.

We simply solve for the variable NE after setting the function to 18184 billion.  So the net exports in this case would be 227 billion dollars, thus exporting more than importing.

Solve[GDP[11930, 2852,3175,NE]==18184,NE]

The net exports is $227 billion dollars, and thus more was exported than imported!

Exercise 11

We have a supply function and a demand function which are related to the price of barley.  Here S and D are measured in billions of bushels, and P is measured in dollars per bushel.
P(S) = 1.9S-0.7
P(D) =2.8-0.6D
Equilibrium prices is the price at which supply equals demand.

Clear[P,S]

Solve the supply and demand functions for S and D, respectively.  Then solve for P when S=D.

Solve[P==1.9*S-0.7,S]

Solve[P==2.8-0.6*Dv,Dv]

Solve[Dv==S/.{%[[1]][[1]],%%[[1]][[1]]},P]

Solve[-0.5263157894736842` (-0.7`-P) == 1.6666666666666667` (2.8` -P),P]

The equilibrium price is $1.96 per bushel of barley.