Git Product home page Git Product logo

dsc-lineq-numpy-lab-onl01-dtsc-ft-052620's Introduction

Solving Systems of Linear Equations with NumPy - Lab

Introduction

Now you've gathered all the required skills needed to solve systems of linear equations. You saw why there was a need to calculate inverses of matrices, followed by matrix multiplication to figure out the values of unknown variables.

The exercises in this lab present some problems that can be converted into a system of linear equations.

Objectives

You will be able to:

  • Use matrix algebra and NumPy to solve a system of linear equations given a real-life example
  • Use NumPy's linear algebra solver to solve for systems of linear equations

Exercise 1

A coffee shop is having a sale on coffee and tea.

On day 1, 29 bags of coffee and 41 bags of tea were sold, for a total of 490 dollars.

On day 2, they sold 23 bags of coffee and 41 bags of tea, for which customers paid a total of 448 dollars.

How much does each bag cost?

# Create and solve the relevant system of equations
# Describe your result

Exercise 2

The cost of admission to a popular music concert was 162 dollars for 12 children and 3 adults.

The admission was 122 dollars for 8 children and 3 adults in the same music concert.

How much was the admission for each child and adult?

# Create and solve the relevant system of equations
# Describe your result

Exercise 3

You want to make a soup containing tomatoes, carrots, and onions.

Suppose you don't know the exact mix to put in, but you know there are 7 individual pieces of vegetables, and there are twice as many tomatoes as onions, and that the 7 pieces of vegetables cost 5.25 USD in total. You also know that onions cost 0.5 USD each, tomatoes cost 0.75 USD and carrots cost 1.25 USD each.

Create a system of equations to find out exactly how many of each of the vegetables are in your soup.

# Create and solve the relevant system of equations
# Describe your result

Exercise 4

A landlord owns 3 properties: a 1-bedroom, a 2-bedroom, and a 3-bedroom house.

The total rent he receives is 1240 USD.

He needs to make some repairs, where those repairs cost 10% of the 1-bedroom house’s rent. The 2-bedroom repairs cost 20% of the 2-bedroom rental price and 30% of the 3-bedroom house's rent for its repairs. The total repair bill for all three houses was 276 USD.

The 3-bedroom house's rent is twice the 1-bedroom house’s rent.

How much is the individual rent for three houses?

# Create and solve the relevant system of equations
# Describe your result

Summary

In this lab, you learned how to use NumPy to solve linear equations by taking inverses and matrix multiplication and also using numpy's solve() function. You'll now take these skills forward and see how you can define a simple regression problem using linear algebra and solve it with Numpy.

dsc-lineq-numpy-lab-onl01-dtsc-ft-052620's People

Contributors

shakeelraja avatar loredirick avatar sumedh10 avatar

Watchers

James Cloos avatar Kaitlin Vignali avatar Mohawk Greene avatar Victoria Thevenot avatar Otha avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar  avatar Ben Oren avatar Matt avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Ahmed avatar Nicole Kroese  avatar Dominique De León avatar  avatar Lisa Jiang avatar Vicki Aubin avatar Maxwell Benton avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.