Re: [sage-devel] Request for comments: add a "domain=" option to symbolic integration methods/functions

2019-11-30 Thread Emmanuel Charpentier


Le dimanche 1 décembre 2019 00:16:24 UTC+1, Thierry (sage-googlesucks@xxx) 
a écrit :
>
> Hi, 
>
> On Fri, Nov 29, 2019 at 04:41:20PM -0800, rjf wrote: 
> > I mentioned in answer to another thread about Maxima/domain/integration 
> > the caution that this is likely missing the point. 
> > Setting a domain or passing this setting to Maxima is not a solution. 
> > It is likely a symptom that you are making a mathematical error. 
> > 
> > quoting in part.. 
> > 
> > Since log() is in general multivalued, any answer that 
> > ignores this possibility may fall into a trap.  Setting a domain 
> > to something or other does not necessarily avoid the trap. 
> > An example that is simpler and perhaps reminiscent of this 
> > kind of error is to assert that   sqrt(x^2) is x  or abs(x), when 
> > YOU KNOW there are UNDENIABLY (except if x=0)  TWO square roots,  x, -x. 
> > Even if you know that x is positive,  there are still two 
> > square roots. sqrt(9) has 2 values. 
> > 
> >   Unless you want 
> > to define sqrt as something else. .. 
> > 
> >  end quote.. 
> > 
> > Maybe as another illustration of how blunt an instrument is 
> > the "domain" declaration, consider  that you have computed 
> > a value for s, which is supposed to be 1, but because of a 
> > numerical roundoff, comes out as 0.9... 
> > computing z :=sqrt(s-1), which should be 0, turns out to be 
> > complex.   What do you really want to do?   Are you OK 
> > with computing w:= z-z  which is real, but whose computation 
> > wandered very slightly into the complex domain? 
> > 
> > 
> > The use of declarations for integration results is probably 
> > an attempt to react to naivety or stubbornness based 
> > on "if my freshman calculus teacher said XXX and you 
> > said YYY  then you are wrong".  Leading to (for example) 
> > spewing out log (abs(...))  instead of log(...), and other 
> mathematically 
> > logically subtle errors caused by the complaint,  "But I haven't learned 
> > about 
> > sqrt(-1) so that can't occur in the answer to any questions 
> > that I ask." 
> > 
> > Perspective:  you can diddle with trying to set domains 
> > "right" but you have probably missed the boat in the 
> > system design and are unlikely to be able to patch it. 
> > This issue was sort of understood in, roughly, 1974 
> > by the people working on Macsyma, who figured there 
> > was not the time or money and maybe not the smarts 
> > to do a new design.  Mostly subsequently, other systems 
> > were built that more-or-less duplicated the design that 
> > we thought was not going to work.  It is possible, even likely, to 
> > design a system that works just fine for algebra, but 
> > doesn't work for complex analysis.  (just look up the 
> > grad course in your college catalog and see if you can 
> > do the homework problems using Sage.) 
>
> In case someone would like to give a try, could you please provide some 
> details of what would have been a good design ? 
>

I am afraid that what rjf points to is that we should redesign calculus (or 
even analysis...). and the worst is that he may be right:

The counterexample pointed in the ticket is that (long story short) 
log(-x)==log(x*-1))==log(x)+log(-1)==log(x) + some integration constant, 
which might well be log(i*pi). This is horribly contrerintuitive, but makes 
sense  in our (at leas my) understanding of the calculus.

Which may well mean that this understanding has to be corrected. But we're 
no longer talking software, but mathematics... *way* over my pay grade !
 

>
> Ciao, 
> Thierry 
>
>
> > Sorry for being such a pessimist, but some of us have 
> > been there. 
> > 
> > Regards 
> > 
> > RJF 
> > 
> > 
> > On Friday, November 29, 2019 at 3:46:59 PM UTC-8, Michael Orlitzky 
> wrote: 
> > > 
> > > On 11/29/19 2:01 PM, Emmanuel Charpentier wrote: 
> > > > Dear list, 
> > > > 
> > > > We have a non inconsiderable stock of tickets whose analysis ends up 
> > > > with someting amounting to "bug due the domain:complex option in 
> > > > Maxima", and no solution in view. 
> > > 
> > > Which tickets? Are they all integration? 
> > > 
> > > 
> > > > Couldn't we work around this problem by offering a "domain=" option 
> > > > (default value =complex") which, when set, would wrap the call to 
> > > > Maxima's library in a pair of Maxima statements setting 
> (temporarily) 
> > > > "domain:real" ? A "try: ... except: ... finally:..." statement would 
> > > > probably be the right way to do it. 
> > > > 
> > > 
> > > I added Expression.simplify_real() to do this during simplification, 
> so 
> > > the sketchy domain-twiddling code is there for the taking. 
> > > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/ffe89d32-d461-4

Re: [sage-devel] Request for comments: add a "domain=" option to symbolic integration methods/functions

2019-11-30 Thread Thierry
Hi,

On Fri, Nov 29, 2019 at 04:41:20PM -0800, rjf wrote:
> I mentioned in answer to another thread about Maxima/domain/integration
> the caution that this is likely missing the point.
> Setting a domain or passing this setting to Maxima is not a solution.
> It is likely a symptom that you are making a mathematical error.
> 
> quoting in part..
> 
> Since log() is in general multivalued, any answer that
> ignores this possibility may fall into a trap.  Setting a domain
> to something or other does not necessarily avoid the trap.
> An example that is simpler and perhaps reminiscent of this
> kind of error is to assert that   sqrt(x^2) is x  or abs(x), when
> YOU KNOW there are UNDENIABLY (except if x=0)  TWO square roots,  x, -x.
> Even if you know that x is positive,  there are still two
> square roots. sqrt(9) has 2 values.
> 
>   Unless you want
> to define sqrt as something else. ..
> 
>  end quote..
> 
> Maybe as another illustration of how blunt an instrument is
> the "domain" declaration, consider  that you have computed
> a value for s, which is supposed to be 1, but because of a
> numerical roundoff, comes out as 0.9...
> computing z :=sqrt(s-1), which should be 0, turns out to be
> complex.   What do you really want to do?   Are you OK
> with computing w:= z-z  which is real, but whose computation
> wandered very slightly into the complex domain?
> 
> 
> The use of declarations for integration results is probably
> an attempt to react to naivety or stubbornness based
> on "if my freshman calculus teacher said XXX and you
> said YYY  then you are wrong".  Leading to (for example)
> spewing out log (abs(...))  instead of log(...), and other mathematically
> logically subtle errors caused by the complaint,  "But I haven't learned 
> about
> sqrt(-1) so that can't occur in the answer to any questions
> that I ask."
> 
> Perspective:  you can diddle with trying to set domains
> "right" but you have probably missed the boat in the
> system design and are unlikely to be able to patch it.
> This issue was sort of understood in, roughly, 1974
> by the people working on Macsyma, who figured there
> was not the time or money and maybe not the smarts
> to do a new design.  Mostly subsequently, other systems
> were built that more-or-less duplicated the design that
> we thought was not going to work.  It is possible, even likely, to
> design a system that works just fine for algebra, but
> doesn't work for complex analysis.  (just look up the
> grad course in your college catalog and see if you can
> do the homework problems using Sage.)

In case someone would like to give a try, could you please provide some
details of what would have been a good design ?

Ciao,
Thierry


> Sorry for being such a pessimist, but some of us have
> been there.
> 
> Regards
> 
> RJF
> 
> 
> On Friday, November 29, 2019 at 3:46:59 PM UTC-8, Michael Orlitzky wrote:
> >
> > On 11/29/19 2:01 PM, Emmanuel Charpentier wrote: 
> > > Dear list, 
> > > 
> > > We have a non inconsiderable stock of tickets whose analysis ends up 
> > > with someting amounting to "bug due the domain:complex option in 
> > > Maxima", and no solution in view. 
> >
> > Which tickets? Are they all integration? 
> >
> >
> > > Couldn't we work around this problem by offering a "domain=" option 
> > > (default value =complex") which, when set, would wrap the call to 
> > > Maxima's library in a pair of Maxima statements setting (temporarily) 
> > > "domain:real" ? A "try: ... except: ... finally:..." statement would 
> > > probably be the right way to do it. 
> > > 
> >
> > I added Expression.simplify_real() to do this during simplification, so 
> > the sketchy domain-twiddling code is there for the taking. 
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/ffe89d32-d461-44ee-8e86-03b8c0efa5a1%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/20191130231620.ahk7vxkjvth2wfly%40metelu.net.


Re: [sage-devel] Request for comments: add a "domain=" option to symbolic integration methods/functions

2019-11-29 Thread rjf
If you have a design for writing the whole thing
from scratch, then that would be worth writing down.

It is not that Sage has to be fixed to call Maxima "the right way".
It is that Macsyma / Maxima does not have a suitable
design.  Nor does Mathematica or Maple or (so far
as I can tell) sympy or FriCAS/Axiom or ...

Can Sage "do it right"  on top of one of these systems?
Maybe, but not without a correct design.  
RJF


On Friday, November 29, 2019 at 5:23:45 PM UTC-8, Michael Orlitzky wrote:
>
> On 11/29/19 7:41 PM, rjf wrote: 
> > 
> > Perspective:  you can diddle with trying to set domains 
> > "right" but you have probably missed the boat in the 
> > system design and are unlikely to be able to patch it. 
> > ... 
> > 
> > Sorry for being such a pessimist, but some of us have 
> > been there. 
> > 
>
> There is no diddle-free option. Maxima defaults to using the real 
> domain, so your options are to diddle it the other way, or to perform 
> the identity diddle. I don't disagree with you, but -- in lieu of 
> rewriting the whole thing from scratch -- it's sometimes nice to be able 
> to specify that you want the other kind of problems right now. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/5958bc10-a9b2-45dd-a007-5a872d89d01f%40googlegroups.com.


Re: [sage-devel] Request for comments: add a "domain=" option to symbolic integration methods/functions

2019-11-29 Thread Michael Orlitzky
On 11/29/19 7:41 PM, rjf wrote:
> 
> Perspective:  you can diddle with trying to set domains
> "right" but you have probably missed the boat in the
> system design and are unlikely to be able to patch it.
> ...
> 
> Sorry for being such a pessimist, but some of us have
> been there.
> 

There is no diddle-free option. Maxima defaults to using the real
domain, so your options are to diddle it the other way, or to perform
the identity diddle. I don't disagree with you, but -- in lieu of
rewriting the whole thing from scratch -- it's sometimes nice to be able
to specify that you want the other kind of problems right now.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/e77cdb7e-2a60-48e2-a65a-021c85517a87%40orlitzky.com.


Re: [sage-devel] Request for comments: add a "domain=" option to symbolic integration methods/functions

2019-11-29 Thread rjf
I mentioned in answer to another thread about Maxima/domain/integration
the caution that this is likely missing the point.
Setting a domain or passing this setting to Maxima is not a solution.
It is likely a symptom that you are making a mathematical error.

quoting in part..

Since log() is in general multivalued, any answer that
ignores this possibility may fall into a trap.  Setting a domain
to something or other does not necessarily avoid the trap.
An example that is simpler and perhaps reminiscent of this
kind of error is to assert that   sqrt(x^2) is x  or abs(x), when
YOU KNOW there are UNDENIABLY (except if x=0)  TWO square roots,  x, -x.
Even if you know that x is positive,  there are still two
square roots. sqrt(9) has 2 values.

  Unless you want
to define sqrt as something else. ..

 end quote..

Maybe as another illustration of how blunt an instrument is
the "domain" declaration, consider  that you have computed
a value for s, which is supposed to be 1, but because of a
numerical roundoff, comes out as 0.9...
computing z :=sqrt(s-1), which should be 0, turns out to be
complex.   What do you really want to do?   Are you OK
with computing w:= z-z  which is real, but whose computation
wandered very slightly into the complex domain?


The use of declarations for integration results is probably
an attempt to react to naivety or stubbornness based
on "if my freshman calculus teacher said XXX and you
said YYY  then you are wrong".  Leading to (for example)
spewing out log (abs(...))  instead of log(...), and other mathematically
logically subtle errors caused by the complaint,  "But I haven't learned 
about
sqrt(-1) so that can't occur in the answer to any questions
that I ask."

Perspective:  you can diddle with trying to set domains
"right" but you have probably missed the boat in the
system design and are unlikely to be able to patch it.
This issue was sort of understood in, roughly, 1974
by the people working on Macsyma, who figured there
was not the time or money and maybe not the smarts
to do a new design.  Mostly subsequently, other systems
were built that more-or-less duplicated the design that
we thought was not going to work.  It is possible, even likely, to
design a system that works just fine for algebra, but
doesn't work for complex analysis.  (just look up the
grad course in your college catalog and see if you can
do the homework problems using Sage.)

Sorry for being such a pessimist, but some of us have
been there.

Regards

RJF


On Friday, November 29, 2019 at 3:46:59 PM UTC-8, Michael Orlitzky wrote:
>
> On 11/29/19 2:01 PM, Emmanuel Charpentier wrote: 
> > Dear list, 
> > 
> > We have a non inconsiderable stock of tickets whose analysis ends up 
> > with someting amounting to "bug due the domain:complex option in 
> > Maxima", and no solution in view. 
>
> Which tickets? Are they all integration? 
>
>
> > Couldn't we work around this problem by offering a "domain=" option 
> > (default value =complex") which, when set, would wrap the call to 
> > Maxima's library in a pair of Maxima statements setting (temporarily) 
> > "domain:real" ? A "try: ... except: ... finally:..." statement would 
> > probably be the right way to do it. 
> > 
>
> I added Expression.simplify_real() to do this during simplification, so 
> the sketchy domain-twiddling code is there for the taking. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/ffe89d32-d461-44ee-8e86-03b8c0efa5a1%40googlegroups.com.


Re: [sage-devel] Request for comments: add a "domain=" option to symbolic integration methods/functions

2019-11-29 Thread Michael Orlitzky
On 11/29/19 2:01 PM, Emmanuel Charpentier wrote:
> Dear list,
> 
> We have a non inconsiderable stock of tickets whose analysis ends up
> with someting amounting to "bug due the domain:complex option in
> Maxima", and no solution in view.

Which tickets? Are they all integration?


> Couldn't we work around this problem by offering a "domain=" option
> (default value =complex") which, when set, would wrap the call to
> Maxima's library in a pair of Maxima statements setting (temporarily)
> "domain:real" ? A "try: ... except: ... finally:..." statement would
> probably be the right way to do it.
> 

I added Expression.simplify_real() to do this during simplification, so
the sketchy domain-twiddling code is there for the taking.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/1752bdaa-b548-8a6b-b8d2-61fa9b2dd19e%40orlitzky.com.