Question: Convert below working matlab code to the python code: clear all clc syms R % write the equation to be solved f = log(R)*2.341077*10^(-4)+ log(R)^3*8.775468*10^(-8)-2.293775*10^(-3);
Convert below working matlab code to the python code:
clear all clc syms R % write the equation to be solved f = log(R)*2.341077*10^(-4)+ log(R)^3*8.775468*10^(-8)-2.293775*10^(-3); % derivative of the function g = diff(f); n = 3; % number of decimal places epsilon = 0.5*10^(2-n); R0 = 15000; % initial guess %% for i=1:100 f0 = vpa(subs(f,R,R0)); %function value at R0 f0_der = vpa(subs(g,R,R0));%function derivative at R0 y = R0 - f0/f0_der; % update the next guess err = abs(y-R0); if err
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
