/// <summary> /// 分割数を指定して初期化。 /// </summary> /// <param name="variable">変数</param> /// <param name="min">最小値</param> /// <param name="max">最大値</param> /// <param name="n">分割数</param> public Range(Variable variable, ValueType min, ValueType max, int n) { this.variable = variable; this.min = min; this.max = max; this.step = (max - min) / (ValueType)n; }
/// <summary> /// 最大値、最小値と、刻み幅を指定して初期化。 /// </summary> /// <param name="variable">変数</param> /// <param name="min">最小値</param> /// <param name="max">最大値</param> /// <param name="step">刻み幅</param> public Range(Variable variable, ValueType min, ValueType max, ValueType step) { this.variable = variable; this.min = min; this.max = max; this.step = step; }
public override Function Differentiate(Variable x) { return (Constant)0; }
public override Function Differentiate(Variable x) { if(this.Equals(x)) { return (Constant)1; } return (Constant)0; }
public override Function Differentiate(Variable x) { Function innerDeriv = this.inner.Differentiate(x); Function deriv = this.Differentiate(); return innerDeriv * deriv; }
public override Function Differentiate(Variable x) { Function num = this.num; Function nump = num.Differentiate(x); Function denom = this.denom; Function denomp = denom.Differentiate(x); return (nump * denom - num * denomp) / (denom * denom); }
public ValueType this[Variable v] { get{return (ValueType)this.table[v];} set{this.table[v] = value;} }
public override Function Differentiate(Variable x) { ArrayList func; Function sum = (Constant)0; foreach(Function f in this.functions) { func = (ArrayList)this.functions.Clone(); func.Remove(f); func.Add(f.Differentiate(x)); sum += new Product(func); } return sum; }
public override Function Differentiate(Variable x) { ArrayList func = new ArrayList(); foreach(Function f in this.functions) { func.Add(f.Differentiate(x)); } return new Sum(func); }
public override Function Differentiate(Variable x) { Function f = this.inner.Differentiate(x); if(f is Constant) { Constant c = f as Constant; return (Constant)(this.factor * c.Value); } return new Multiple(this.factor, f); }
/// <summary> /// (x による偏)導関数を求める。 /// 解析的に計算。 /// 解析的に計算できない関数の場合、InvalidOperationException を throw する。 /// </summary> /// <param name="x">微分対象となる変数</param> /// <returns>導関数</returns> public virtual Function Differentiate(Variable x) { throw new InvalidOperationException("微分できません"); }
public Parameter(Variable x, ValueType val) { this.x = x; this.val = val; }