Questions in category: 符号运算 (Symbolic operations)

## 1. solve()函数应用于多项式方程

Posted by haifeng on 2023-02-12 14:37:31 last update 2023-02-12 16:01:22 | Answers (0) | 收藏

>> :mode=polyn

>> solve((x^13+x+90)mod(x^2-x+a)==0,a, -90, 90)

## 2. 求 Jacobi 符号 $\bigl(\frac{853}{1409}\bigr)$

Posted by haifeng on 2023-02-02 17:57:24 last update 2023-02-02 18:02:06 | Answers (0) | 收藏

>> Jacobi(853,1409,show)
in> Jacobi(853,1409,show)

(556|853) = (139|853)

(6|19) = (2|19)(3|19)
(2|19) = -1

(3|19) = -(19|3) = -(1|3) = -1
(19|139) = -(139|19) = -(6|19) = -1
(139|853) = (853|139) = (19|139) = -1
(853|1409) = (1409|853) = (556|853) = -1
-------
result> -1

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

(853|1409) = (1409|853) = (556|853)= (139|853) = (853|139) = (19|139) =  -(139|19) = -(6|19)

= -(2|19)(3|19) = -(-1)(3|19) = (3|19) = -(19|3) = -(1|3) = -1

$\begin{split} \bigl(\frac{853}{1409}\bigr) &= \bigl(\frac{1409}{853}\bigr) = \bigl(\frac{556}{853}\bigr) = \bigl(\frac{139}{853}\bigr) = \bigl(\frac{853}{139}\bigr) = \bigl(\frac{19}{139}\bigr) = -\bigl(\frac{139}{19}\bigr) = -\bigl(\frac{6}{19}\bigr)\\ &= -\bigl(\frac{2}{19}\bigr)\bigl(\frac{3}{19}\bigr) = -(-1)\bigl(\frac{3}{19}\bigr) = \bigl(\frac{3}{19}\bigr) = -\bigl(\frac{19}{3}\bigr) = -\bigl(\frac{1}{3}\bigr) = -1 \end{split}$

## 3. [Calculator] 计算 $(x+1)^8\cdot(x^4-8x^3-12x^2-8x-2)$.

Posted by haifeng on 2023-01-03 17:07:16 last update 2023-01-03 17:08:36 | Answers (0) | 收藏

[Calculator] 计算 $(x+1)^8\cdot(x^4-8x^3-12x^2-8x-2)$.

>> (x+1)^8*(x^4-8x^3-12x^2-8x-2)
in> (x+1)^8*(x^4-8x^3-12x^2-8x-2)

out> x^12-48x^10-272x^9-780x^8-1416x^7-1764x^6-1560x^5-987x^4-440x^3-132x^2-24x^1-2

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

## 4. 多项式的加法

Posted by haifeng on 2022-11-28 22:02:15 last update 2022-11-28 22:02:15 | Answers (0) | 收藏

polyn.exe "2x^3-x^2+8" "4x^4-3x^3+6x+9"

D:\work\cs\c++\datastruct\Polynomial\polyn_vc\polyn\Debug>polyn.exe "2x^3-x^2+8" "4x^4-3x^3+6x+9"
argv[1] is 2x^3-x^2+8
2x^3-1x^2+8x^0

argv[2] is 4x^4-3x^3+6x+9
4x^4-3x^3+6x^1+9x^0

---------
2x^3-1x^2+8x^0
4x^4-3x^3+6x^1+9x^0
[1] p2-> 4x^4
[2] p1=p2 -1x^3
[3] p1-> -1x^2
[4] p2-> 6x^1
[5] p1=p2 17x^0

------
4x^4-1x^3-1x^2+6x^1+17x^0

D:\work\cs\c++\datastruct\Polynomial\polyn_vc\polyn\Debug>polyn.exe "2x^3-x^2+8" "4x^4+6x-3x^3+9"
argv[1] is 2x^3-x^2+8
2x^3-1x^2+8x^0

argv[2] is 4x^4+6x-3x^3+9
4x^4+6x^1-3x^3+9x^0

---------
2x^3-1x^2+8x^0
4x^4+6x^1-3x^3+9x^0
[1] p2-> 4x^4
[2] p1-> 2x^3
[3] p1-> -1x^2
[4] p2-> 6x^1
[5] p2-> -3x^3
[6] p1=p2 17x^0

------
4x^4+2x^3-1x^2+6x^1-3x^3+17x^0

## 5. [Bug] Calculator 中的计算bug

Posted by haifeng on 2022-09-14 20:16:40 last update 2022-09-14 20:35:29 | Answers (0) | 收藏

>> (1000*x+100*y)%99
in> (1000*x+100*y)%99

out> 1010475858

>> (1000*x+100*y)mod99
in> (1000*x+100*y)@99

out> 71

>> (1000*120+100*121)
in> (1000*120+100*121)

out> 132100

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

>> 132100%99
in> 132100%99

out> 1334

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

>> (1000*120+100*121)%99
in> (1000*120+100*121)%99

out> 13.08050302

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

>> (1)%(2)
in> (1)%(2)

out> 50

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

>> (1)%(1)
in> (1)%(1)

out> 100

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

>> (2)%(1)
in> (2)%(1)

out> 100

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

>> (3)%(1)
in> (3)%(1)

out> 100

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

>> (n)%(1)
in> (n)%(1)

out> n

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

## 6. 记录 Calculator 的 BUG

Posted by haifeng on 2020-12-18 21:12:47 last update 2020-12-28 14:16:47 | Answers (0) | 收藏

[BUG]2020-12-18

>> a/b+c/d-c/d
in> a/b+c/d-c/d

out> (a*d+b*c*d-b*d*c)|(b*d*d)

>> (1+3a)/3+3/1
in> (1+3a)/3+3/1

out> a=1; b=1; c=3a; d=1
a=+3a; b=3; c=3; d=1
a+9

>> (a+3a)/3+3/1
in> (a+3a)/3+3/1

out> a=a; b=1; c=3a; d=1
a=a+3a; b=3; c=3; d=1
(a+3a+9)|3

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

>> (2+3a)/3+3/1
in> (2+3a)/3+3/1

out> a=2; b=1; c=3a; d=1
a=2+3a; b=3; c=3; d=1
a+2+9

[BUG]2020-12-21

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

out> (3+9a))|3

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

out> 3a/1
3/1
3a/1
3/1
(3a+3a)*a/3
((3a+3a)*a)|3

[+(a +b +c) ]*[+d ]
_tmp = (a*d
_tmp = b*d
(a*d+b*d+c)*d/1
(a*d+b*d+c)*d

Bug 的原因在于这里是按 + 来分割的. 没有考虑 ( ) 的作用.

Remark: 以上 Bugs 都已经解决。2020-12-24

>> ((3+a)*2-3(a-b)/c)*8
in> ((3+a)*2-3(a-b)/c)*8

out> a*2*8-8(3*a+3*b)/c+48

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

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

>> ((3+a)*2-3(a-b)/c)*8
in> ((3+a)*2-3(a-b)/c)*8

out> 8(2(3+a)*c-3(a-b))|c

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

>> :expand=on
Expand on. In fraction calculation mode,
e.g., (a+b)*(c+d) will return a*c+a*d+b*c+b*d.

>> ((3+a)*2-3(a-b)/c)*8
in> ((3+a)*2-3(a-b)/c)*8

out> 8(2(3+a)*c-3(a-b))|c
==> 8*2*a*c+8*6*c-8*3*a+8*3*b|

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

[BUG] 2020-12-25,  无法识别 solve() 函数

>> solve(x^2==25,x,1,10)
in> solve(x^2~25,x,1,10)
cmd> solv
>> function solv() is not defined.

>> (a+3)-(b-4)
in> (a+3)-(b-4)

out> a-b7

>> (((a+2)+3)-4)/4
in> (((a+2)+3)-4)/4

out> a1/4

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

out> 3(1+3*a)|3
==> 3*3*a+3|3

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

>>  3*3*a+3
in> 3*3*a+3

out> (9*a+3)
==> 9*a+3

>> 3*(a-(b*3-4)+d)/c
in> 3*(a-(b*3-4)+d)/c

out> 3(a-b*3-4+d)|c
==> 3*a-3*b*3+3*d-12|

BUG  2020-12-26

>> ((3+a)*2-3(a-(2b-3)+5)/c)*8
in> ((3+a)*2-3(a-(2b-3)+5)/c)*8

out> 8(c*2(3+a)-(3(a-2b-3+5)))|c
==> 16c*a+48c-24a+48b-48|c

BUG  2020-12-26

>>  1-(a-3)/a
in> 1-(a-3)/a

out> -(a+3)/a+1

BUG  2020-12-26

>> x(x-1)(x-3)
in> x(x-1)(x-3)
>> function x() is not defined.

>> 2(x-1)(x-3)
in> 2(x-1)(x-3)

out> (x-1)*(x-3)

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

>> (x-1)(x-3)*2
in> (x-1)(x-3)*2

out> 2(x-3)

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

>> (x-1)2*(x-3)
in> (x-1)2*(x-3)

out> 2x-6

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

>> ()2*(x-3)
in> ()2*(x-3)

out> 2x-6

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

>> (x-1)(x+2)
in> (x-1)*(x+2)

out> x*x+2x-x-2

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