categories - Category Theory list
 help / color / mirror / Atom feed
* Fwd: Mathematica and CAS
@ 2005-11-29 16:51 jean benabou
  2005-12-01 23:44 ` Andrej Bauer
  0 siblings, 1 reply; 2+ messages in thread
From: jean benabou @ 2005-11-29 16:51 UTC (permalink / raw)
  To: Categories

As I know nothing about Computer Algebra Systems, but was surprised by 
examples given by Andrej Bauer on the Category list of limits that 
Mathematica gets wrong, I forwarded his mail to a computer scientist 
friend of mine, specialist of Mathematca, asking for her opinion.

She wrote the following answer, where she disagrees with Bauer, and 
asked me to forward it to the Category list as she would like to know 
the reaction of some "experts" to her statements. To tell the truth, so 
do I.

Cordially to all,

Jean Benabou

Début du message réexpédié :

> De: Jacqueline Zizi <jazi@club-internet.fr>
> Date: Ven 25 nov 2005  11:12:03 Europe/Paris
> À: Jean  Bénabou <jean.benabou@wanadoo.fr>
> Objet: Mathematica and CAS
>
> Thanks, Jean, for forwarding me some exchanges about Mathematica.
>
> Please find below my opinion. If you think that it might bring some 
> light, please feel free to forward it to the discussion list  
> "categories".
>
>
> A) Andrej Bauer points out very interesting questions, but I think he 
> is wrong:
> ===========================================================
>
> The interesting questions are:
> 1) Symbolic systems and students fall in the same trap;
> 2) People trust blindly computer results obtained via computers (not 
> only using CAS);
> 3) Utilization of scientific results by politic or technical people 
> without checking the results could be very dangerous;
>
> But I have the impression that Andrej himself falls in the trap. And 
> especially when he says that :
>
> " I guess I am trying to point out that current Computer Alegbra 
> Systems are very tricky to use_correctly"
>
> Indeed CAS are very complex systems built over several thousands of 
> functions, called primitive. CAS are NOT only tools and moreover they 
> are NOT global closed tools. They live like a science. Improving all 
> the time. Growing all the time.
>
> Each of the functions of a CAS has it's own rules of application. And 
> exactly as in Mathematics you can't use a theorem if some of the 
> hypothesis are not satisfied,  you can't use properly a function in a 
> CAS if you are not inside the limits of application of this primitive. 
> The rules for application of the primitives are clearly given in 
> Mathematica, in the "Help" menu. For example,  I put a screen shot for 
> the primitive "Limit" as EXAMPLE 1, at this address:
>
> http://homepage.mac.com/jacquelinezizi/CategoriesQA/
>
> As you can see in this screen  shot it is written : "Limit by default 
> makes no explicit assumptions about symbolic functions" . That clearly 
> means that you can't hope any discussion about the symbol  "a"  of the 
> Andrej's limit.
>
> Nevertheless the solution of this limit can be easily done and 
> discussed using Mathematica as you can see  in the EXAMPLE 2, at the 
> same address.
>
> But this does not mean at all that Mathematica is not able to deal 
> with parameters,  as we are going to see.
>
>
>
> B) Jacques Carette said:
> ===================
> "Engineers and physicists don't use CAS - they use Matlab. The errors 
> you get there are both worse and better: worse because numerical 
> algorithms are so much more prone to giving (silent) nonsense, and 
> better because Matlab cannot phrase any problems which are parametric! 
> "
>
> I agree with that. For example, in all numerical systems, the Integers 
> are limited, depending on the machine you work on. That is not the 
> case in CAS were Integers are as large as you want, like in 
> Mathematics. This is important as it produces sometimes hidden 
> mistakes in embedded computations, that lead to a wrong result.
>
> Now, I must say that  I don't agree with what Jacques Carette says in 
> the following paragraph about people developing CAS:
>
> "This is exactly the kind of parameter specialization problem where 
> CAS designers have "chosen" to ignore and return a generic answer. 
> This has been documented since at least 1991 in a nice paper in the 
> Bulletin of the AMS"
>
> For example, Mathematica has been giving results, for quite  a few 
> years now, using "Assumptions" for some primitives.  I give an example 
> for the primitive  " Integral" in EXAMPLE 3 at the same address. You 
> can see, on this example, that Mathematica deals quite well with 
> parameters, both for questions AND answers. Better than I can do...
>
>
>  Conclusion
> ==========
> Happily there are more and more people working hard and well in CAS 
> theory! The problems that they cannot solve, just as in Mathematics, 
> are infinite. But as Mathematics, Mathematica can already solve, to 
> day, quite a lot... This has very little to do with specific numerical 
> tools programmed  for specific aims.
>
>
> Jacqueline Zizi
>



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fwd: Mathematica and CAS
  2005-11-29 16:51 Fwd: Mathematica and CAS jean benabou
@ 2005-12-01 23:44 ` Andrej Bauer
  0 siblings, 0 replies; 2+ messages in thread
From: Andrej Bauer @ 2005-12-01 23:44 UTC (permalink / raw)
  To: Categories

[note from moderator: the poster is right, this discussion is not relevant
to this list, and this final post is allowed as a response to the previous
post only.]

I feel guilty about prolonging a discussion which is not related to
categories. If the moderator thinks we should take it off line, we can
do so (see the end of this posting). But since the last message was
public and it asked for a reaction, I will reply in the same fashion.

Thank you to Jean Benabou for posting the message by Jacqueline Zizi. I
would like to make a couple of remarks.

First of all, I want it to be clear that Jacqueline and I are on the
same side. I am a big fan of Computer Algebra Systems (CAS). I promote
them at our department and I teach my students how to use them to solve
problems they meet in analysis and algebra. I show them examples from
their analysis class which their teacher solved incorrectly but
Mathematica gets them right.

I shall now also teach them how to compute the limit correctly, thanks
to Jacqueline's suggestion. By the way, there is no need to compute the
power expansion of numerator and denominator separately. You can just
compute Series[...] of the whole thing:

In[42] := Series[((1 + 4*x^2)^(1/4) - (1 + 5*x^2)^(1/5))/
  (a^(-x^2/2) - Cos[x]), {x, 0, 4}] // Simplify

Out[42] = x^2/(1 - Log[a]) + (...) x^4 + O[x^5]

You see immediately that things go wrong when Log[a] = 1 ...

>> But I have the impression that Andrej himself falls in the trap.

I fail to see how I fall in _the_ trap, i.e., that I make the same sort
of mistakes as students and CAS. I surely hope I do not :-) Perhaps, it
was meant that I just made a mistake when I stated:

>> And especially when he says that :
>> " I guess I am trying to point out that current Computer Alegbra
>> Systems are very tricky to use_correctly"

This is an observation about user experience, namely that one cannot
trust CAS 100% without having a lot of expert knowledge about it. You
may have a different experience, but mine is as stated.

I find most of Jacqueline's comments to be explanations about why CAS
are not 100% mathematically correct all the time: they are complex, they
grow with time, etc. This is all true and well, and I am NOT saying that
any CAS which is not 100% correct all the time should be eliminated from
the face of the Earth.

However, I do take issue with the fact that CAS are presented in a
dishonest way. A typical CAS demo does not show you that things can go
wrong. The documentation does NOT state clearly the conditions under
which builtin functions may be used, contrary to what Jacqueline says:

>> The rules for application of the primitives are
>> clearly given in Mathematica, in the "Help" menu.

You make it sound as if a user who reads the help menu for "Limit" will
know that free parameters may sometimes lead to errors. Here is the
complete text of help:

--------
Limit

Limit[expr, x->x_0] finds the limiting value of expr when x approaches x_0.

* Example: Limit[Sin[x]/x, x->0] --> 1.
* Limit[expr, x->x_0, Direction -> 1] computes the limit as x approaches
x_0 from smaller values.
* Limit[expr, x->x_0, Direction -> -1] computes the limit as x
approaches x_0 from larger values.
* Limit returns Interval objects to represent ranges of possible values,
for example at essential singularities.
* Limit returns unevaluated when it encounters functions about which it
has no specific information. Limit therefore makes no explicit
assumptions about symbolic functions.
* See The Mathematica Book: Section 1.5.10 and Section 3.6.8.
* See also: Series, Residue.
* Related package: NumericalMath`NLimit`.
---------

I let the readers judge whether "Limit therefore makes no explicit
assumptions about symbolic functions" makes it clear that using
parameters in limits can cause wrong answers. Additionally, there is no
hint whatsoever that Mathematica will apply l'Hospital rule (or
something equivalent) without checking the side condition for it.

The reason why conditions of correct usage are not stated clearly is
simple: nobody knows them. CAS are so complex and so liberal about which
rule gets applied when that it is next to impossible to write down
precisely when they will work correctly.

I understand that CAS are complex and that we would get nowhere if we
worried about correctness all the time. But the makers of CAS should be
honest about this: CAS do NOT state clearly the conditions under which
they work correctly, therefore it is difficult to know whether they have
given a correct answer. Jacqueline herself wonders about correctness of
the results she gets in her third example at
http://homepage.mac.com/jacquelinezizi/CategoriesQA/.

It is an open problem, as far I can tell, to create a powerful CAS with
perfect control of correctness.

I suggest that we take further discussion off the categories list. One
possible forum is my blog at http://math.andrej.com, where I posted
further examples of how Mathematica gets things wrong at

  http://math.andrej.com/2005/12/02/design-of-computer-algebra-systems/

Andrej Bauer





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-01 23:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-29 16:51 Fwd: Mathematica and CAS jean benabou
2005-12-01 23:44 ` Andrej Bauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).