y 2exp3x4 write a program to slove for fisr positive root de

y= -2exp(3-x)+4, write a program to slove for fisr positive root, descibe the error
y= -2exp(3-x)+4, write a program to slove for fisr positive root, descibe the error

Solution

syntax error                                                                                                                                                      

                                                                                                                                                                    

>>>     y1 =  -2exp(3-x)+4; -- there is no * between 2 and exp.

code :

function root = search(x)
y1 = -2*exp(3-x)+4;
precision = 1;
m = x + precision;
y2 = -2*exp(3-m)+4;

while(y1*y2 > 0)
y1 = -2*exp(3-m)+4;
m = m + precision;
y2 = -2*exp(3-m)+4;
end
root = y2;
end

disp(search(0));

Output: 2

The first positive root is 2 for the above equation. Just looping the roots till it gets a positive value.

y= -2exp(3-x)+4, write a program to slove for fisr positive root, descibe the error y= -2exp(3-x)+4, write a program to slove for fisr positive root, descibe th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site