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

1. [Calculator] 关于递推公式的计算

Posted by haifeng on 2023-02-04 14:18:28 last update 2023-02-04 14:18:28 | Answers (0) | 收藏


Hanoi 问题的递推关系为 $a_n=2a_{n-1}+1$, $a_1=1$.

>> printRecursiveSeries(2*n+1,n,1,10,\n)
in> printRecursiveSeries(2*n+1,n,1,10,\n)
3
7
15
31
63
127
255
511
1023
2047


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


注意输入时 2*n+1 如果忘了乘号 *, 则有

>> printRecursiveSeries(2n+1,n,1,10,\n)
in> printRecursiveSeries(2n+1,n,1,10,\n)
22
223
2224
22225
222226
2222227
22222228
222222229
2222222230
22222222231


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

2. [Calculator]

Posted by haifeng on 2023-02-03 19:10:05 last update 2023-02-04 10:08:41 | Answers (0) | 收藏


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

>> c=3
--------------------
>> a=1
--------------------
>> l=12
--------------------
>> u=21
--------------------
>> t=20
--------------------
>> o=15
--------------------
>> r=18
--------------------
>> c+a+l+c+u+l+a+t+o+r
in> 3+1+12+3+21+12+1+20+15+18

out> 106

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

3. [Bug] Calculator 中关于 % 运算的 Bug

Posted by haifeng on 2022-09-21 11:40:26 last update 2022-09-21 11:40:26 | Answers (1) | 收藏


>> 3 * (2-6 %(3 -7))
in> 3*(2-6%(3-7))

out> 312

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


>> 6%(-4)
in> 6%(-4)

out> -25

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


>> 6%(4)
in> 6%(4)

out> 25

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


>> 6%4
in> 6%4

out> 1

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

 

4. 解不定方程 $7x+4y=1$.

Posted by haifeng on 2022-09-21 00:02:58 last update 2022-09-21 00:02:58 | Answers (0) | 收藏


解不定方程 $7x+4y=1$.

 

>> IndefiniteEquation(7,4)
in> IndefiniteEquation(7,4)
Solve the equation: 7*x+4*y = 1
7==1*4+3
4==1*3+1
1 1
test: 1==4*2-7*1
4*2-7*1 == 1
x = -1+4t
y = 2-7t


-----------***---------

 

>> IndefiniteEquation(7,4;1)
in> IndefiniteEquation(7,4;1)
Solve the indefinite equation :
7*X1+4*X2 = 1

u1=1-3*u0
---------------
X1 = -1*u1+u0
X2 = -1*X1+u1

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

 

5. 求解不定方程 $7x_1+4x_2-2x_3+3x_4=2$.

Posted by haifeng on 2022-09-18 14:41:44 last update 2022-09-19 16:41:52 | Answers (0) | 收藏


>> IndefiniteEquation(7,4,-2,3;2)
in> IndefiniteEquation(7,4,-2,3;2)
Solve the indefinite equation :
7*X1+4*X2-2*X3+3*X4 = 2

X4=2-2*u2-X1
---------------
X4 = +X4
X3 = +3*X1+2*X2+1*X4-u2

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

 


>> IndefiniteEquation(7,4,-2,3;2)
in> IndefiniteEquation(7,4,-2,3;2)
Solve the indefinite equation :
7*X1+4*X2-2*X3+3*X4 = 2

X4=2-X1-2*u2
---------------
X1 = +X1
X3 = +3*X1+2*X2+1*X4-u2

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

 

6. 求解不定方程 $25x-13y+7z=4$.

Posted by haifeng on 2022-09-18 14:40:09 last update 2022-09-18 14:40:09 | Answers (0) | 收藏


>> IndefiniteEquation(25,-13,7;4)
in> IndefiniteEquation(25,-13,7;4)
Solve the indefinite equation :
25*X1-13*X2+7*X3 = 4

u2=4-2u1
---------------
X2 = +2*u0+1*u2-u1
X1 = +1*X2-1*u2+u0
X3 = -3*X1+1*X2+u2

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

7. 求解不定方程 $x+2y+3z=4$.

Posted by haifeng on 2022-09-18 14:38:46 last update 2022-09-18 14:39:08 | Answers (0) | 收藏


>> IndefiniteEquation(1,2,3;4)
in> IndefiniteEquation(1,2,3;4)
Solve the indefinite equation :
1*X1+2*X2+3*X3 = 4

X3=4-X1-2u1
---------------
X2 = -1*X3+u1
X1 = +X1

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

8. 矩阵输入的问题

Posted by haifeng on 2022-09-04 20:46:26 last update 2022-09-06 09:24:10 | Answers (0) | 收藏


CalculatorApp.exe 对于矩阵输入, 在 0.516 版本中将回车视为一行结束, 即等价于分号;

例如, 输入

B=[1,2,3
4;3,2,0
1;0,2,0,9;1,3,5,
-1]

将得到下面的结果:

[var] B
1 2 3 0 
4 0 0 0 
3 2 0 0 
1 0 0 0 
0 2 0 9 
1 3 5 0 
-1 0 0 0 
input> [1,2,3;4;3,2,0;1;0,2,0,9;1,3,5,;-1]
det(B)=NaN
--------------------
>> 


而在 calculator.exe 下, 换行等同于逗号. 同样上面的输入得到:

input> [1,2,3,4;3,2,0,1;0,2,0,9;1,3,5,-1]
det(B)=-143
----------------------------
 type: matrix
 name: B
value:
1       2       3       4
3       2       0       1
0       2       0       9
1       3       5       -1

determinant: -143
--------------------


哪一种输入方案更好?

 

个人更倾向于第二种方案, 因为有时矩阵的列数很多, 一行输入不下, 换行是需要的.

从 v0.517 开始, CalculatorApp.exe 采用第二种方案.


calculator.exe  v0.518测试

B=[1 2 3
4;3,2,0
1;0,2,0,9;1,3,5,
-1]

9. [Bug] Calculator

Posted by haifeng on 2022-09-01 23:40:05 last update 2022-09-01 23:40:05 | Answers (0) | 收藏


>> A=[1 2; 3 4]
input> [1,2;,3,4],;

 

10. [Bug] Calculator 分数运算中乘幂的Bug

Posted by haifeng on 2022-08-22 08:01:54 last update 2022-08-22 14:03:04 | Answers (0) | 收藏


>> (1/5+1/3)^2
in> (1/5+1/3)^2

out> 7111111|25000000


实际上应等于 64|225

>> (1/5+1/3)*(1/5+1/3)
in> (1/5+1/3)*(1/5+1/3)

out> 64|225


[分析原因]

>> 64/225
in> 64/225

out> 0.28444444

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


>> 7111111/25000000
in> 7111111/25000000

out> 0.28444444

这两个分数在

(1/5+1/3)^2 在分数模式下, 仍然将 (1/5+1/3) 作数值计算, 得到 0.53333333, 然后再进行分数运算.

>> 0.53333333^2
in> 0.53333333^2

out> 7111111|25000000


注: 这个 Bug 是在使用数字帝国上的分数运算器发现的.

分数计算器 (1/5+1/3)^2 (numberempire.com)


现在 Bug 已经解决.

>> :mode=fraction
Switch into fraction calculating mode.
e.g., 1/2+1/3 will return 5/6

>> (1/5+1/3)^(2)
in> (1/5+1/3)^(2)

out> 64|225

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


>> (1/5+1/3)^(1/2)
in> (1/5+1/3)^(1/2)

out> sqrtn(8,2)|sqrtn(15,2)

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

 

<[1] [2] [3] >