如何在mathematica中显示不同基数的重复小数
我读了这个伟大的问题< /a> 关于显示和对它们进行简单的算术,但我想知道鉴于此(或只是从头开始),如何在给定不同的基数时显示然后进一步类似地对它们进行算术?
例如,
(1/3)_2=0.01
表示二进制形式的分数1/3
是重复二进制数字01
。
谢谢。
I read this great question about showing and doing simple arithmetic on them, but I am wondering given this (or simply starting from scratch), how to show and then further similarly do arithmetic on them when given a different base?
For example,
(1/3)_2=0.01
means the fraction 1/3
in binary form is repeating the binary digits 01
.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个尝试。巫师先生做了很多繁重的工作,特别是在保底算术方面。
可以使用以下方法实现保留基数算术:
检查以多个基数进行的重复小数的转换是否有效。还检查加法、乘法和除法的例程:
编辑
最新的改进(信用再次致Mr.Wizard)支持嵌套:
Here's an attempt. Mr.Wizard did much of the heavy lifting, especially in the base-preserving arithmetic.
Base-preserving arithmetic can be implemented using this:
Checking to see that conversions to repeating decimals in several bases work. Also checking routines for adding, multiplying, and dividing:
Edit
The latest refinements (credit, once again, to Mr.Wizard) support nesting:
简单:
BaseForm[1./12, 3]
将向您显示以 3 为基数的 1/12(1 后面的小数点是为了确保近似值)作为重复小数。额外:将 x 基数转换为 10 基数更加简单
x^^
Simple:
BaseForm[1./12, 3]
will show you 1/12 (the decimal point after the 1 is to ensure approximation) in base 3 as a repeating decimal.Extra: Converting base x to base ten is even simpler
x^^<NUMBER>
'RealDigits' 能够处理各种基数,因此
请参阅文档 关于您可能获得的精确输出格式。它可能相当复杂。
'RealDigits' is able to handle all kinds of bases, so for instance
Refer to the documentation about the precise output format you may get. It can be rather complex.