TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Mathematica interpreter in Typescript

121 点作者 lispybanana7 个月前

7 条评论

coffeemug7 个月前
Hey, that&#x27;s my project!<p>I just wrote another post about perf benchmarking it against Mathematica proper-- <a href="https:&#x2F;&#x2F;www.spakhm.com&#x2F;ts-wolfram-bench" rel="nofollow">https:&#x2F;&#x2F;www.spakhm.com&#x2F;ts-wolfram-bench</a>. Really surprised by the result, on the workload I tested Mathematica is only 2x faster than my barely optimized interpreter. A testament to the V8 engine, I didn&#x27;t quite realize how ridiculously good V8 is until running this benchmark.
评论 #41916093 未加载
Someone7 个月前
&gt; Certainly Mathematica’s term rewrite loop is optimized to death, and I only spent an hour or two making the most basic optimization<p>I suspect this benchmarks begint libraries more than term rewriting. A way to test that may be:<p><pre><code> bif[1] := 0 bif[2] := 0 bif[n_] := bif[n-2] + bif[n-1] Timing[Do[bif[15], 1000]] </code></pre> You can check that neither tool is smart enough to solve that to<p><pre><code> bif[n_] := 0 </code></pre> by comparing running times for different large limits.
评论 #41914122 未加载
lacker7 个月前
I&#x27;m curious what people use Mathematica for. I know some people who use it academically. Does anyone use it in a non-academic professional context? I&#x27;d be interested to hear from anyone who does, what they are using it for.
评论 #41916620 未加载
评论 #41916139 未加载
评论 #41915798 未加载
peter_d_sherman7 个月前
&gt;&quot;Writing a toy differentiator turns out to be shockingly easy. It’s a near verbatim transcription of differentiation rules from any calculus textbook:<p>D[_?NumberQ, x_Symbol] = 0;<p>D[x_, x_Symbol] = 1;<p>D[Times[expr1_, expr2_], x_Symbol] = D[expr1, x] expr2 + D[expr2, x] expr1;<p>D[Plus[expr1_, expr2_], x_Symbol] = D[expr1, x] + D[expr2, x];<p>D[Sin[x_], x_Symbol] = Cos[x];<p>D[Cos[x_], x_Symbol] = -Sin[x];<p>D[f_Symbol[expr_], x_Symbol] := (D[f[x], x] &#x2F;. x -&gt; expr) * D[expr, x];<p>D[Power[expr_, p_Integer], x_Symbol] := p expr^(p - 1) * D[expr, x]; &quot;<p>Absolutely brilliant! And simple! And terse! And brilliant!
samlittlewood7 个月前
So tempted to try this myself in another language - just so I can call in ‘tungsten’.
评论 #41912990 未加载
sillying7 个月前
Mathematica has thousand of functions, this seems to be just an algorithm for defining and using rules like that in mathematica.
Y_Y7 个月前
I applaud calling the language <i>Mathematica</i>, despite Stephen Mathematica&#x27;s attempts to rename it a couple of years ago.<p>See also: <a href="https:&#x2F;&#x2F;mathics.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mathics.org&#x2F;</a><p>It&#x27;s a more mature and complete reimplementation of Mathematica, though still miles behind the original.
评论 #41914705 未加载
评论 #41916307 未加载
评论 #41913575 未加载
评论 #41913785 未加载