using System;
using L=Science.Physics.GeneralPhysics;
namespace Serway.Chapter17
{
///
/// Example05: The Broken Clock Radio
/// Your clock radio awakens you with a steady and
/// irritating sound of frequency 600 Hz. One morning,
/// it malfunctions and cannot be turned off. In frustration,
/// you drop the clock radio out of your fourth-story
/// dorm windows, 15.0 m from the ground. Assume
/// the speed of sound is 343 m/s.
/// (A) As you listen to the falling clock radio, what frequency
/// do you hear just before you hear the radio striking
/// the ground?
/// f' = 571 Hz
/// (B) At what rate does the frequency that you hear change
/// with time just before you hear the radio striking
/// the ground?
/// df'/dt = -15.5 Hz
///
public class Example05
{
public Example05()
{
}
private string result;
public string Result
{
get{return result;}
}
public void Compute()
{
L.Frequency f = new L.Frequency();
f.Hz = 600.0;
double s = 15.0;
double g = L.Constant.AccelerationOfGravity;
L.Speed vs = new L.Speed();
vs.mPERs = -g*Math.Sqrt(2.0*s/g);
L.Frequency fo = new L.Frequency();
fo.VariableQ = true;
L.Speed vo = new L.Speed();
L.Sound sound = new L.Sound();
sound.DopplerEffect(f,vs,fo,vo);
//(A)
result+=Convert.ToString(fo.Hz)+"\r\n";
//(B)
L.Calculus.Function func
= new L.Calculus.Function(vel);
double ans = L.Calculus.Differentiation(func, Math.Sqrt(2.0 * s / g));
result+=ans.ToString();
}
private double vel(double t)
{
return 600.0*(343.0+0.0)/(343.0+9.8*t);
}
}
}
//571.434238648089
//-15.549385195665