• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Expressions.Variable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中xFunc.Maths.Expressions.Variable的典型用法代码示例。如果您正苦于以下问题:C# Variable类的具体用法?C# Variable怎么用?C# Variable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Variable类属于xFunc.Maths.Expressions命名空间,在下文中一共展示了Variable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DerivativeTest3

        public void DerivativeTest3()
        {
            // x ^ 3
            Variable x = new Variable("x");
            Number num1 = new Number(3);

            IExpression exp = new Pow(x, num1);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("1 * (3 * (x ^ (3 - 1)))", deriv.ToString());

            num1.Value = 4;
            Assert.AreEqual("x ^ 4", exp.ToString());
            Assert.AreEqual("1 * (3 * (x ^ (3 - 1)))", deriv.ToString());

            // 2 ^ (3x)
            Number num2 = new Number(2);
            num1 = new Number(3);
            Mul mul = new Mul(num1, x.Clone());

            exp = new Pow(num2, mul);
            deriv = exp.Differentiate();

            Assert.AreEqual("(ln(2) * (2 ^ (3 * x))) * (3 * 1)", deriv.ToString());

            num1.Value = 4;
            Assert.AreEqual("2 ^ (4 * x)", exp.ToString());
            Assert.AreEqual("(ln(2) * (2 ^ (3 * x))) * (3 * 1)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:29,代码来源:ExponentiationTest.cs


示例2: AddDiffNum_VarSubNum_

        public void AddDiffNum_VarSubNum_()
        {
            // 2 + (x - 2)
            var add = new Add(new Number(2), new Sub(new Variable("x"), new Number(2)));
            var expected = new Variable("x");

            SimpleTest(add, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:8,代码来源:SimplifierTest.cs


示例3: DefiniteIntegral

        public DefiniteIntegral(
			IExpression expression, 
			Variable variable, 
			IExpression left, 
			IExpression right)
            : base(new[] { expression, variable, left, right }, 4)
        {
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:8,代码来源:DefiniteIntegral.cs


示例4: AbsDerivativeTest2

        public void AbsDerivativeTest2()
        {
            var num = new Number(2);
            var x = new Variable("x");
            var mul = new Mul(num, x);

            var exp = new Abs(mul);
            var deriv = Differentiate(exp);

            Assert.Equal("2 * 1 * ((2 * x) / abs(2 * x))", deriv.ToString());

            num.Value = 3;
            Assert.Equal("abs(3 * x)", exp.ToString());
            Assert.Equal("2 * 1 * ((2 * x) / abs(2 * x))", deriv.ToString());
        }
开发者ID:sys27,项目名称:xFunc,代码行数:15,代码来源:DifferentiatorTest.cs


示例5: DerivativeTest2

        public void DerivativeTest2()
        {
            // log(x, 2)
            Number num = new Number(2);
            Variable x = new Variable("x");

            IExpression exp = new Log(x, num);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("1 / (x * ln(2))", deriv.ToString());

            num.Value = 4;
            Assert.AreEqual("log(4, x)", exp.ToString());
            Assert.AreEqual("1 / (x * ln(2))", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:15,代码来源:LogTest.cs


示例6: AbsDerivativeTest2

        public void AbsDerivativeTest2()
        {
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Abs(mul);
            IExpression deriv = Differentiate(exp);

            Assert.AreEqual("(2 * 1) * ((2 * x) / abs(2 * x))", deriv.ToString());

            num.Value = 3;
            Assert.AreEqual("abs(3 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) * ((2 * x) / abs(2 * x))", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:15,代码来源:DifferentiatorTest.cs


示例7: DerivativeTest3

        public void DerivativeTest3()
        {
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Tan(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString());

            num.Value = 5;
            Assert.AreEqual("tan(5 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) / (cos(2 * x) ^ 2)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:15,代码来源:TangentTest.cs


示例8: DerivativeTest2

        public void DerivativeTest2()
        {
            // lg(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Lg(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) / ((2 * x) * ln(10))", deriv.ToString());

            num.Value = 3;
            Assert.AreEqual("lg(3 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) / ((2 * x) * ln(10))", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:LgTest.cs


示例9: DerivativeTest3

        public void DerivativeTest3()
        {
            // cot(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Cot(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString());

            num.Value = 3;
            Assert.AreEqual("cot(3 * x)", exp.ToString());
            Assert.AreEqual("-((2 * 1) / (sin(2 * x) ^ 2))", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:CotangentTest.cs


示例10: DerivativeTest2

        public void DerivativeTest2()
        {
            // arcsec(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Arcsec(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) / (abs(2 * x) * sqrt(((2 * x) ^ 2) - 1))", deriv.ToString());

            num.Value = 4;
            Assert.AreEqual("arcsec(4 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) / (abs(2 * x) * sqrt(((2 * x) ^ 2) - 1))", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:ArcsecTest.cs


示例11: DerivativeTest3

        public void DerivativeTest3()
        {
            // exp(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Exp(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) * exp(2 * x)", deriv.ToString());

            num.Value = 6;
            Assert.AreEqual("exp(6 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) * exp(2 * x)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:ExponentialTest.cs


示例12: DerivativeTest3

        public void DerivativeTest3()
        {
            // arccos(2x)
            Number num = new Number(2);
            Variable x = new Variable("x");
            Mul mul = new Mul(num, x);

            IExpression exp = new Arccos(mul);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("-((2 * 1) / sqrt(1 - ((2 * x) ^ 2)))", deriv.ToString());

            num.Value = 6;
            Assert.AreEqual("arccos(6 * x)", exp.ToString());
            Assert.AreEqual("-((2 * 1) / sqrt(1 - ((2 * x) ^ 2)))", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:ArccosTest.cs


示例13: DerivativeTest2

        public void DerivativeTest2()
        {
            Number num1 = new Number(2);
            Variable x = new Variable("x");
            Mul mul1 = new Mul(num1, x);

            Number num2 = new Number(3);
            Mul mul2 = new Mul(num2, x.Clone());

            IExpression exp = new Sub(mul1, mul2);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(2 * 1) - (3 * 1)", deriv.ToString());

            num1.Value = 5;
            num2.Value = 4;
            Assert.AreEqual("(5 * x) - (4 * x)", exp.ToString());
            Assert.AreEqual("(2 * 1) - (3 * 1)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:19,代码来源:SubtractionTest.cs


示例14: DerivativeTest3

        public void DerivativeTest3()
        {
            // (2x) / (3x)
            Number num1 = new Number(2);
            Variable x = new Variable("x");
            Mul mul1 = new Mul(num1, x);

            Number num2 = new Number(3);
            Mul mul2 = new Mul(num2, x.Clone());

            IExpression exp = new Div(mul1, mul2);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("(((2 * 1) * (3 * x)) - ((2 * x) * (3 * 1))) / ((3 * x) ^ 2)", deriv.ToString());

            num1.Value = 4;
            num2.Value = 5;
            Assert.AreEqual("(4 * x) / (5 * x)", exp.ToString());
            Assert.AreEqual("(((2 * 1) * (3 * x)) - ((2 * x) * (3 * 1))) / ((3 * x) ^ 2)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:20,代码来源:DivisionTest.cs


示例15: MulSecondOne

        public void MulSecondOne()
        {
            var mul = new Mul(new Variable("x"), new Number(1));
            var expected = new Variable("x");

            SimpleTest(mul, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:7,代码来源:SimplifierTest.cs


示例16: PowerOne

        public void PowerOne()
        {
            var pow = new Pow(new Variable("x"), new Number(1));
            var expected = new Variable("x");

            SimpleTest(pow, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:7,代码来源:SimplifierTest.cs


示例17: MulSameVar8

        public void MulSameVar8()
        {
            // 2x * 3x
            var var = new Variable("x");
            var mul = new Mul(new Mul(new Number(2), var), new Mul(new Number(3), var));
            var expected = new Mul(new Number(6), new Pow(var, new Number(2)));

            SimpleTest(mul, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:9,代码来源:SimplifierTest.cs


示例18: MulSameVar9

        public void MulSameVar9()
        {
            // (x * 2) * (x * 3)
            var var = new Variable("x");
            var mul = new Mul(new Mul(var, new Number(2)), new Mul(var, new Number(3)));
            var expected = new Mul(new Number(6), new Pow(var, new Number(2)));

            SimpleTest(mul, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:9,代码来源:SimplifierTest.cs


示例19: RootOne

        public void RootOne()
        {
            var root = new Root(new Variable("x"), new Number(1));
            var expected = new Variable("x");

            SimpleTest(root, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:7,代码来源:SimplifierTest.cs


示例20: MulSameVar11

        public void MulSameVar11()
        {
            // 2x * -3x
            var var = new Variable("x");
            var mul = new Mul(new Mul(new Number(2), var), new Mul(new Number(-0.5), var));
            var expected = new UnaryMinus(new Pow(var, new Number(2)));

            SimpleTest(mul, expected);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:9,代码来源:SimplifierTest.cs



注:本文中的xFunc.Maths.Expressions.Variable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# mame.UIntSubArray类代码示例发布时间:2022-05-26
下一篇:
C# Expressions.Mul类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap