Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this sypder task, you need to complete the two missing lines to solve the problem: finding the corresponding value of x which can lead

In this sypder task, you need to complete the two missing lines to solve the problem: finding the corresponding value of x which can lead to x ** x = 20 import numpy as np import matplotlib.pyplot as plt def func(x): return x**x def solve_bisection(function, lower, upper, value): if function((lower + upper) / 2) < value: # please complete the following line else: # please complete the following line lower, upper, value = 1, 3, 20 boundary_list = [(lower,upper),] while abs(func(sum(boundary_list[-1]) / 2) - value) > 1e-6: boundary_list.append(solve_bisection(func, boundary_list[-1][0], boundary_list[-1][1], value)) res = sum(boundary_list[-1]) / 2 length = len(boundary_list) plt.plot(np.linspace(0.1, 3.5), func(np.linspace(0.1, 3.5)), linewidth = 2) for boundary, i in zip(boundary_list, np.linspace(80, 30, length)): plt.plot(boundary, [i]*2, 'D-', linewidth = 2) plt.axvline(x = res, linestyle = '--', color = 'gray') plt.plot(res, func(res), 'x', markersize = 15, markeredgewidth = 3, color = 'red') plt.xlabel('x') plt.ylabel('y')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

4. Compare and contrast the practices of the two companies.

Answered: 1 week ago

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago