Opened 11 years ago

# solve misses some solutions in a certain nonlinear system

Reported by: Owned by: casamayou burcin major sage-6.4 calculus solve kcrisman, robert.marik, jason Reported upstream. No feedback yet. #12730

### Description

We search the critical points of the function x> (x2 + y2)x

This function has four critical points : ±(0,1) and ±(1/e,0)

However the function solve can not find any of this.

More, solve returns (0,0) which is not a critical point since f is not differentiable at (0,0) !

```  sage: var('x y')
sage: f(x,y) = (x^2 + y^2)^x
sage: solve([diff(f(x,y), x), diff(f(x,y), y)], x, y)
[[x == 0, y == 0]]
```

### comment:1 Changed 11 years ago by zimmerma

• Authors Alexandre Casamayou deleted
• Milestone changed from sage-4.4.2 to sage-4.4.1
• Priority changed from minor to major
• Type changed from enhancement to defect

### comment:2 Changed 11 years ago by burcin

• Cc kcrisman robert.marik jason added

What is the expected improvement in this ticket?

The `solve()` function in Sage is just a wrapper around maxima for now. In this case we just return the result from maxima.

There are two problems here:

• maxima's solve() cannot handle the given input, probably symbolic exponents defeat it
• maxima's solve() can return undefined points as output (#2617)

If this ticket is about improving the capabilities of solve to handle the given input properly, this is an enhancement request. Do we know of any algorithm that will help with this?

Otherwise, this ticket is a duplicate of #2617.

### comment:3 follow-up: ↓ 4 Changed 11 years ago by zimmerma

the issue here is not only that Sage returns undefined points (which indeed duplicates #2617) but that it fails to find the following (trivial) solutions, which is a defect:

```sage: sys=[diff(f(x,y), x), diff(f(x,y), y)]
sage: map(lambda s: s.subs(x=0,y=1),sys)
[0, 0]
sage: map(lambda s: s.subs(x=0,y=-1),sys)
[0, 0]
sage: map(lambda s: s.subs(x=1/e,y=0),sys)
[0, 0]
sage: map(lambda s: s.subs(x=-1/e,y=0),sys)
[0, 0]
```

For example Maple finds:

```> f := (x,y) -> (x^2 + y^2)^x:
> solve({diff(f(x,y), x), diff(f(x,y), y)}, {x, y}, Explicit=true);
exp(1)               exp(1)
{x = 0, y = 1}, {x = 0, y = -1}, {x = - ------, y = 0}, {x = ------, y = 0}
exp(2)               exp(2)
```

When some solutions are lost, at least a warning should be issued.

### comment:4 in reply to: ↑ 3 Changed 11 years ago by burcin

the issue here is not only that Sage returns undefined points (which indeed duplicates #2617) but that it fails to find the following (trivial) solutions, which is a defect:

<snip>

When some solutions are lost, at least a warning should be issued.

I don't think we can get that information out of maxima. Can someone more experienced in maxima comment on this? Or ask the maxima developers what they think about this problem?

Another option is to take this as an opportunity to start implementing some native `solve()` functionality in Sage. I have no idea how to (more or less algorithmically) find a solution to this system though. I'd appreciate any pointers.

### comment:5 Changed 10 years ago by kcrisman

• Report Upstream changed from N/A to Reported upstream. Little or no feedback.
• Summary changed from failing resolution of a nonlinear system by solve to solve misses some solutions in a certain nonlinear system
```Maxima 5.23.2 http://maxima.sourceforge.net
using Lisp ECL 11.1.1
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) solve([(2*x^2/(x^2 + y^2) + log(x^2 + y^2))*(x^2 + y^2)^x,2*x*y*(x^2 + y^2)^(x - 1)],[x,y]);
(%o1)                          [[x = 0, y = 0]]
```

So still present in 4.7.alpha1.

This is a pretty straightforward Maxima bug/enhancement need.

The issue about it not being a critical point is irrelevant, since this is exactly equivalent to the uninterpreted

```solve([(2*x^2/(x^2 + y^2) + log(x^2 + y^2))*(x^2 + y^2)^x,2*x*y*(x^2 + y^2)^(x - 1)],[x,y])
```

So the relevant problem is that it's returning something not in the domain of the functions in question, which is indeed a problem. In addition to not finding other solutions.

This is now Maxima bug 3216684.

### comment:6 Changed 9 years ago by roed

• Stopgaps set to #12730

### comment:7 Changed 8 years ago by roed

• Report Upstream changed from Reported upstream. Little or no feedback. to Reported upstream. No feedback yet.

### comment:8 Changed 7 years ago by jdemeyer

• Milestone changed from sage-5.11 to sage-5.12

### comment:9 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

### comment:10 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

### comment:11 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4

### comment:12 Changed 4 years ago by mafra

Just a random comment: sympy can solve this. I tested it in the 'live shell' in their webpage:

```solve([(x**2 + y**2)**x*(2*x**2/(x**2 + y**2) + log(x**2 + y**2)),2*(x**2 + y**2)**(x - 1)*x*y],x,y)
[(0,−1),(0,1),(−1/e,0),(1/e,0)]
```

(I edited the output because copy&paste mangled it).

It would be nice to have an 'algorithm=sympy' option to solve(). It seems that nobody is working in the Maxima bug.

Note: See TracTickets for help on using tickets.