コード例 #1
0
        /// <summary>
        /// Determines whether the specified <see cref="ParametricExpression"/> is equal to the
        /// current <see cref="ParametricExpression"/>.
        /// </summary>
        /// <param name="other">The <see cref="ParametricExpression"/> to compare with the current
        /// <see cref="ParametricExpression"/>.</param>
        /// <returns>
        /// true if the specified <see cref="ParametricExpression"/> is equal to the current
        /// <see cref="ParametricExpression"/>; otherwise, false.
        /// </returns>
        public bool Equals(ParametricExpression other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;

            return Equals(other.XExpression.OriginalExpression, XExpression.OriginalExpression) &&
                   Equals(other.YExpression.OriginalExpression, YExpression.OriginalExpression);
        }
コード例 #2
0
        public static double CalculateDerivative(Calculator calc, ParametricExpression expr, double t, out PointD result)
        {
            calc.GraphingArgumentValue = t;
            double x1 = calc.Evaluate(expr.XExpression);
            double y1 = calc.Evaluate(expr.YExpression);

            calc.GraphingArgumentValue = t + DeltaX;
            double x2 = calc.Evaluate(expr.XExpression);
            double y2 = calc.Evaluate(expr.YExpression);

            double fPrime1 = (x2 - x1) / DeltaX;
            double fPrime2 = (y2 - y1) / DeltaX;

            result = new PointD(x1, y1);

            return fPrime2 / fPrime1;
        }
コード例 #3
0
ファイル: Graph.cs プロジェクト: mgbowen/graphing-calc-csharp
            public ExpressionInfo(UncompiledExpression expr, CompiledDomain domain = null)
            {
                if (expr is UncompiledStandardExpression)
                {
                    var stdExpr = expr as UncompiledStandardExpression;
                    Expression = new StandardExpression(expr.Slot, expr.Type, stdExpr.Expression, domain);
                }
                else if (expr is UncompiledParametricExpression)
                {
                    var paraExpr = expr as UncompiledParametricExpression;
                    Expression = new ParametricExpression(expr.Slot, paraExpr.XExpression, paraExpr.YExpression, domain);
                }
                else
                {
                    throw new ArgumentException("expr");
                }

                OriginalUncompiled = expr;
                Enabled = true;
            }