Simple Iterative expression needed solved

2 views (last 30 days)
James Paltani on 30 Apr 2020
Commented: Walter Roberson on 30 Apr 2020
Assuming w is an integer (w = 1, 2, 3, …), write an iterative calculation to determine the minimum w value that will bring the result of the following expression to greater than 10,000. Display this minimum w value and the corresponding result of the expression.
0 CommentsShowHide -1 older comments

Sign in to comment.

Answers (2)

Walter Roberson on 30 Apr 2020
initialize. while the condition is not met, increment.
4 CommentsShowHide 3 older comments
Walter Roberson on 30 Apr 2020
syms w
e = sqrt((10*w^2)-4*w+2);
w = ceil(max(double(solve(e==10000))));
But this does not use a loop like you are required to do. You should not be using symbolic toolbox for this problem.
You should be initializing w to the lowest value of the range. Then you calculate e based on that w. Test whether it has reached the necessary value yet. If it has not, increment w and recalculate e and loop back.

Sign in to comment.

Mrutyunjaya Hiremath on 30 Apr 2020
w = 1; y = 0;
while(y < 10000)
% your equation
y = sqrt(10*w*w - 4*w + 2);
w = w + 1;
end
disp(w)
disp(y)
1 CommentShowHide None
Walter Roberson on 30 Apr 2020
We recommend against providing complete solutions to homework assignments.

Sign in to comment.

Categories

Find more on Numbers and Precision in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!