LoginSignup
3
5

More than 5 years have passed since last update.

衝撃な発見。原因不明

Posted at

$$\frac{n+1}{n}=(n+1)*n^{-1}$$
普通に成り立つ等式で、何も違和感がないです。

> n <- 1:100
> which( (n+1)/n != (n+1)*n**(-1) )
 [1]  5  6 13 21 24 28 30 37 38 40 45 46 52 54 77 83 91 96

> n <- 1:1000
> which( (n+1)/n != (n+1)*n**(-1) )
  [1]    5    6   13   21   24   28   30   37   38   40   45   46   52   54   77   83   91   96  105  106  109  117  122  123  133  135  137  149  150  167
 [31]  181  189  191  198  200  211  214  220  224  234  235  248  249  281  288  296  297  301  304  328  342  343  347  371  383  384  391  392  394  412
 [61]  425  432  436  438  439  454  456  459  463  474  475  477  480  486  492  497  498  501  515  524  534  540  542  544  548  552  569  578  579  587
 [91]  590  598  609  613  618  629  637  640  653  672  691  695  698  701  702  705  724  725  734  735  737  746  754  756  767  774  782  783  791  808
[121]  809  810  817  823  826  829  830  839  841  842  847  850  862  880  883  886  887  889  890  895  908  927  942  945  946  957  961  966  977  978
[151]  980  984  987  998 1000

なんで?
$$\frac{6}{5}\neq6*5^{-1}$$

さらに、

> n <- 1:100
> which( n/5 != n*5**(-1) )
 [1]  3  6  7 12 14 17 19 23 24 28 29 33 34 38 39 41 46 48 51 53 56 58 61 63 66 68 71 73 76 78 82 87 92 96 97

$$\frac{3}{5}\neq3*5^{-1}?$$

さらに、

> n <- 1:100
> a <- seq(0.2, 20, by =0.2)
> which( n/5 != a )
 [1]  3  7 12 13 14 15 17 18 19 23 24 25 28 29 30 33 34 35 38 39 44 97
> which( n*5**(-1) != a )
 [1]  6 13 15 18 25 30 35 41 44 46 48 51 53 56 58 61 63 66 68 71 73 76 78 82 87 92 96

$$\frac{3}{5}\neq0.6?$$

Rはダメですか?では、Pythonで試してみましょう。

>>> 6/5 == 6*5**(-1)
False
>>> (81/20-4)*20 == (81/16-5)*16
False

困りますね。原因を知りたいです。
ご存じの方、ぜひ教えてください。

3
5
12

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5