POLYMATH Report          NLE 
 Nonlinear Equation 2016-May-31 

Calculated values of NLE variables
    Variable Value f(x) Initial Guess Initial f(x)
1 vt 0.015782 1.4E-10 0.02505 4.9E00

    Variable Value Initial Value
1 CD 8.84266 6.11879
2 Dp 0.000208 0.000208
3 g 9.80665 9.80665
4 Re 3.65564 5.80256
5 rho 994.6 994.6
6 rhop 1800 1800
7 vis 0.000893 0.000893

Nonlinear equations
1 f(vt) = vt^2*(3*CD*rho)-4*g*(rhop-rho)*Dp = 0

Explicit equations
1 rho = 994.6
2 g = 9.80665
3 rhop = 1800
4 Dp = 0.208e-3
5 vis = 8.931e-4
6 Re = Dp*vt*rho/vis
7 CD = if (Re<0.1) then (24/Re) else (24*(1+0.14*Re^0.7)/Re)

Problem source text
# S. 17 - Single NLE with 'if' condition
# Terminal Velocity
# Verified Solution: vt = 0.015782
# Ref.: Comput. Appl. Eng. Educ. 6: 174, 1998
f(vt)=vt^2*(3*CD*rho)-4*g*(rhop-rho)*Dp
rho=994.6
g=9.80665
rhop=1800
Dp=0.208e-3
vis=8.931e-4
Re=Dp*vt*rho/vis
CD=if (Re<0.1) then (24/Re) else (24*(1+0.14*Re^0.7)/Re)
vt(min)=0.0001
vt(max)=0.05

Matlab formatted problem
Create m file called PolyNle.m and paste the following text into it.
% S. 17 - Single NLE with 'if' condition
% Terminal Velocity
% Verified Solution: vt = 0.015782
% Ref.: Comput. Appl. Eng. Educ. 6: 174, 1998
function PolyNle
   xguess = 0.02505 ;
   x = fzero(@NLEfun,xguess);
   fprintf('The NLE solution is %g\n', x);
end

function fvt = NLEfun(vt)
   rho = 994.6;
   g = 9.80665;
   rhop = 1800;
   Dp = 0.000208;
   vis = 0.0008931;
   Re = Dp * vt * rho / vis;
   if (Re < 0.1)
       CD = 24 / Re;
   else
       CD = 24 * (1 + 0.14 * Re ^ 0.7) / Re;
   end

   fvt = vt ^ 2 * 3 * CD * rho - (4 * g * (rhop - rho) * Dp);
end

Root function values
  vt f(vt)
1 0.0001 -6.54045
2 0.001118 -6.20682
3 0.002137 -5.85427
4 0.003155 -5.48632
5 0.004173 -5.10473
6 0.005192 -4.71062
7 0.00621 -4.30479
8 0.007229 -3.88785
9 0.008247 -3.46031
10 0.009265 -3.02257
11 0.010284 -2.57499
12 0.011302 -2.11787
13 0.01232 -1.65148
14 0.013339 -1.17605
15 0.014357 -0.691798
16 0.015376 -0.198919
17 0.016394 0.302413
18 0.017412 0.812038
19 0.018431 1.32981
20 0.019449 1.85558
21 0.020467 2.38923
22 0.021486 2.93064
23 0.022504 3.4797
24 0.023522 4.03629
25 0.024541 4.60033
26 0.025559 5.17171
27 0.026578 5.75035
28 0.027596 6.33616
29 0.028614 6.92906
30 0.029633 7.52898
31 0.030651 8.13584
32 0.031669 8.74958
33 0.032688 9.37012
34 0.033706 9.9974
35 0.034724 10.6314
36 0.035743 11.2719
37 0.036761 11.9191
38 0.03778 12.5727
39 0.038798 13.2328
40 0.039816 13.8993
41 0.040835 14.5722
42 0.041853 15.2514
43 0.042871 15.9368
44 0.04389 16.6284
45 0.044908 17.3262
46 0.045927 18.0302
47 0.046945 18.7402
48 0.047963 19.4563
49 0.048982 20.1784
50 0.05 20.9064

General Settings
Total number of equations 8
Number of implicit equations 1
Number of explicit equations 7
Elapsed time 0.04 sec
Reporting digits 8
Solution method safenewt
Max iterations 150
Tolerance F 1E-07
Tolerance X 1E-07
Tolerance min 1E-07