If someone could please help my solve this problem/program for my hw assignment
ID: 3856097 • Letter: I
Question
If someone could please help my solve this problem/program for my hw assignment that would be great!
Write a Python 3 function cbrt(x) that computes an approximation of y=x3y=x3 using the following formula to compute the next guess:
yk+1= 2y3k+x / 3y2k
This is based off of a Newton-Raphson method for approximating y=x
This is a beginner course, so the code can be kept fairly simple. The main topics of our lectures/chapter this week were Indefinite (while) loops, File loops, Nested loops, Boolean logic, Nesting if statements and loops.
Explanation / Answer
vIn Matlab, the basic objects are matrices, i.e. arrays of numbers. Vectors can be thought of as special matrices. A row vector is recorded as a 1 × n matrix and a column vector is recorded as a m × 1 matrix. To enter a row vector in Matlab, type the following in the command window: v = [0 1 2 3] and press enter. Matlab will print out the row vector. To enter a column vector type u = [9; 10; 11; 12; 13] You can access an entry in a vector with u (2) and change the value of that entry with u (2)=47 You can extract a slice out of a vector with u (2:4) You can change a row vector into a column vector, and vice versa easily in Matlab using w = v ’ (This is called transposing the vector and we call ’ the transpose operator.)
x = -1:.1:1 y = linspace (0 ,1 ,11) Basic Formatting To make Matlab put fewer blank lines in its output, enter format compact To make Matlab display more digits, enter format long Note that this does not change the number of digits Matlab is using in its calculations; it only changes what is diplayed. Plotting Data Consider the data in Table 1.1.1 We can enter this data into Matlab with the following commands entered T (C ) 5 20 30 50 55 µ 0.08 0.015 0.009 0.006 0.0055 Table 1.1: Viscosity of a liquid as a function of temperature. v
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.