Issue with ticket number #29146

76 views
Skip to first unread message

Ashutosh Ahelleya

unread,
Mar 2, 2017, 10:57:11 PM3/2/17
to sage-support
Hello,

I am interested in solving the documentation error having ticket number #29146 but I have a doubt.

In the description of ticket number #29146 , I feel within the domain of x that is a real number the documentation is correct since the solution is shown up to be
"r1" which is a real number. In case the domain is over complex numbers too, what should be the appropriate symbol in place of "r1" to be used to fix this?

Thanks and Regards,
Ashutosh

Michael Orlitzky

unread,
Mar 3, 2017, 7:45:36 AM3/3/17
to sage-s...@googlegroups.com
On 03/02/2017 10:57 PM, Ashutosh Ahelleya wrote:
> Hello,
>
> I am interested in solving the documentation error having ticket number
> #29146 but I have a doubt.
>
> In the description of ticket number #29146
> <https://trac.sagemath.org/ticket/21946> , I feel within the domain of x
> that is a real number the documentation is correct since the solution is
> shown up to be
> "r1" which is a real number. In case the domain is over complex numbers
> too, what should be the appropriate symbol in place of "r1" to be used to
> fix this?
>

The symbol "z" is used for integers already, so that's out. I wonder if
any of our equation-solving backends ever return complex parameters...
on the other hand, the Maxima documentation doesn't say they're real:

The symbols %r are used to denote arbitrary constants in a solution[1].

So maybe it was an overstatement to say that the "r" parameters are
real, as far as Maxima is concerned. In any case, there is a special
branch in the code that handles the result of x == x,

if s == 'all':
if solution_dict:
ans = [ {x: self.parent().var('r1')} ]
else:
ans = [x == self.parent().var('r1')]
if multiplicities:
return ans,[]
else:
return ans

So you could update the documentation to say that the "r" parameters are
complex, or I guess you could try to add a new type of complex
parameter. If none of our backends ever return them, though, the latter
seems like overkill.


[1] http://maxima.sourceforge.net/docs/manual/maxima_20.html

Ashutosh Ahelleya

unread,
Mar 3, 2017, 8:32:36 AM3/3/17
to sage-support
Heyy,

 
The symbol "z" is used for integers already, so that's out. I wonder if
any of our equation-solving backends ever return complex parameters...
on the other hand, the Maxima documentation doesn't say they're real:

No. I guess the back end does return a complex parameter in cases where the answer is a complex solution. 
This might be an appropriate example:
{ { sage:
x = var('x')
eq = x^2 -3*x + 4
solve(eq,x)
[x == -1/2*I*sqrt(7) + 3/2, x == 1/2*I*sqrt(7) + 3/2]
} }
Here, in this example, the parameter used is 'I'. Since every real number can be represented in complex form, we have two options here to solve this problem:
  1. Just change the documentation and define 'r' to be a complex number.
  2. Go to the code which contains this and then add a new complex parameter.

I am ready to solve using any of the method which the developers think would be appropriate. I believe first option is short and feasible.


Thanks and Regards,

Ashutosh Ahelleya

Michael Orlitzky

unread,
Mar 4, 2017, 10:26:47 AM3/4/17
to sage-s...@googlegroups.com
On 03/03/2017 08:32 AM, Ashutosh Ahelleya wrote:
>
> No. I guess the back end does return a complex parameter in cases where the
> answer is a complex solution.
> This might be an appropriate example:
> { { sage:
> x = var('x')
> eq = x^2 -3*x + 4
> solve(eq,x)
> [x == -1/2*I*sqrt(7) + 3/2, x == 1/2*I*sqrt(7) + 3/2]
> } }
> Here, in this example, the parameter used is 'I'.

I was actually curious if Sage ever returns an arbitrary "r1" constant
to refer to a complex number. There is the special case where we turn
"all" into "r1", but there may not be any others.

If it's possible for "r1" to represent a complex number in any other
situation, then the correct course of action is clear: update the
documentation to say that "r1" is complex.

On the other hand, if "r1" is always real except in one specific case
(the "all" result), then maybe it makes more sense to leave the
documentation as-is, and return something else (c1?) for the "all" result.

Ashutosh Ahelleya

unread,
Mar 4, 2017, 10:41:20 AM3/4/17
to sage-s...@googlegroups.com
Heyy,

I want a confirmation for selecting an of the options above i.e. I add a new parameter signifying a complex number or I just change the documentation.


Regards,
Ashutosh


kcrisman

unread,
Mar 4, 2017, 5:09:05 PM3/4/17
to sage-support


On Saturday, March 4, 2017 at 10:41:20 AM UTC-5, Ashutosh Ahelleya wrote:
Heyy,

I want a confirmation for selecting an of the options above i.e. I add a new parameter signifying a complex number or I just change the documentation.



I am pretty sure that we shouldn't mess with Maxima arbitrarily to have solve's parameters be "complex" versus "real".  See http://maxima.sourceforge.net/docs/manual/maxima_20.html#IDX806 - "The symbols %r are used to denote arbitrary constants in a solution."  So perhaps one could just change the documentation to indicate it is an arbitrary constant in whatever field one is supposedly solving over.  OR you can ask on the Maxima list - perhaps that is the best option.  (Robert Dodier hangs out here too and may have some comments.)  I do think that they chose %r was for real (convenience, and %c is taken for an arbitrary integration constant).  See also http://maxima.sourceforge.net/docs/manual/maxima_20.html#g_t_0025rnum_005flist 

Ashutosh Ahelleya

unread,
Mar 5, 2017, 12:20:47 AM3/5/17
to sage-s...@googlegroups.com
Yea. That would be a better idea. In the worst case, I will just change the documentation.

Ashutosh Ahelleya

unread,
Mar 5, 2017, 12:43:34 AM3/5/17
to sage-support
I just forwarded this message in the maxima mailing list, so that we draw some significant conclusion of the type of constant used. 

---------- Forwarded message ----------
From: Ashutosh Ahelleya <ashutosh...@gmail.com>
Date: Sun, Mar 5, 2017 at 11:08 AM
Subject: Issue regarding the parameters returned while solving equations
To: maxima-...@lists.sourceforge.net


Hello,

In the solutions of equations solved, there are constants having unique alphabet assigned, and each one of them signifying the type of constant. While solving the equation:
solve(x==x,x)
A constant r1 is returned. I wanted to know if r1 is a constant reflecting a real number or complex number or it is just an arbitrary constant. After referring to the following links too, nothing significant could be concluded about the type of constant r1.

[1]http://maxima.sourceforge.net/docs/manual/maxima_20.html#g_t_0025rnum_005flist
[2] http://maxima.sourceforge.net/docs/manual/maxima_20.html#IDX806

Thanks and Regards, 
Reply all
Reply to author
Forward
0 new messages