AngouriMath 1.2の新機能は何ですか?

ご挨拶。過去7か月間、私は最大のAngouriMathアップデートに取り組んできましたそして、何か伝えたいことがあります。





一言で言えば何が起こっているのか

2019年11月、この世界、より正確にはドットネットの世界には、式の簡略化、方程式の解法、ラテックスの導出などのための記号代数ライブラリがないことに気付きました。そこで、作成することにしました。





しかし〜がある ...

私がしていることを聞いて、さまざまな人々がさまざまな解決策を考え出します。SymPyを書き直し、SageMath for Dotnet、スパイラルWolfram | Alphaのラッパーを作成し、プリミティブmathnet.symbolicsを使用します(それら自体がプリミティブ性について話します)。





しかし、これにはすべて制限または困難があります。私が取り組んでいるのと同じものは、.NET用に作成および最適化された非常に軽量なライブラリです。もちろん、オープンソース。(MITの下で)





アップデート1.2

8月、主要な貢献者の1人である@ HappyPig375が、ライブラリの重要な部分を通常の型階層に書き直すのを手伝いました。現在、演算子または関数ごとに個別のタイプがあります。それは転換点であり、その前はライブラリは遅く、不器用で、完全に自明ではありませんでした。それ以来、何が行われてきたかを見ていきましょう。





式は記録です

たとえば、これは合計演算子の宣言がどのように見えるかです





public sealed partial record Sumf(Entity Augend, Entity Addend) : NumericNode
      
      



このおかげで、新しいパターンマッチングを簡単に適用できます。





internal static Entity CommonRules(Entity x) => x switch
{
    // (a * f(x)) * g(x) = a * (f(x) * g(x))
    Mulf(Mulf(Number const1, Function func1), Function func2) => func1 * func2 * const1,

    // (a/b) * (c/d) = (a*c)/(b*d)
    Mulf(Divf(var any1, var any2), Divf(var any3, var any4)) => any1 * any3 / (any2 * any4),

    // a / (b / c) = a * c / b
    Divf(var any1, Divf(var any2, var any3)) => any1 * any3 / any2,
      
      



(これは、式を単純化するときに機能するパターンの例です)





数学

, .





, , , .





12 , (sinh(x)



(e.Pow(x) - e.Pow(-x)) / 2



).





Abs Signum. abs : (|x|)



. , , ( | , ).





Phi ( ).





WriteLine(@"phi(8)".EvalNumerical());
WriteLine(@"(|-3 + 4i|)".EvalNumerical());
WriteLine(@"sinh(3)".Simplify());
WriteLine(@"sec(0.5)".Simplify());
      
      







4
5
(e ^ 3 - 1 / e ^ 3) / 2
sec(1/2)
      
      



. , NaN, . - SpecialSet, .





- . - , - , . : not



, or



, xor



, and



, implies



.





, Boolean



, EvaluableBoolean



. , EvaluableNumerical



, Number



.





WriteLine(@"(true or b) implies c".Simplify());
      
      



( c



)





Boolean



, . : =



, <



, >



, <=



, >=



.





. , a > b > c



, (a > b > c



, a > b and b > c



).





WriteLine(@"a < b >= c".Simplify());
      
      



( a < b and b >= c



)





. .





- FiniteSet, , . . : { 1, 2, 3 }



.





/ : [1; 2]



, (1; 2)



, [1; 2)



, (1; 2]



. .





SpecialSet



"" . CC



, RR



, QQ



, ZZ



, BB



  , , , , .





ConditionalSet



set-builder notation, : { x : x > 0 and x^2 = y }



( x



, y



).





WriteLine(@"({ 1, 2 } \/ { 5 }) /\ { x : x in [2; 3] and x > 0 } ".Simplify());
      
      



( { 2 }



)





, . .





WriteLine("tan(a x) / (b x)".Limit("x", 0));
WriteLine("(sin(t) - t) / t3".Limit("t", 0));
      
      



( a / b



-1/6



)





"Provided"

, . , sqrt(x) provided x >= 0



. x, NaN.





, NaN, . , NaN NaN.





-

Piecewise



- Provided



. -, , Piecewise



, Provided



, .





, Piecewise



:





Entity abs = "piecewise(x provided x > 0, -x provided x <= 0)";
WriteLine(abs.Substitute("x", 3).EvalNumerical());
WriteLine(abs.Substitute("x", -3).EvalNumerical());
      
      



( 3 )





, / .





, , AngouriMathBaseException



. p/invoke



- - , , , AngouriMathBaseException



, . , , catch- ( ).





, . , 1.1.0.5. .





F#

API AngouriMath F#. , , F# . - , .





Interactive

, AngouriMath Jupyter. AngouriMath.Interactive ILatexiseable



LaTeX- MathJax ( ).





JupyterでAngouriMath.Interactiveを使用する簡単な例
AngouriMath.Interactive Jupyter

. , ? , . ([ThreadStatic]



), .





- , Solve



Simplify



, .





, . , , . ,





using var _ = MaxExpansionTermCount.Set(10);
// - 
      
      



(, Set



, IDisposable



).





. , . , . , .





- , ( ).





リンク

  1. プロジェクトのGithub





  2. プロジェクトサイト





  3. より詳細な新機能





  4. 次のアップデートの計画





  5. 私のプロフィールはGitHubにあります。





  6. SymPy-アイデアを刺激し、与えます。








All Articles