Questions in category: Calculator (Calculator)
软件 >> Calculator
<[1] [2] [3] [4] >

21. Calculator 关于阶乘运算优先级的 BUG

Posted by haifeng on 2022-04-29 10:01:31 last update 2022-09-11 10:15:57 | Answers (0) | 收藏


>> (2*1+1)*1!*2^(2*1)
in> (2*1+1)*1!*2^(2*1)

out> 24

 

这里运算的是  (2*1+1)*1!  == 3!=6, 从而乘以后面的 4 得到 24.


 

在 Version 0.520 中已经修正.

 

>> (2*1+1)*1!*2^(2*1)
in> (2*1+1)*1!*2^(2*1)

out> 12

 

22. 如何用连分数求解二元一次不定方程 $119x-32y=1$?

Posted by haifeng on 2021-07-07 09:27:02 last update 2021-07-07 09:27:02 | Answers (1) | 收藏


如何用连分数求解二元一次不定方程 $119x-32y=1$?

 

使用 Calculator 我们可以这样操作:

>> continued_fraction(119/32)
in> continued_fraction(119/32)

out> (3,1,2,1,1,4)

------------------------

>> continued_fraction(3,1,2,1,1)
in> continued_fraction(3,1,2,1,1)
out> 26|7

Expression:
3+1/(1+1/(2+1/(1+1/(1))))

TeX Code:
3+\frac{1}{1+\frac{1}{2+\frac{1}{1+\frac{1}{1}}}}

------------------------

>> 119*7-32*26
in> 119*7-32*26

out> 1

 

 

23. 关于 $\pi(x)$

Posted by haifeng on 2021-06-23 22:12:06 last update 2021-06-23 22:19:55 | Answers (0) | 收藏


设 $x\in\mathbb{Z}^+$, $\pi(x)$ 表示不超过 $x$ 的素数个数, 则容易计算得

$\pi(1000)=168$.

 

根据 Richard K. Guy 的书 [1, A], 有

$\pi(4\cdot 10^{16})=1075292778753150$.

不过, Calcultor 计算有误.

>> 4*10^16
in> 4*10^16

out> 40000000000000000

------------------------


>> pi(40000000000000000)
in> pi(40000000000000000)
out> 126261900

注: 这个结果是错的. 

目前 Calculator 只能验证 $x\leqslant 10^9$ 以下是正确的.

 


References:

[1] Richard K. Guy, Unsolved Problems in Number Theory, Third Edition. 科学出版社.

24. [ToDo] Calculator 研发计划之编程语言

Posted by haifeng on 2021-03-21 09:33:26 last update 2021-03-21 10:25:10 | Answers (0) | 收藏


设法将 Calculator 转为一个简单的编程语言.

 

 

添加保存功能

save _ to file

25. [ToDo] Calculator 研发计划

Posted by haifeng on 2021-03-21 09:30:51 last update 2022-08-26 13:43:51 | Answers (0) | 收藏


编写新函数

 

 

最大公因子 gcd(x1,x2,x3,...,xn)

最小公倍数 lcm(x1,x2,x3,...,xn)

勒让德符号

 

识别多项式的函数 isPolynomial(),

如果是多项式, 则其幂运算等可以使用更快的算法. 比如

$(x+x^2+x^3+x^4+x^5+x^6)^9$ 

 

解方程

 

求解方程组

 

求解同余方程组

solveEquations(x==2 mod3, x==3 mod 5, x==4 mod 7; x)

 

 

有一个解方程的网站 https://www.geteasysolution.com/

 


关于矩阵的初等变换

假设 A 是一个 $m\times n$ 矩阵,

transform(A, r1+r2*k)    // 表示矩阵 A 的第二行乘以 k 再加到第一行上.

transform(A, r1<->r2)   // 表示矩阵 A 的第1行和第2行进行调换.

等等

  

 

26. Calculator 问题修复

Posted by haifeng on 2021-03-21 09:21:24 last update 2021-03-21 09:21:24 | Answers (0) | 收藏


Date: 2021-3-21

版本:  version<=0.491

函数:  help() 

问题:  当查询不存在的函数时, 由于迭代器 itr 到达 systemFunctions 的末尾, 导致程序终止. 

解决方案: 加入对 itr 的检测. 

状态:  已解决


 

27. 编译 Calculator 遇到的问题

Posted by haifeng on 2021-03-14 22:00:07 last update 2021-03-14 22:00:07 | Answers (0) | 收藏


1>------ 已启动全部重新生成: 项目: calculator, 配置: Release Win32 ------
1>BigNumber.cpp
1>calculator.cpp
1>commands.cpp
1>register.cpp
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(26,45): warning C4273: “malloc”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_malloc.h(101,15): message : 参见“malloc”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(27,55): warning C4273: “realloc”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_malloc.h(126,15): message : 参见“realloc”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(28,55): warning C4273: “calloc”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_malloc.h(66,15): message : 参见“calloc”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(29,40): warning C4273: “free”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_malloc.h(89,14): message : 参见“free”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(31,113): warning C4273: “qsort”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_search.h(60,23): message : 参见“qsort”的前一个定义
1>D:\download\C++\crypt\LibTomCrypt\others\libtomcrypt-master\src\headers\tomcrypt_cfg.h(35,41): warning C4273: “clock”: dll 链接不一致
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\time.h(142,26): message : 参见“clock”的前一个定义
1>stdafx.cpp
1>LINK : warning C4727: 具有相同时间戳的名为 d:\work\cs\c++\vs2019\calculator_vc\calculator\calculator\release\calculator.pch 的 PCH 已存在于 d:\work\cs\c++\vs2019\calculator_vc\calculator\calculator\release\register.obj 和 d:\work\cs\c++\vs2019\calculator_vc\calculator\calculator\release\commands.obj 中。 使用第一个 PCH。
1>正在生成代码
1>Previous IPDB not found, fall back to full compilation.
1>All 1588 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
1>已完成代码的生成
1>calculator.vcxproj -> D:\work\cs\c++\vs2019\calculator_vc\calculator\Release\calculator.exe
1>已完成生成项目“calculator.vcxproj”的操作。
========== 全部重新生成: 成功 1 个,失败 0 个,跳过 0 个 ==========

 

28. 设正整数 $a,b$ 满足 $a^2+b^2=4361$, 求 $a+b$.

Posted by haifeng on 2021-01-17 21:50:13 last update 2021-01-17 21:50:13 | Answers (0) | 收藏


设正整数 $a,b$ 满足 $a^2+b^2=4361$, 求 $a+b$.

29. Factorise()

Posted by haifeng on 2020-12-31 23:01:39 last update 2020-12-31 23:01:39 | Answers (0) | 收藏


>> p(2021)
in> p(2021)
out> 17579

------------------------

>> Factorise(2021)
in> Factorise(2021)
2021 == 43*47
43^1*47^1
out> 2021 == 43*47

------------------------

>> p(43)
in> p(43)
out> 191

------------------------

>> p(47)
in> p(47)
out> 211

------------------------

>> 191*211
in> 191*211

out> 40301

------------------------

>> 40301-17579
in> 40301-17579

out> 22722

------------------------

>> Factorise(22722)
in> Factorise(22722)
22722 == 2*3*7*541
2^1*3^1*7^1*541^1
out> 22722 == 2*3*7*541

------------------------

>> Factorise(237541)
in> Factorise(237541)
237541 == 17*89*157
17^1*89^1*157^1
out> 237541 == 17*89*157

------------------------

>> Factorise(1789157)
in> Factorise(1789157)
1789157 == 73*24509
73^1*24509^1
out> 1789157 == 73*24509

------------------------

>> Factorise(7324509)
in> Factorise(7324509)
7324509 == 3*2441503
3^1*2441503^1
out> 7324509 == 3*2441503

------------------------

>> Factorise(32441503)
in> Factorise(32441503)
32441503 == 101*321203
101^1*321203^1
out> 32441503 == 101*321203

------------------------

>> Factorise(101321203)
in> Factorise(101321203)
101321203 == 103*983701
103^1*983701^1
out> 101321203 == 103*983701

------------------------

>> Factorise(103983701)
in> Factorise(103983701)
103983701 == 8377*12413
8377^1*12413^1
out> 103983701 == 8377*12413

------------------------

>> Factorise(837712413)
in> Factorise(837712413)
837712413 == 3*3*19*19*257837
3^2*19^2*257837^1
out> 837712413 == 3^2*19^2*257837

------------------------

>> Factorise(32192257837)
in> Factorise(32192257837)
32192257837 == 43*167*4482977
43^1*167^1*4482977^1
out> 32192257837 == 43*167*4482977

------------------------

>> Factorise(431674482977)
in> Factorise(431674482977)
431674482977 == 67*6442902731
67^1*6442902731^1
out> 431674482977 == 67*6442902731

------------------------

>> Factorise(676442902731)
in> Factorise(676442902731)
676442902731 == 3*79*2854189463
3^1*79^1*2854189463^1
out> 676442902731 == 3*79*2854189463

------------------------

>> Factorise(3792854189463)
in> Factorise(3792854189463)
3792854189463 == 3*1264284729821
3^1*1264284729821^1
out> 3792854189463 == 3*1264284729821

------------------------

>> Factorise(31264284729821)
in> Factorise(31264284729821)
31264284729821 == 11*13*47*3209*1449589
11^1*13^1*47^1*3209^1*1449589^1
out> 31264284729821 == 11*13*47*3209*1449589

------------------------

>> Factorise(11134732091449589)
in> Factorise(11134732091449589)
11134732091449589 == 7*1901*123829*6757363
7^1*1901^1*123829^1*6757363^1
out> 11134732091449589 == 7*1901*123829*6757363

------------------------

>> Factorise( 7*1901*123829*6757363)
in> Factorise(7*1901*123829*6757363)
hint> 7*1901*123829*6757363 contains non digit char, it is regarded as a string.

------------------------

>> Factorise(719011238296757363)
in> Factorise(719011238296757363)
719011238296757363 == 659*1019*3701*3917*73859
659^1*1019^1*3701^1*3917^1*73859^1
out> 719011238296757363 == 659*1019*3701*3917*73859

------------------------

>> Factorise(65910193701391773859)
in> Factorise(65910193701391773859)
65910193701391773859 == 65910193701391773859
65910193701391773859 == 65910193701391773859^1
out> 65910193701391773859 == 65910193701391773859^1

------------------------

>>

30. 关于 $!n$

Posted by haifeng on 2020-11-15 10:22:50 last update 2021-05-11 09:39:09 | Answers (0) | 收藏


$!n$ 定义为 

\[
!n=1!+2!+3!+\cdots+n!=\sum_{k=1}^{n}k!
\]

 

在 Calculator 中做实验:

 

>> !10
in> !10

out> 4037913

------------------------


>> sum(n!,n,1,10)
in> sum(n!,n,1,10)

out> 4037913

 


计算 !5

 

 

<[1] [2] [3] [4] >