Let me solve the following problems:
1: The internal section of the measuring cup, such as the attachment (the bottom diameter is 56mm. The angle is 91.5 degrees), helps me calculate the height of the size of 25, 50, 75,100,125,150,175,200,225,250 ml respectively? A total of 10 heights.
2: The volume is 28.34 2*28.34 3*28.34 4*28.34 5*28.34 6*28.34 7*28.34 8*28.38 9*28.34 10*28.34 respectively. A total of 10 heights
A total of 20 heights.
Create a system of binary equations. A cubic equation is generated after the elimination of the element,
Because the angle is very small, if it is about the R equation, the difference between the radius and the bottom radius is very small, resulting in the division of the root of the binary method is not easy to find, and finally select the height as the unknown, solve the problem.
In addition to programming ability, the mathematical ability is very important ~
[Html]
<Html>
<Head>
<Script lanuage = "javascript">
Var R;
Var r = 28
Var res = "";
Function f (v, h)
{
Var R = r + h * Math. tan (1.5/180 * Math. PI );
// Document. getElementById ("hh"). innerText = h;
Document. getElementById ("RR"). innerText = R;
Var tempv = 1/3 * Math. PI * h * (R * R + R * r + r * r)/1000;
Document. getElementById ("vv"). innerText = tempv;
Return v-tempv;
}
Function getR ()
{
Var d = document. getElementById ("dd"). value * 1;
Var a = document. getElementById ("ha"). value * 1;
Var B = document. getElementById ("hb"). value * 1;
Var v = document. getElementById ("vol"). value;
Var m = 0;
Var cnt = 0;
Var res = "";
While (Math. abs (B-a)> d & cnt <100)
{
Cnt ++;
Var fa = f (v, );
Res + = "[" + cnt + "] a =" + a + ", fa =" + fa + ", B =" + B + ", fb = ";
Var fb = f (v, B );
Res + = fb + ", m =" + m + ", fm = ";
M = (a + B)/2;
Var fm = f (v, m );
Res + = fm + "</br> ";
If (fa> 0 & fb> 0 & fm> 0) | (fa <0 & fb <0 & fc <0 ))
{
Document. getElementById ("res"). innerHTML = "Range Error. No solution is available in this range. Please modify the range! ";
Return;
}
If (fm = 0)
{
Break;
}
Else if (fa * fm <0)
{
B = m;
}
Else if (fm * fb <0)
{
A = m;
}
}
Document. getElementById ("hh"). innerText = m;
Document. getElementById ("res"). innerHTML = res;
}
</Script>
</Head>
<Body>
<Form>
Enter the volume size: <input id = "vol" type = "text" size = "10" value = "25"> <br/>
Enter the following precision requirements: <input id = "dd" type = "text" size = "10" value = "0.000001"> <br/>
Enter the height range:
<Input id = "ha" type = "text" size = "5" value = "10">
<Input id = "hb" type = "text" size = "5" value = "150">
<Input type = "button" onclick = "getR ();" value = "computing"> <br/>
RADIUS: <span id = "RR"> </span> <br/>
High: <span id = "hh"> </span> <br/>
Volume: <span id = "vv"> </span> <br/>
Iteration Process: <br/> <span id = "res"> </span>
</Form>
</Body>
</Html>