1 Pages (7 items)
How to solve Colebrook-white equation? - Messages
#1 Posted: 6/25/2012 5:03:07 PM
Hello,
I'd like to solve the equation of Colebrook-White using Smath to find Darcy–Weisbach friction factor (f)
The equation is:

I tried to use solve and roots commands (Smath 0.95.4559), with no sucess.
Is it already possible to find the answer through Smath?
I'd like to solve the equation of Colebrook-White using Smath to find Darcy–Weisbach friction factor (f)
The equation is:

I tried to use solve and roots commands (Smath 0.95.4559), with no sucess.
Is it already possible to find the answer through Smath?
#2 Posted: 6/25/2012 5:47:55 PM
Hi 
try using solve(4) instead of solve(2) or changing the "Roots (range)" value in "from 0 to 1" in "Tools" > "Options" > "Calculation"
in the attachment there is an example
regards,
w3b5urf3r
colebrook_uncommented.sm (13 KiB) downloaded 357 time(s).

try using solve(4) instead of solve(2) or changing the "Roots (range)" value in "from 0 to 1" in "Tools" > "Options" > "Calculation"
in the attachment there is an example
regards,
w3b5urf3r
colebrook_uncommented.sm (13 KiB) downloaded 357 time(s).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 6/25/2012 8:32:22 PM
isn't that an implicit equation ? so numerical iteration may be needed, look at this discussion about several methods to solve the equation of Colebrook-White
http://trickofmind.com/?p=1189
Also this post might be of help
http://en.smath.info/forum/yaf_postsm5611_How-to-write-a-recursive-function.aspx#post5611
http://trickofmind.com/?p=1189
Also this post might be of help
http://en.smath.info/forum/yaf_postsm5611_How-to-write-a-recursive-function.aspx#post5611
#4 Posted: 6/26/2012 4:34:15 AM
Hello,
It should be noted here that the solve() gives you two solutions. Actually, there are no two solution and I do not know why solve() returned these two. On the other hand, we have to take into account that solve() depends on "Tools" > "Options" > "Calculation" >"Decimal places". If you use, for instance, 4 decimal places these are the solutions
[MATH=eng]el(f.Colebrook,1)=0.011542553663605[/MATH]
[MATH=eng]el(f.Colebrook,2)=0.01216608597662[/MATH]
15 decimal places
[MATH=eng]el(f.Colebrook,1)=0.012166073459707[/MATH]
[MATH=eng]el(f.Colebrook,2)=0.012166080958897[/MATH]
Solve() will return only one solution if your left boundary is not zero, but some small number greater than zero. Have in mind that in the equation you have [MATH=eng]1/sqrt(f)[/MATH].
(I changed displayed decimals with context menu for each result regardless of numbers of decimals chosen from the manu option)
On the other hand, roots() will give you a single solution which does not depend on decimal places chosen from the menu
[MATH=eng]roots(1/sqrt(f#)-(-2)*log({ε/D}/3.7+2.51/{Re*sqrt(f#)},10),f#,0.01)=0.012166080958897[/MATH]
But if you are far from the solution with your guess value, roots() will fail as could be expected when nonlinear equations are involved
[MATH=eng]roots(1/sqrt(f#)-(-2)*log({ε/D}/3.7+2.51/{Re*sqrt(f#)},10),f#,0.03)[/MATH]
That is the "beauty" of strugling with nonlinear equations
Representing 15 decimal places for this equation has no to much sence, I just put them here to point out the problematic results from solve().
Regards,
Radovan
WroteHi
try using solve(4) instead of solve(2) or changing the "Roots (range)" value in "from 0 to 1" in "Tools" > "Options" > "Calculation"
in the attachment there is an example
regards,
w3b5urf3r
It should be noted here that the solve() gives you two solutions. Actually, there are no two solution and I do not know why solve() returned these two. On the other hand, we have to take into account that solve() depends on "Tools" > "Options" > "Calculation" >"Decimal places". If you use, for instance, 4 decimal places these are the solutions
[MATH=eng]el(f.Colebrook,1)=0.011542553663605[/MATH]
[MATH=eng]el(f.Colebrook,2)=0.01216608597662[/MATH]
15 decimal places
[MATH=eng]el(f.Colebrook,1)=0.012166073459707[/MATH]
[MATH=eng]el(f.Colebrook,2)=0.012166080958897[/MATH]
Solve() will return only one solution if your left boundary is not zero, but some small number greater than zero. Have in mind that in the equation you have [MATH=eng]1/sqrt(f)[/MATH].
(I changed displayed decimals with context menu for each result regardless of numbers of decimals chosen from the manu option)
On the other hand, roots() will give you a single solution which does not depend on decimal places chosen from the menu
[MATH=eng]roots(1/sqrt(f#)-(-2)*log({ε/D}/3.7+2.51/{Re*sqrt(f#)},10),f#,0.01)=0.012166080958897[/MATH]
But if you are far from the solution with your guess value, roots() will fail as could be expected when nonlinear equations are involved
[MATH=eng]roots(1/sqrt(f#)-(-2)*log({ε/D}/3.7+2.51/{Re*sqrt(f#)},10),f#,0.03)[/MATH]
That is the "beauty" of strugling with nonlinear equations

Representing 15 decimal places for this equation has no to much sence, I just put them here to point out the problematic results from solve().
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 users liked this post
Davide Carpi 6/26/2012 5:11:00 AM
#5 Posted: 6/26/2012 5:08:19 AM
Wrote
Solve() will return only one solution if your left boundary is not zero, but some small number greater than zero. Have in mind that in the equation you have [MATH=eng]1/sqrt(f)[/MATH].
Thank you omorr, I was wondering


file updated with lower bound little but greater than zero (and Moody Diagram)...
regards,
w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Radovan Omorjan 6/28/2012 2:27:00 AM
#6 Posted: 6/26/2012 5:18:22 AM
You are welcome
Regards,
Radovan

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#7 Posted: 6/28/2012 4:14:04 PM
Thank you all, very useful replies

1 Pages (7 items)
-
New Posts
-
No New Posts