public void StringParse8() { string numeratorStr = "x^(1/2)"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); //meta exception numerator[0].Coefficient.Should().Be(1); numerator[0].Multiplicands[0].Should().Match <PowerFunction>(x => x.PowerDenominator == 2 && x.PowerNumerator == 1); }
public void StringParse9() //exception { string numeratorStr = "9*x^2 - 1"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); //meta exception numerator[0].Coefficient.Should().Be(9); numerator[0].PolynomialDegree.Should().Be(2); numerator[1].Coefficient.Should().Be(-1); }
public void StringParse6() { string numeratorStr = "sin(x-1)"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); numerator[0].Coefficient.Should().Be(1); numerator[0].Multiplicands.Count.Should().Be(1); numerator[0].Multiplicands[0].Aparam.Should().Be(1); numerator[0].Multiplicands[0].Bparam.Should().Be(-1); }
public void StringParse5() { string numeratorStr = "x^3-1"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); numerator[0].Coefficient.Should().Be(1); numerator[0].PolynomialDegree.Should().Be(3); numerator[1].Coefficient.Should().Be(-1); numerator[1].PolynomialDegree.Should().Be(0); }
public void StringParse10() //exception { string numeratorStr = "(x-6)^(1/3)+2"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); //meta exception numerator[0].Coefficient.Should().Be(1); numerator[0].Multiplicands[0].Should().Match <PowerFunction>(x => x.PowerDenominator == 3 && x.PowerNumerator == 1 && x.Aparam == 1 && x.Bparam == -6); numerator[1].Coefficient.Should().Be(2); numerator[1].PolynomialDegree.Should().Be(0); }
public void StringParse7() { string numeratorStr = "5*x^2-4*x-1"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); //meta exception numerator[0].Coefficient.Should().Be(5); numerator[0].PolynomialDegree.Should().Be(2); numerator[1].Coefficient.Should().Be(-4); numerator[1].PolynomialDegree.Should().Be(1); numerator[2].Coefficient.Should().Be(-1); }
public void StringParse1() { string numeratorStr = "sin(5*x)"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); numerator.Count.Should().Be(1); numerator.ToArray().First().Coefficient.Should().Be(1); numerator.ToArray().First().PolynomialDegree.Should().Be(0); numerator.ToArray().First().Multiplicands.ToArray().Length.Should().Be(1); numerator.ToArray().First().Multiplicands.ToArray().First().Aparam.Should().Be(5); }
public void Parse_4() { string str = "x^2"; var result = StringToSummand.Parse(str); result.Should().HaveCount(1); result[0].PolynomialDegree.Should().Be(2); result[0].Coefficient.Should().Be(1.0); result[0].Multiplicands.Should().HaveCount(0); result[0].SumsRaisedToPower.Should().HaveCount(0); }
public void StringParse3() { string numeratorStr = "x^2+6*x+5"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); numerator.Count.Should().Be(3); numerator[0].Coefficient.Should().Be(1); numerator[0].PolynomialDegree.Should().Be(2); numerator[1].Coefficient.Should().Be(6); //Ant sito failina numerator[1].PolynomialDegree.Should().Be(1); numerator[2].Coefficient.Should().Be(1); numerator[2].PolynomialDegree.Should().Be(0); }
public void StringParse2() { string numeratorStr = "5*x-x^(1/2)"; List <Summand> numerator = StringToSummand.Parse(numeratorStr); numerator.Count.Should().Be(2); numerator[0].Coefficient.Should().Be(5); numerator[0].PolynomialDegree.Should().Be(1); numerator[1].Coefficient.Should().Be(-1); numerator[1].Multiplicands.Count.Should().Be(1); numerator[1].Multiplicands[0].Aparam.Should().Be(1); numerator[1].Multiplicands[0].Bparam.Should().Be(0); numerator[1].Multiplicands[0].Should() .Match <PowerFunction>(x => x.PowerDenominator == 2 && x.PowerNumerator == 1); }
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); }
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); }
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_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); }
public void Parse_1() { string str = "cos(x)*(e^(3+7x)-2e^(2x))"; var result = StringToSummand.Parse(str); result.Should().HaveCount(1); result[0].PolynomialDegree.Should().Be(0); result[0].Coefficient.Should().Be(1.0); result[0].Multiplicands.Should().HaveCount(1); result[0].Multiplicands[0].Should() .Match <Cosine>( x => MathHelper.AreApproximatelyEqual(x.Aparam, 1.0) && MathHelper.AreApproximatelyEqual(x.Bparam, 0.0)); result[0].SumsRaisedToPower.Should().HaveCount(1); result[0].SumsRaisedToPower[0].Degree.Should().Be(1); var sum = result[0].SumsRaisedToPower[0].Sum; sum.Should().HaveCount(2); sum[0].PolynomialDegree.Should().Be(0); sum[0].Coefficient.Should().Be(1.0); sum[0].Multiplicands.Should().HaveCount(1); sum[0].Multiplicands[0].Should() .Match <ExponentialFunction>( x => MathHelper.AreApproximatelyEqual(x.Aparam, 7.0) && MathHelper.AreApproximatelyEqual(x.Bparam, 3.0)); sum[1].PolynomialDegree.Should().Be(0); sum[1].Coefficient.Should().Be(-2); sum[1].Multiplicands.Should().HaveCount(1); sum[1].Multiplicands[0].Should() .Match <ExponentialFunction>( x => MathHelper.AreApproximatelyEqual(x.Aparam, 2.0) && MathHelper.AreApproximatelyEqual(x.Bparam, 0.0)); }
public void Parse_6() { string str = "x^(2/3)"; var a = StringToSummand.FindPolynomialDegree("x^(2/3)"); var result = StringToSummand.Parse(str); result.Should().HaveCount(1); result[0].PolynomialDegree.Should().Be(0); result[0].Coefficient.Should().Be(1.0); result[0].Multiplicands.Should().HaveCount(1); result[0].Multiplicands[0].Should() .Match <PowerFunction>( x => MathHelper.AreApproximatelyEqual(x.Aparam, 1.0) && MathHelper.AreApproximatelyEqual(x.Bparam, 0.0) && x.PowerNumerator == 2 && x.PowerDenominator == 3); result[0].SumsRaisedToPower.Should().HaveCount(0); }