?There is no convenient way of telling Maxima that it should consider only real numbers . . .?
Inconvenience is not an excuse. On a related issue. It is complete inexcusable that Maxima does not know that integrate(x,x) = x^2/2+C. Maxima always forgets to add the C.
I can live with it working that way.
Rich
From: Richard Fateman
Sent: Friday, February 11, 2011 4:28 PM
To: Gary Pajer
Cc: Maxima - list
Subject: Re: [Maxima] sqrt(x)*sqrt(x)
On 2/11/2011 12:47 PM, Gary Pajer wrote:
On Fri, Feb 11, 2011 at 2:51 PM, Richard Fateman <fateman at eecs.berkeley.edu> wrote:
On 2/11/2011 10:26 AM, Gary Pajer wrote:
On Fri, Feb 11, 2011 at 10:10 AM, Richard Fateman <fateman at eecs.berkeley.edu> wrote:
...
It seems hopeless to point out that x>0 does not mean that sqrt(x)>0, mathematically.
There are 2 square roots. For example sqrt(16) is {-4, 4}, even though 16>0.
Perhaps that is true maxima-tically.
No, there are 2 square roots of 16, mathematically. Maxima chooses one of them, 4,
and thus it is not true maxima-tically that there are 2 roots.
And perhaps 16 has two real roots.
There is nothing "perhaps" about it, unless you do not believe in negative numbers.
S^2-16=0 defines the value(s) for S, corresponding to the square root of 16.
By some obscure theorem, the so-called "fundamental theorem of algebra" there are 2 roots.
But as a mathematical *function* sqrt(16) = +4.
Nope. You mean "as a program written by one or more people, the conjunction of
circumstances leads the Maxima system to return 4 when you type sqrt(16)." Your
statement probably misuses at least one technical term, and maybe three.
"mathematical" "function" and maybe "sqrt".
You are probably not aware, but every response you have written has been very rude. Seek professional help.
Very rude? I would have thought merely somewhat rude, perhaps abrupt.
Recall that the OP specifically says that he is restricting consideration to real numbers.
Well, that is in the OP's mind. There is no convenient way of telling Maxima that it should
consider only real numbers. I suppose one could go through the system and every place
it might consider generating a complex or imaginary constant that it should produce
an error message. This would still not make the system halt when it was, in some sense,
considering results that MIGHT not be real, but MIGHT not be.
for example, in solving a quadratic a*x^2+b*x+c, the solve program would have to
consider the sign of b^2-4*a*c. Given that a,b,c are unknown, it is not possible to
tell if this quadratic has real roots or not. Therefore how can one instruct Maxima to
"restrict your consideration to real numbers"?
So for him, x<0 is not in the domain of the function he or she wants (or perhaps it's not in the domain of the function he or she expects).
Well, then that is a consideration that he (or she) must impose in some other fashion than saying
assume(x>0).
A real mathematical function must be single valued.
That would be part of the usual definition. There's usually a domain and range.
To construct a proper function that we can call "square root", we choose by convention the "principle square root", the positive number.
Sure. That defines sqrt of a particular non-negative real. It does not deal with sqrt(<some symbolic expression>). Since Maxima
allows one to type sqrt(x^2-1) and manipulate it, what is the relationship of that expression with the sqrt function from R+ to R+?
Hence in many cases we tend to write \pm\sqrt{16}, where \sqrt{16} is a positive number, but the negative of that number will work just as well for whatever we are doing. Also, it's not defined for x<0.
Most people beyond high school would find the extension of sqrt to negative numbers to be unremarkable, and useful.
Without extending sqrt to symbols, a computer algebra system would be fairly weak.
And the OP has questions...
I'll agree: the word "function" has slightly different meanings in computer science, math, maxima, and even physics.
Quite different. to a Fortran programmer, a function is a subroutine that returns a value. To a "functional programming"
fan, it means something else.
A useful response is to recognize that there can be confusion and misinterpretation, and help to straighten out the difficulties of interpretation.
Well, there are at least 2 ways of doing that. 1. Fixing the program to do the right thing, if that can be determined.
2. Educating the user so that he/she can understand how to pose his/her question in an unambiguous fashion.
Sage has an alternate CAS, doesn't it?
Actually, it calls Maxima for bunches of things.
And it has lots of "rings".
Some of the other systems Sage also includes are more specific about algebraic structures, yes.
I wonder if sqrt has the desired/expected behavior over the ring of reals?
Well, the reals form a FIELD not a RING. They are also, in general, not computable.
We could talk about the field of rational numbers, perhaps more explicitly. Or the representable
floating point numbers, but they are not quite a field. And what Sage does, I think, is
punt to whatever semantics are available in the programs that it calls, and that means
that it is difficult to assign particular meanings to some of its answers, even apparently
easy ones. Like is there a difference between 2 and 2/1 ? Yes, if one is an integer and
the other is a rational.
But that is not the issue here. sqrt(x^2-1) is not sqrt of a real. Even if x is declared to be
real, x^2-1 is still an expression in the indeterminate x, and IS NOT A REAL.
For example one could
ask here, if sqrt(x^2-1) = sqrt(x-1)*sqrt(x+1) ?
Sometimes? Always? how does assume(x>0) affect this, if at all?
The computer programming term "function" in common usage does not correspond really to
the mathematical concept "function" except superficially.
Why am I bothering to comment on this?
Because failing to make such distinctions leads to
subtle but very bad consequences, even though it may seem harmless enough for the
moment.
Again.
RJF
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
--------------------------------------------------------------------------------
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima