Coder Social home page Coder Social logo

hw_nonlineareqs's Introduction

hw_nonlineareqs

Nonlinear equations, Garcia Section 4.3

Problem 1 (in-class)

In nonlinearpractice.m, find the three roots of this single-variable nonlinear equation.

  • Prompt the user for an initial guess.
  • Choose a stopping condition (number of iterations, dx smaller than some value)

Can you find all 3 roots?

Problem 2 (in-class)

In nonlinearpractice.m, find the steady-state solutions to the Lorenz atmospheric model.

  • Define the Jacobian matrix
  • Set the program to run for 10 iterations.
  • Use the following initial guesses: (50,50,50), (2,2,2), (5,5,5), (4,4,15)
  • Can you make a 4-subplot figure with the output from each initial guess? (running multiple times with hold on)

Problem 3 (homework)

A spring with constant k = 500 N/m is attached at the origin and supports a mass m = 5 kg as shown in the image below. The spring has a natural (unstretched) length of L,sub>0 = 1.00 m. The mass experiences three forces:

  • Spring force: FS = k(L-L0). The direction of the spring force is nonlinear with respect to the mass position [x y].
  • Gravitational force: Wy = mg.
  • Horizontal drag force: Dx = 7.5y2, where Dx is in Newtons and y is in meters.

Complete the nlonespring.m program to solve for the equilibrium position of the 5-kg mass. Use the Newton-Raphson method with the following requirements.

  • Prompt the user for the initial guess for the equilibrium position [x y] of the mass.
  • Update the solution for the equilibrium position using a Newton-Raphson iteration with a while loop.
  • End the loop when the update in position is less than 10-6 meters OR after the 10th iteration, whichever comes first.
  • Display the equilibrium position and norm(dx) each iteration.
  • Demonstrate that the program works, for an initial guess of [x y] = [0.1 -1.1].

Problem 4 (homework)

Two springs support a mass m = 5 kg as shown in the image below.

  • Spring 1 is attached at coordinate (-1,0) and has a spring constant of k1 = 100 N/m.
  • Spring 2 is attached at coordinate (1,0) and has a spring constant of k2 = 150 N/m. All coordinate positions are in meters. Both of the springs have a natural (unstretched) length of 1.0 meter.

Complete the nltwospring.m and fspring.m programs to solve for the equilibrium position of the 5-kg mass. Use the Newton-Raphson method with the following requirements:

  • Prompt the user for the initial guess for the equilibrium position [x y] of the mass.
  • Update the solution for the equilibrium position using a Newton Raphson iteration with a while loop. If preferred, you may find and use the partial derivatives for the forces to create the Jacobian matrix, rather than using numerical derivatives.
  • End the loop when the update in position is less than 10-6 meters OR after the 10th iteration, whichever comes first.
  • Display the equilibrium position and norm(dx) each iteration.
  • Demonstrate that the program works, for an initial guess of [x y] = [1 -1].

hw_nonlineareqs's People

Contributors

jmhogan avatar

Watchers

James Cloos 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.