// (lim x->0) 1/sin(x) public void CalculateLimit_AndReturnsCorrectLimit_8() { var numerator = new List <Summand> { new Summand() }; var denominator = new List <Summand> { new Summand { Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.DoesNotExist); }
// (lim x->0) 1/x public void CalculateLimit_AndReturnsCorrectLimit_6() { var numerator = new List <Summand> { new Summand() }; var denominator = new List <Summand> { new Summand { PolynomialDegree = 1 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.DoesNotExist); }
// (lim x->0) 1/-(x^2) public void CalculateLimit_AndReturnsCorrectLimit_7() { var numerator = new List <Summand> { new Summand() }; var denominator = new List <Summand> { new Summand { Coefficient = -1, PolynomialDegree = 2 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.NegativeInfinity); }
// (lim x->1) sin(x - 1) = 0 public void CalculateLimit_MKD_67_4() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1.0, Bparam = -1.0 } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 1); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0.0); }
// (lim x->-infinity) (x^2+x) = +infinity public void CalculatePoviloLimit4() { var numerator = new List <Summand> { new Summand { Coefficient = 1, PolynomialDegree = 2, }, new Summand { Coefficient = 1, PolynomialDegree = 1, } }; var denominator = new List <Summand> { new Summand { Coefficient = 1 } }; var normalizedFunction = new NormalizedFunction { Denominator = denominator, Numerator = numerator, }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 10); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(110.0); }
// (lim x->-Pi) cos(0.5*x) = 0 public void CalculateLimit_MKD_68_25() { var numerator = new List <Summand> { new Summand { Coefficient = 1, Multiplicands = new List <IElementaryFunction> { new Cosine { Aparam = 0.5 } } }, }; var denominator = new List <Summand> { new Summand { Coefficient = 1 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, -Math.PI); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0); }
// (lim x->2) 1 / x = 0.5 public void CalculateLimit_MKD_67_2() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0 } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 1 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 2); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0.5); }
// (lim x->1) (x^4 - x^3 + x^2 - 3x + 3) / (x^3 - x^2 - x + 1) = +INF public void CalculateLimit_MKD_74_2() { var numerator = new List <Summand> { new Summand { PolynomialDegree = 4 }, new Summand { Coefficient = -1, PolynomialDegree = 3 }, new Summand { PolynomialDegree = 2 }, new Summand { Coefficient = -3, PolynomialDegree = 1 }, new Summand { Coefficient = 3, } }; var denominator = new List <Summand> { new Summand { PolynomialDegree = 3 }, new Summand { Coefficient = -1, PolynomialDegree = 2 }, new Summand { Coefficient = -1, PolynomialDegree = 1 }, new Summand { Coefficient = 1 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 1); result.LimitResultType.Should().Be(LimitResultType.PositiveInfinity); }
// (lim x->11) ln(x) - ln(11) / x-11 = 1/11 public void Calculate_Antano_Limit_8_ln() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new LogarithmicFunction { Aparam = 1, Bparam = 0 } } }, new Summand { Coefficient = -1.0, Multiplicands = new List <IElementaryFunction> { new LogarithmicFunction { Aparam = 0, Bparam = 11 } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 1 }, new Summand { Coefficient = -11.0 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 11); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(1.0 / 11.0); }
public void CalculateLimit_MKD_69_30_StringParse() { string numeratorString = "sin(x)"; string denominatorString = "ln(1+2*x)"; var normalizedFunction = new NormalizedFunction { Numerator = StringToSummand.Parse(numeratorString), Denominator = StringToSummand.Parse(denominatorString), }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0.0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0.5); }
// (lim x->0) (ln(3*x + 5) - ln(5) - 3/5/1*x + 9/25/2*(x^2)) / (x^3) = 27/125/3 public void CalculateLimit_AndReturnsCorrectLimit_10() { var numerator = new List <Summand> { new Summand { Multiplicands = new List <IElementaryFunction> { new LogarithmicFunction { Aparam = 3, Bparam = 5 } } }, new Summand { Coefficient = -Math.Log(5) }, new Summand { Coefficient = -3.0 / 5, PolynomialDegree = 1 }, new Summand { Coefficient = 9.0 / 25 / 2, PolynomialDegree = 2 } }; var denominator = new List <Summand> { new Summand { PolynomialDegree = 3 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(27.0 / 125 / 3); }
// (lim x->PI/2) 1-sinx / cosx^2 = 1/2 public void Calculate_Antano_Limit_12_sin() { var numerator = new List <Summand> { new Summand { Coefficient = -1.0, Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1, Bparam = 0 } } }, new Summand { Coefficient = 1.0, } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Cosine { Aparam = 1, Bparam = 0 }, new Cosine { Aparam = 1, Bparam = 0 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, Math.PI / 2); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0.5); }
public void CalculateLimit_AndReturnsCorrectLimit_9_StringParse() { string numeratorString = "x^(1/5)"; string denominatorString = "x^(1/3)"; var normalizedFunction = new NormalizedFunction { Numerator = StringToSummand.Parse(numeratorString), Denominator = StringToSummand.Parse(denominatorString), }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.PositiveInfinity); }
public void CalculateLimit_MKD_67_16_StringParse() { string numeratorString = "1-cos(Pi*x+2)"; string denominatorString = "1"; var normalizedFunction = new NormalizedFunction { Numerator = StringToSummand.Parse(numeratorString), Denominator = StringToSummand.Parse(denominatorString), }; var result = LimitCalculator.CalculateLimit(normalizedFunction, -2 / Math.PI); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0); }
// (lim x->0) (sin(x) - x) / (sin(x) * x) = 0 public void CalculateLimit_AndReturnsCorrectLimit_1() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1, Bparam = 0 } } }, new Summand { Coefficient = -1.0, PolynomialDegree = 1 } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 1, Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1, Bparam = 0 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0.0); }
// (lim x->1) (x^101 - 101*x + 100)/ (x^2 - 2*x + 1) = 5050 public void CalculateLimit_MKD_74_1() { var numerator = new List <Summand> { new Summand { PolynomialDegree = 101 }, new Summand { Coefficient = -101, PolynomialDegree = 1 }, new Summand { Coefficient = 100 } }; var denominator = new List <Summand> { new Summand { PolynomialDegree = 2 }, new Summand { Coefficient = -2, PolynomialDegree = 1 }, new Summand { Coefficient = 1 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 1); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(5050); }
// (lim x->0) (cos(3*x) - cos(7*x)) / x^2 = 20 public void CalculateLimit_MKD_69_27() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Cosine { Aparam = 3 } } }, new Summand { Coefficient = -1.0, Multiplicands = new List <IElementaryFunction> { new Cosine { Aparam = 7 } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 2 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0.0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(20); }
private void CountLimit_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(NuText.Text) || string.IsNullOrWhiteSpace(DeText.Text) || string.IsNullOrWhiteSpace(XgoTo.Text)) { ErrorBox.Text = "Fields can't be empty"; return; } try { var normalizedFunction = new NormalizedFunction { Numerator = Stack_Numerator.ToList(), Denominator = Stack_Denominator.ToList() }; var result = LimitCalculator.CalculateLimit(normalizedFunction, Convert.ToDouble(XgoTo.Text)); if (result.LimitResultType == LimitResultType.RealNumber) { Limit_Answer.Text = Convert.ToString(result.Value); } if (result.LimitResultType == LimitResultType.DoesNotExist) { Limit_Answer.Text = "Not exist"; } if (result.LimitResultType == LimitResultType.PositiveInfinity) { Limit_Answer.Text = "Positive infinity"; } if (result.LimitResultType == LimitResultType.NegativeInfinity) { Limit_Answer.Text = "Negative infinity"; } } catch (LimitDoesNotExistException) { Limit_Answer.Text = "Not exist"; } catch (Exception ex) { ErrorBox.Text = ex.Message; } finally { CountLimit.Enabled = false; } }
public void CalculateLimit_MKD_67_1_StringParse() { string numeratorString = "((5*x^2)-4*x-1)"; string denominatorString = "(x-1)"; // var a = StringToSummand.FindPolynomialDegree("(5*x^2)"); var normalizedFunction = new NormalizedFunction { Numerator = StringToSummand.Parse(numeratorString), Denominator = StringToSummand.Parse(denominatorString) }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 1); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(6.0); }
// (lim x->-2) ((x - 6)^(1/3) + 2) / (x + 2) = 1/12 public void CalculateLimit_MKD_68_8() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1.0, Bparam = -6, PowerNumerator = 1, PowerDenominator = 3 } } }, new Summand { Coefficient = 2.0 } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 1 }, new Summand { Coefficient = 2.0, } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, -2.0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(1.0 / 12.0); }
// (lim x->-1)(x^2+6x+5) / (x^2-1) = -2 public void Calculate_Antano_Limit_3() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 2 }, new Summand { Coefficient = 6.0, PolynomialDegree = 1 }, new Summand { Coefficient = 5.0 } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 2 }, new Summand { Coefficient = -1.0 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, -1.0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(-2.0); }
// (lim x->1) ((x - 1)^(1/2)) / ((x - 1)^(1/3) * (x + 1)^(1/3)) NOT EXISTS public void CalculateLimit_MKD_68_10() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1.0, Bparam = -1.0, PowerNumerator = 1, PowerDenominator = 2 } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1.0, Bparam = -1.0, PowerNumerator = 1, PowerDenominator = 3 }, new PowerFunction { Aparam = 1.0, Bparam = 1.0, PowerNumerator = 1, PowerDenominator = 3 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 1.0); result.LimitResultType.Should().Be(LimitResultType.DoesNotExist); }
// (lim x->1) 5x-x^0.5 = 4 public void CalculatePoviloLimit1() { var numerator = new List <Summand> { new Summand { Coefficient = -1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1, Bparam = 0, PowerNumerator = 1, PowerDenominator = 2 } } }, new Summand { Coefficient = 5.0, PolynomialDegree = 1, } }; var denominator = new List <Summand> { new Summand { Coefficient = 1 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 1); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(4); }
// x->-1 (x^3+1)/sin(x+1) public void Kuznecov_15_3() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 3 }, new Summand { Coefficient = 1.0, }, }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1.0, Bparam = 1.0 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, -1); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(3.0); }
// (lim x->0)(x) / ((4-x)^1/2)-2 = -4 public void Calculate_Antano_Limit_4() { var numerator = new List <Summand> { new Summand { PolynomialDegree = 1, Coefficient = 1.0 } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = -1, Bparam = 4, PowerNumerator = 1, PowerDenominator = 2 } } }, new Summand { Coefficient = -2.0 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(-4.0); }
// (lim x->0) (x^(1/5)) / (x^(1/3)) = +INF public void CalculateLimit_AndReturnsCorrectLimit_9() { var numerator = new List <Summand> { new Summand { Multiplicands = new List <IElementaryFunction> { new PowerFunction() { Aparam = 1, PowerNumerator = 1, PowerDenominator = 5 } } } }; var denominator = new List <Summand> { new Summand { Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1, PowerNumerator = 1, PowerDenominator = 3 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.PositiveInfinity); }
// (lim x->0) sin (x + 3) = sin(3) ~ 0.141120008059867 public void CalculateLimit_AndReturnsCorrectLimit_5() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Sine() { Aparam = 1.0, Bparam = 3 } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0 } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); MathHelper.AreApproximatelyEqual(result.Value, 0.141, 0.005).Should().BeTrue(); }
// (lim x->0) x / 2^x = 0 public void Calculate_Antano_Limit_9_EX() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, PolynomialDegree = 1 } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new ExponentialFunction { Aparam = 2, Bparam = 0 }, } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0); }
// tg(x) replaced with sin(x) / cos(x) // (lim x->0) (cos(x) * (e^(7x) - e^(2x))) / sin(x) = 5 public void CalculateLimit_MKD_69_33() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Cosine { Aparam = 1 } }, SumsRaisedToPower = new List <SumRaisedToPower> { new SumRaisedToPower { Degree = 1, Sum = new List <Summand> { new Summand { Coefficient = 1, Multiplicands = new List <IElementaryFunction> { new ExponentialFunction { Aparam = 7 } } }, new Summand { Coefficient = -1, Multiplicands = new List <IElementaryFunction> { new ExponentialFunction { Aparam = 2 } } } } } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new Sine { Aparam = 1 } } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0.0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(5); }
// (lim x->0) public void CalculateLimit_MKD_68_14() { var numerator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1.0, Bparam = 1.0, PowerNumerator = 1, PowerDenominator = 2 } }, SumsRaisedToPower = new List <SumRaisedToPower> { new SumRaisedToPower { Degree = 1, Sum = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1.0, Bparam = 1.0, PowerNumerator = 1, PowerDenominator = 2 }, } }, new Summand { Coefficient = -1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = -1.0, Bparam = 1.0, PowerNumerator = 1, PowerDenominator = 2 }, } } } } } } }; var denominator = new List <Summand> { new Summand { Coefficient = 1.0, Multiplicands = new List <IElementaryFunction> { new PowerFunction { Aparam = 1.0, Bparam = 0, PowerNumerator = 1, PowerDenominator = 5 }, } } }; var normalizedFunction = new NormalizedFunction { Numerator = numerator, Denominator = denominator }; var result = LimitCalculator.CalculateLimit(normalizedFunction, 0.0); result.LimitResultType.Should().Be(LimitResultType.RealNumber); result.Value.Should().Be(0.0); }