2.3.1 The approximation for Re < 0.5
logre1 = -1.6;
logcd1 = 3.0;
logre2 = 0.5;
logcd2 = 1.0;
Clear[cd, re]
logeqn = cd-logcd1 == (logcd2-logcd1)/(logre2-logre1) *
(Log[10,re] - logre1)
Solving for logy,
newlogeqn = Solve[logeqn, cd]
Now let's clean it up.
logdragcoef = Simplify[ newlogeqn[[1,1,2]] ]
Now let's get rid of the logarithms by taking the exponential of both sides of the equation, base 10.
dragcoef = 10^logdragcoef
Clean this up, too.
dragcoefa = Expand[dragcoef]
dragcoefb = Simplify[%]
Oops! Mathematica didn't have a rule available to simplify this. We will have to simplify it ourselves. We know that Log[re]/Log[10] == Log[10,re], so
29.9358/10^(0.952381 Log[re]/Log[10])
== 29.9358 10^(-0.952381 Log[re]/Log[10])
== 29.9358 (10^Log[10,re])^-0.952381
== 29.9358 re^-0.952381
Therefore,
Clear[cd,re] coefofcd = 29.9358; expofcd = -0.952381; cd[re_] = coefofcd re^expofcd
We can check our approximation with a graph.
Clear[logcd]
linplot = Plot[Log[10,coefofcd] + expofcd logre,
{logre,-2.0,0.5},
PlotStyle -> {{RGBColor[0,0,1],Thickness[0.01]}},
DisplayFunction -> Identity];
Show[logplot,linplot, DisplayFunction -> $DisplayFunction];The approximation looks great!
Exercise 2Up to 2.3 Piecewise linear approximation of the log-log graph