/// <summary> /// This is an attempt to have a way to calculate the federal poverty level over a range of years. /// The returned equation is solved-for-Y by number of members in the household. /// https://aspe.hhs.gov/poverty-guidelines /// </summary> /// <param name="atDate"></param> /// <returns></returns> public static IEquation GetFederalPovertyLevel(DateTime?atDate) { var dt = atDate.GetValueOrDefault(DateTime.Today); var estSlope = new SecondDegreePolynomial(0.9229, -3610.7, 3532449.338).SolveForY(dt.ToDouble()); return(new LinearEquation(7880, estSlope)); }
/// <summary> /// Based on averages from four different states (viz. FL, NY, WA, KS) /// http://www.kscourts.org/Rules-procedures-forms/Child-support-guidelines/2012_new/CSG%20AO%20261%20Clean%20Version%20032612.pdf /// https://www.flsenate.gov/Laws/Statutes/2013/61.30 /// https://www.courts.wa.gov/forms/documents/WSCSS_Schedule2015.pdf /// https://www.childsupport.ny.gov/dcse/pdfs/CSSA.pdf /// </summary> /// <param name="numberOfChildren"></param> /// <returns> /// Returns the equation to solve for monthly child support payments using monthly income. /// </returns> /// <remarks> /// Dollar amounts are ~2015 dollars. /// </remarks> /// <example> /// <![CDATA[ /// var yearlyIncome = 65000D; /// var numberOfChildren = 2; /// var rslt = AmericanEquations.GetChildSupportMonthlyCostEquation(numberOfChildren).SolveForY(yearlyIncome/12) /// ]]> /// </example> public static IEquation GetChildSupportMonthlyCostEquation(int numberOfChildren) { switch (numberOfChildren) { case 1: Func <double, double> v1 = (x) => { var parabolic = new SecondDegreePolynomial(-0.0000036, 0.1804442, 49.7609758); var linear = new LinearEquation(0.090222203778836843, 49.7609758); //once the parabolic's derivative slope goes to 0, switch over to a linear equation return(x >= 25061.68 ? linear.SolveForY(x) : parabolic.SolveForY(x)); }; return(new CustomEquation(v1)); case 2: Func <double, double> v2 = (x) => { var parabolic = new SecondDegreePolynomial(-0.0000051, 0.2193660, 30.5587561); var linear = new LinearEquation(0.10968300301723154, 30.5587561); //once the parabolic's derivative slope goes to 0, switch over to a linear equation return(x >= 21506.47 ? linear.SolveForY(x) : parabolic.SolveForY(x)); }; return(new CustomEquation(v2)); case 3: Func <double, double> v3 = (x) => { var para = new SecondDegreePolynomial(-0.0000063, 0.2483648, 14.8337182); var linear = new LinearEquation(0.12418241298856655, 14.8337182); //once the parabolic's derivative slope goes to 0, switch over to a linear equation return(x >= 19711.49 ? linear.SolveForY(x) : para.SolveForY(x)); }; return(new CustomEquation(v3)); case 4: Func <double, double> v4 = (x) => { var para = new SecondDegreePolynomial(-0.0000069, 0.2637436, 1.7419081); var linear = new LinearEquation(0.13187176611276977, 1.7419081); //once the parabolic's derivative slope goes to 0, switch over to a linear equation return(x >= 19111.86 ? linear.SolveForY(x) : para.SolveForY(x)); }; return(new CustomEquation(v4)); default: Func <double, double> v5 = (x) => { var para = new SecondDegreePolynomial(-0.0000077, 0.2848716, -13.7394084); var linear = new LinearEquation(0.14243576811963998, -13.7394084); //once the parabolic's derivative slope goes to 0, switch over to a linear equation return(x >= 18498.16 ? linear.SolveForY(x) : para.SolveForY(x)); }; return(new CustomEquation(v5)); } }