Question: Sometime later the course, we shall explore a few different ways of finding the roots of nonlinear equations. That's just a fancy way of saying:

Sometime later the course, we shall explore a few different ways of finding the roots of nonlinear equations. That's just a fancy way of saying: how to find the value of something (often just one variable, like temperature) such that everything we know about a system (requirements, constraints, data) falls into place. The "system" is usually represented by a complicated equation in which our key variable appears here and there, often implicitly ("transcendently) - such that the unknown cannot be brought to the LHS leaving all functions of the knowns on the RHS. (The latter operation is the case for linear equations, like the relation between temperatures in Celsius vs Fahrenheit; given a temperature in one unit, one can calculate what it would be in the other, readily.) Science/Engineering problems that call for solving a nonlinear equation in a single variable can be-in the abstract-expressed or rearranged as: Find the value of x that satisfies f(x)=0. Some of the methods require the 1 st and 2 nd derivatives of that f(x) w.r.t. x, denoted as f(x) and f(x) respectively, preferably analytical expressions (as opposed to finite-difference numerical derivatives). The purpose of the present exercise is to set the stage for the aboveoutlined exploration of root-finding methods. The task now is to find expressions (using Matlab Symbolics) for the 1 st and second derivatives of a given (mathematical) function; e.g. sinx, to pick a trivial example. For the purpose at hand, we can't stop after symbolics spits out the expressions for the derivatives. We need to go further and convert these expressions (three in total: the input mathematical function, and the 1t&2nd derivatives generated by Symbolics) into Matlab anonymous functions (i.e. function handles) or, preferably, function files. Write a Matlab code that gets a mathematical function from the user and generates three function handles or function files (funco, func1, and func2, respectively) for enumerating the input function and its first two derivatives. Before you get cracking, you may want to consider the following: (1) How to get the expression for the (mathematical) function interactively from the user (instead of having to edit the code each time to enter a different function each time)? Relevant Matlab utilities to look p in Matlab Documentation: inputdlg, str2sym. (2) How to use Matlab Symbolics to differentiate a function (w.r.t. a specified independent variable)? Look up diff. (3) How to convert a symbolic expression into a Matlab function handle (anonymous function) or a function file? Look up matlabfunction
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
