Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

Weird solve() problem

asked 7 years ago

zhoraster gravatar image

updated 7 years ago

I try to solve the equation a2+b2+2a2b2=c2 in integers. Using

 var('a,b,c')
assume(a,'integer')
assume(b,'integer')
assume(c,'integer')
solve([a^2 + b^2 + 2*a^2*b^2 == c^2],[a,b,c],solution_dict=True)

gives Pythagorean triples:

{c: t1^2 + t2^2, b: 2*t1*t2, a: t1^2 - t2^2}

which clearly do not satisfy the equation (unless t1=t2 or t2t2=0). It seems that solve() does not see the term 2a2b2; trying

solve([a^2 + b^2 + 2222*a^2*b^2 == c^2],[a,b,c],solution_dict=True)

gives the same (wrong) result.

UPDATE: The problem does not exist in the newest version (8.1).

Preview: (hide)

Comments

Could not reproduce the error:

After

sage: solve([a^2 + b^2 + 2*a^2*b^2 == c^2],[a,b,c],solution_dict=True)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
....
/usr/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
    996 
....

and many further lines, sage gives the reason for the error:

NotImplementedError: 
This equation is not yet recognized or else has not been simplified
sufficiently to put it in a form recognized by diop_classify().
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
sage:
dan_fulea gravatar imagedan_fulea ( 7 years ago )

I have version 8.0, so I'll update and check if the problem persists.

zhoraster gravatar imagezhoraster ( 7 years ago )

Yes, the same in 8.1. Thanks.

zhoraster gravatar imagezhoraster ( 7 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

tmonteil gravatar image

As for me, on 8.2.beta6, i got the same NotImplementedError as @dan_fulea. Without the assume statements, i got:

sage: var('a,b,c')
(a, b, c)
sage: solve([c c^2],[a,b,c],solution_dict=True)
[{a: r1, c: sqrt((2*r2^2 + 1)*r1^2 + r2^2), b: r2},
 {a: r3, c: -sqrt((2*r4^2 + 1)*r3^2 + r4^2), b: r4}]

which seems perfectly valid. That said, if you do not care about the integer nature of the solution, there is no benefit in using of a computer algebra system to solve such an equation since the variable c is isolated, it is clear that for each a and each b, there are two solutions sqrt(a^2 + b^2 + 2*a^2*b^2) and sqrt(a^2 + b^2 + 2*a^2*b^2).

The question is when a^2 + b^2 + 2*a^2*b^2) is a square. You can try to guess some pattern for the integer solutions as follows (try with size=10,100,1000,10000):

sage: from itertools import product
sage: p = product(range(size),range(size))
sage: L = []
sage: for a,b in p:
....:     if (a^2 + b^2 + 2*a^2*b^2).is_square():
....:         L.append((a,b))
sage: points(L, aspect_ratio=1)

Given those pictures, no obvious paterns seems to appear, and i would bet that there is no simple formula (like a fnite union of discrete hyperbolas or so) to describe such solution set.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 7 years ago

Seen: 1,093 times

Last updated: Mar 02 '18