以代数方式简化平方根 [英] Simplify square roots algebraically

查看:21
本文介绍了以代数方式简化平方根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用代数来简化一个整数的平方根,而不是用数值计算,即 √800 应该是 20√2 ,而不是 28.2842712474619.

I would like to simplify the square root of an integer algebraically, not compute it numerically, i.e. √800 should be 20√2 , not 28.2842712474619.

我找不到任何通过编程来解决这个问题的方法:(

I cannot find any way to solve this through programming :(

推荐答案

对根下的数进行因式分解,挑出成对出现的因数,剩下的留在根下.

Factorize the number under the root, pick out the factors that come out in pairs and leave the rest under the root.

√800 = √(2 x 2 x 2 x 2 x 5 x 2 x 5) = √(22 x 22 x 52 x 2) =(2 x 2 x 5)√2 = 20√2.

√800 = √(2 x 2 x 2 x 2 x 5 x 2 x 5) = √(22 x 22 x 52 x 2) = (2 x 2 x 5)√2 = 20√2.

为了完整起见,这里有一些简单的代码:

And for completeness, here some simple code:

outside_root = 1
inside_root = 800
d = 2
while (d * d <= inside_root):
  if (inside_root % (d * d) == 0): # inside_root evenly divisible by d * d
    inside_root = inside_root / (d * d)
    outside_root = outside_root * d
  else:
    d = d + 1

当算法终止时,outside_root 和 inside_root 包含答案.

when the algorithm terminates, outside_root and inside_root contain the answer.

这里是 800 的运行:

Here the run with 800:

 inside   outside   d
    800         1   2 # values at beginning of 'while (...)'
    200         2   2
     50         4   2
     50         4   3
     50         4   4
     50         4   5
      2        20   5 # d*d > 2 so algorithm terminates
     ==        ==

答案 20√2 在最后一行.

The answer 20√2 is here on the last row.

这篇关于以代数方式简化平方根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆