Need solution for question 5.6 using python? tation to within e, 5.11 Determine
ID: 3599281 • Letter: N
Question
Need solution for question 5.6 using python?
tation to within e, 5.11 Determine the real root of x 80: (a) analytically and (b) with the false-position method to within e, = 2.5%. Use initial guesses of 2.0 and 5.0. Compute the estimated error Ea and the true error after each 1.0% teration 5.2 Determine the real root of (x) 5r - 5x2 + 6r -2 (a) Graphically (b) Using bisection to locate the root. Employ initial guesses of 5.12 Given x0 and and iterate until the estimated error eg falls (x) = _206 _ 1.5x4 + 10x + 2 below a level of ,-10% 5.3 Determine the real root of (x)=-25 + 82x-90x2+ 44x 8r + 0.7x: (a) Graphically (b) Using bisection to determine the root to , 10%. Employ Use bisection to determine the maximum of this function. Emplo initial guesses ofx-0 and x, and perform iterations until the approximate relative error falls below 5%. 5.13 The velocity u of a falling parachutist is given by initial guesses of xi = 0.5 and x" = 1.0 (c) Perform the same computation as in (b) but use the false-1) nm position method and ' = 0.2% 5.4 (a) Determine the roots of f(x) =-12-21x+ 18x2 2.75x graphically. In addition, determine the first root of the function c- 15 kgs, computethe mass m so that the velocity is v 36 m/s with (b) bisection, and (c) false position. For (b) and ( a a 10 s. Use the false-position method to determine m to a level guesses of x1--1 and Xu-0, and a stopping criterion of 1% 5.5 Locate the first nontrivial root of sin x- x where x is in radi ans. Use a graphical technique and bisection with the initial interval an 82-k from 0.5 to 1 . Perform the computation until " is less than ,-2%. where g -9.81 m/s. For a parachutist with a drag coefficient ofe, = 0.1% 5.14 Use bisection to determine the drag coefficient needed so that parachutist has a velocity of 36 m/s after 4 s of free fall Note: The acceleration of gravity is 9.81 m/s2. Start with initial by substituting your final answer into guesses of 3 and x5 and terate until the approximate relative error falls below 2%. Also perform an error check by sub- the original equation 5.6 Determine the positive real root of In () 0.7 (a) graphi- stituting your final answer into the original equation. cally, (b) using three iterations of the bisection method, with initial guesses of x 0.5 andx2, and (c) using three iterations of the discharged from a cylindrical tank through a long pipe can be false-position method, with the same initial guesses as in (b) 5.7 Determine the real root of f(x) (0.8- 0.3x)/x: (a) Analytically (b) Graphically (c) Using three iterations of the false-position method and initial As depicted in Fig. P5.15, the velocity of water, v (m/s), computed as 2L guesses of 1 and 3, Compute the approximate error and the true error , after each iteration. Is there a problem withExplanation / Answer
#include <windows.h> // SetConsoleCursorPosition(HANDLE,COORD)
#include <conio.h> // _getch()
/**
* moves the console cursor to the given x/y coordinate
* @param x
* @param y
*/
void moveCursor(int x, int y)
{
COORD c = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
int main()
{
// player data
int x = 3, y = 4;
char icon = 1;
// game state constants
const int RUNNING = 1, WIN = 2, LOST = 3, USER_QUIT = -1;
// game data
int width = 20, height = 15, input, state = RUNNING;
do
{
// draw the game world
moveCursor(0,0);
for(int row = 0; row < height; row++)
{
for(int col = 0; col < width; col++)
{
cout << '.';
}
cout << ' ';
}
// draw the player
moveCursor(x, y);
cout << icon;
// get input from the user (wait for one key press)
input = _getch();
// process input from the user
switch(input)
{
case 'w': y--; break; // move up
case 'a': x--; break; // move left
case 's': y++; break; // move down
case 'd': x++; break; // move right
case 27: state = USER_QUIT; break; // quit
}
// show the game state message
moveCursor(0, height+1);
switch(state)
{
case WIN: cout << "You WON! Congratulations! "; break;
case LOST: cout << "You lost... "; break;
}
}
while(state == RUNNING);
// user must press ESCAPE before closing the program
cout << "press ESCAPE to quit ";
while(_getch() != 27);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.