current_median_history计算时用到的小学数学

in #cn-stem5 years ago

前阶段大家都知道SBD脱锚了(所谓的脱锚,就是原本号称锚定1美元的SBD,贬值至低于一美元)。造成这种情况的原因可以参考我之前的一个帖子:Why is median_history_price no longer the median of feed price? My investigation.


(图源 :pixabay by geralt)

current_median_history的公式

简单的归结一下原因就是:

保证任何时刻SBD的供应量不大于总供应量的10%

所以如果用见证人历史喂价算出的current_median_history不能保证SBD的供应量小于等于总供应量的10%,则current_median_history按SBD占比为10%由供应量算出。

好,我们都知道按现在的STEEM价格,SBD的占比已经远远超过了10%,所以上述机制起作用了,那么SBD供应量、STEEM供应量、以及current_median_history的就有了如下关系:

看起来有点混乱,因为current_median_history是我们要计算的值,所用我们用x来表示,这样看起来就简单多了。

current_median_history的计算过程

那么如何计算上述公式中的x的值呢?或许可以考虑用程序解方程,姑且不考虑如何实现,显而易见的是那样做会消耗很多资源浪费很多时间。所以这时候我们小学学过的数学知识就可以拿来大显身手了。

第一步,把上述公式变换为:

再展开

变换一下:

继续处理:

这时候我们就可以看出来x亦即current_median_history的值了

所以,对于current_median_history,我们的程序无需进行复杂的计算,直接将SBD供应量、STEEM供应量代入上述公式即可。

总结

尽管有了计算机以后,好多计算都可以交给计算机来处理,但是在有些场景,应用简单的数学知识就可以大幅简化计算流程提升、减少资源占用、提升效率!

而实际上,数学就是计算机科学的基石,计算机科学的方方面面都离不开数学,就比如说我现在在STEEM上发帖,涉及到公钥私钥、签名和验证等,就涉及到椭圆曲线的应用。

当然了,凭我小学六年级毕业的文化水平,太复杂的原理或者内容我也讲不出来,能通过这个例子给大家一丁点启发就满足啦。

相关链接

Sort:  




This post has been voted on by the SteemSTEM curation team and voting trail in collaboration with @utopian-io and @curie.

If you appreciate the work we are doing then consider voting all three projects for witness by selecting stem.witness, utopian-io and curie!

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

看出来了,解决方案就是拉个盘即可。

起床拉盘啦

Thank you so much for participating the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

那意思是现在steemit的价值贬低了

Hi @oflyhigh!

Your post was upvoted by Utopian.io in cooperation with @steemstem - supporting knowledge, innovation and technological advancement on the Steem Blockchain.

Contribute to Open Source with utopian.io

Learn how to contribute on our website and join the new open source economy.

Want to chat? Join the Utopian Community on Discord https://discord.gg/h52nFrV

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.033
BTC 64961.60
ETH 3103.64
USDT 1.00
SBD 3.86