[Date Index]
[Thread Index]
[Author Index]
Re: A Problem with Simplify
*To*: mathgroup at smc.vnet.net
*Subject*: [mg87501] Re: [mg87419] A Problem with Simplify
*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>
*Date*: Fri, 11 Apr 2008 05:58:32 -0400 (EDT)
*References*: <200804100612.CAA10423@smc.vnet.net> <4CB3309B-D747-450B-B790-C4784DD5719F@mimuw.edu.pl> <47FE0418.2000403@umbc.edu>
I am not convinced (by the way, this very question with the same
example was discussed here quite recently).
The usual argument is that Mathematica adopts a "generic" approach,
whatever that means. I don't much like this way of thinking because
such a concept of "genericity" is hard to formalize. Instead I have my
own way of thinking about this, which at least satisfies me on this
score. Essentially, I think of all Mathematica expressions as
belonging to some formal algebraic system, a "partial algebra" (you
can formally add and multiply most expressions although not quite all,
and you can even multiply then by "scalars"). There are certain "built
in" relations that hold between certain expressions in the algebra and
other relations can be introduced by the user. Any two different
symbols are always different, unless there is a built in relationship
or a user defined relationship that says otherwise. Hence the answer
returned by
Assuming[Element[m | n, Integers],
Simplify[Integrate[Sin[(m*Pi*x)/L]*Sin[(n*Pi*x)/L], {x, 0, L}]]]
0
is completely correct in my interpretation and not just "generically
correct" because in my interpretation m and n are not equal simply by
virtue of being different Mathematica expressions. On the other hand:
Assuming[Element[m | n, Integers] && m == n,
Simplify[Integrate[Sin[(m*Pi*x)/L]*Sin[(n*Pi*x)/L], {x, 0, L}]]]
L/2
is also O.K. because we performed the simplification with the user
introduced relation m==n.
So, with my interpretation (different symbols are always different
quantities unless stated otherwise) all is well.
Andrzej Kozlowski
On 10 Apr 2008, at 21:12, Kevin J. McCann wrote:
> Perhaps, but the answer returned is incorrect. Perhaps it would be
> better to return nothing?
>
> Kevin
>
> Andrzej Kozlowski wrote:
>> Simplify does not return conditional answers (in the form If[..])
>> and I don't think it would be reasonable to expect it to do so. The
>> reason is that unlike definite Integration (which does) Simplify is
>> frequently used as part of code for other functions (including
>> built in functions) and returning conditional answers could have a
>> dramatic impact on complexity and what's worse, would only make
>> sense if other functions also returned conditional answers (and
>> accepted conditional input). It just does not seem practical now or
>> in any foreseeable future.
>>
>> Andrzej Kozlowski
>>
>>
>> On 10 Apr 2008, at 15:12, Kevin J. McCann wrote:
>>> I have the following rather simple integral of two sines, which
>>> should
>>> evaluate to zero if m is not equal to n and to L/2 if they are the
>>> same.
>>>
>>> The following is just fine
>>>
>>> Imn = Simplify[Integrate[
>>> Sin[(m*Pi*x)/L]*
>>> Sin[(n*Pi*x)/L],
>>> {x, 0, L}]]
>>>
>>>
>>> However, if I specify that m and n are integers, I only get the
>>> "general" solution of zero, i.e. when m and n are not equal.
>>>
>>> Imn = Simplify[Integrate[
>>> Sin[(m*Pi*x)/L]*
>>> Sin[(n*Pi*x)/L],
>>> {x, 0, L}],
>>> Element[m, Integers] &&
>>> Element[n, Integers]]
>>>
>>> The workaround is obvious in this case, but shouldn't Mathematica give
>>> multiple
>>> answers? Perhaps something similar to what it already does with
>>> Integrate?
>>>
>>> Kevin
>>> --
>>>
>>> Kevin J. McCann
>>> Research Associate Professor
>>> JCET/Physics
>>> Physics Building
>>> University of Maryland, Baltimore County
>>> 1000 Hilltop Circle
>>> Baltimore, MD 21250
>>>
>>
>>
>>
>>
>
> --
>
> Kevin J. McCann
> Research Associate Professor
> JCET/Physics
> Physics Building
> University of Maryland, Baltimore County
> 1000 Hilltop Circle
> Baltimore, MD 21250
>
Prev by Date:
**Re: Intersection of lists of lists based on the first term**
Next by Date:
**Re: Problem for using "Epilog" to plot legend**
Previous by thread:
**Re: A Problem with Simplify**
Next by thread:
**Re: A Problem with Simplify**
| |