asc-community / AngouriMath

New open-source cross-platform symbolic algebra library for C# and F#. Can be used for both production and research purposes.
https://am.angouri.org
MIT License
783 stars 74 forks source link

Equations cannot be solved #629

Open evolcano opened 8 months ago

evolcano commented 8 months ago

The version I use: AngouriMath 1.4.0 preview3

Unexpected behaviour or bug:

equation cann't resolve, the result in null:

{x (6049/100 - y) (1308/25) ^ z - 49/100 / 118000 = 0 x (6019/100 - y) (523/10) ^ z - 49/100 / 188000 = 0 x (5669/100 - y) (5231/100) ^ z - 12/25 / 126000 = 0}

{x (3491/100 - y) (1047/20) ^ z - 49/100 / 176000 = 0 x (1661/50 - y) (1308/25) ^ z - 12/25 / 110000 = 0 x (4099/100 - y) (1308/25) ^ z - 12/25 / 109000 = 0}

{x (2553/50 - y) (6151/100) ^ z - 49/100 / 107000 = 0 x (4537/100 - y) (1553/25) ^ z - 1/10 / 45000 = 0 x (4329/100 - y) (1243/20) ^ z - 1/4 / 63000 = 0}

PS: scipy can resolve in python:

from scipy.optimize import fsolve

def equations(variables):
    x, y, z = variables
    eq1 = x * (6049/100 - y) * (1308/25) ** z - 49/100 / 118000
    eq2 = x * (6019/100 - y) * (523/10) ** z - 49/100 / 188000
    eq3 = x * (5669/100 - y) * (5231/100) ** z - 12/25 / 126000
    return [eq1, eq2, eq3]

x, y, z = fsolve(equations, (1, 1, 1))

print("Solution: x =", x, ", y =", y, ", z =", z)

result: x = 3.664588487257544e-09 y = -3.7470438531594783 z = 0.677872451234604

WhiteBlackGoose commented 8 months ago

is the second argument of fsolve - the right column? If so, AM assumes it to be (0, 0, 0), so you need to subtract that number from the left expression

evolcano commented 8 months ago

@WhiteBlackGoose The right column is 0, it is no necessary to suntract. Thanks!