Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图建立一个程序,将一个激进变成最简单的激进形式。显然,我没有运气。
我正在寻找一种接受 aString并返回 a的方法String。
String
一个输入String:sqrt[160]。我已经让我的方法取出数值(160)。
sqrt[160]
现在,我只需要一些东西来打破 160 并返回一个String赞:"4*sqrt[10]"
"4*sqrt[10]"
提前致谢!
笔记:
对数进行因式分解,所有具有 2 次幂指数的因子都可以移到平方根之外。乘以其余部分,将保留在根符号下。
定义“最简单的激进形式”。
从什么时候开始sqrt(120) = 4*sqrt(10)?我的计算器告诉我10.954 != 12.649。这是一个错字吗?也许你的意思是sqrt(160)。
sqrt(120) = 4*sqrt(10)
10.954 != 12.649
sqrt(160)
是什么让你的表格更简单?
方法界面简单;实现的逻辑更难。您必须将平方根符号下的值分解为整数因子并寻找完美的平方根。