clc%clears screen
clear all%clears history
close all%closes all open files
format long
fplot(@(x) exp(sqrt(x)),[0 6],'b');
hold on;
fplot(@(x) 3.8*log(1+x),[0 6],'r');
legend('exp(sqrt(x))','3.8*log(1+x)');
f=@(x) exp(sqrt(x))-3.8*log(1+x);
e=1e-6;
a=[1 2];
b=[2 3];
for i=1:2
iter(i) = 0;
if f(a(i))*f(b(i))>=0
disp('No Root')
else
prev = (a(i)+b(i))/2;
p=a(i);
while (abs(f(p))>e)
prev=p;
iter =iter+ 1;
p = (a(i)+b(i))/2;
if f(p) == 0
break;
end
if f(a(i))*f(p)<0
b(i) = p;
else
a(i) = p;
end
end
end
fprintf('Number of Iteration %d, root= %.6f and
value of function at root= %.10f\n',iter(i),p,f(p));
end
PROOF:
question 3 please The first 5 questions refer to finding solutions to the equation exp(w) =...
1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1 mark) (b) Apply two iterations of the bisection method to f(x) 0 to find the positive root. (3 marks) (c) Apply two iterations of the Newton-Raphson method to find the positive root. Choose (3 marks) (d) Use the Newton-Raphson method and Matlab to find the positive root to 15 significant (3 marks) (a) Use Matlab to obtain a graph of the function that shows...
i need the answer to be on a MatLab window 1. Consider the following equation, which represents the concentration (c, in mg/ml) of a drug in the bloodstream over time (t, in seconds). Assume we are interested in a concentration of c2 mg/ml C3te-0.4t A. Estimate the times at which the concentration is 2 mg/ml using a graphical method Be sure to show your plot(s). Hint: There are 2 real solutions B. Use MATLAB to apply the secant method (e.g....
Not in C++, only C code please In class, we have studied the bisection method for finding a root of an equation. Another method for finding a root, Newton's method, usually converges to a solution even faster than the bisection method, if it converges at all. Newton's method starts with an initial guess for a root, xo, and then generates successive approximate roots X1, X2, .... Xj, Xj+1, .... using the iterative formula: f(x;) X;+1 = x; - f'(x;) Where...
DQuestion 19 28 pts Problem 2. Quadratic Equations A quadratic equation has the form: a bc0 The two solutions are given by the formula: 2a Write a program with a loop that a) solves quadratic equations with coefficients read from the terminal, b) visualizes the corresponding quadratic function az2 brc0using the matplotlib module. Instructions Write all code for this problem in a file p2.py 1. The program consists of a main whtle loop (an infinite loop) in which the user...
Code in R Part 1. a) Run the following lines: n<-30 x<-matrix(rnorm(n * 1000), 1000,n) xL,1:3]<-xl,1:3]*10 y<-1+matrix(rnorm (n * 1000), 1000, n) Note: the samples in "x" are contaminated. b) Conduct 1000 two-sample two-sided t-tests for the associated rows of "xand "". (e.g., for the first test, the two samples are "x[1," and "y[1,]", for the second test, the two samples are "x[2," and "y[2,1",etc.). Calculate the total number of rejections of the 1000 tests. (Use significant level a =...
Please, I need help answering questions 10, 11, 12, 13, 14, and 15. Use the other pages as information to solve the questions. Use the questions below to keep track of key concepts from this lesson's study activity. YOUR ASSIGNMENT: Splatapults Away! The engineering club has built a catapult and wants to test it out. The local supermarket has donated some overripe fruits and vegetables, and now the club is holding a Splatapult challenge to see who can hit the...