Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

How to simplify "Integrate[2 f[x], {x, 0, 1}]/2" to "Integrate[f[x],

瀏覽次數:162 次
跳到第一則未讀訊息

Klaus Engel

未讀,
2010年4月16日 清晨5:53:262010/4/16
收件者:
Dear group,

I tried to simplify an awkward looking integral with "Mathematica 7"
using its "(Full)Simplify[...]" function. Unfortunately it failed to do
so, even though I know that this would be possible. I boiled down the
problem to the following very simple example ("f" is just a generic,
undefined function): The input

Integrate[2 f[x], {x, 0, 1}]/2 // FullSimplify

returns just the input

Integrate[2 f[x], {x, 0, 1}]/2

(same result for "Simplify" instead of "FullSimplify"), i.e.,
Mathematica seems not to be aware that the factor "2" can be canceled
out. Even worse, the expressions

TrueQ[Integrate[2 f[x], {x, 0, 1}]/2 == Integrate[f[x], {x, 0,
1}]]
SameQ[Integrate[2 f[x], {x, 0, 1}]/2 , Integrate[f[x], {x, 0, 1}]]
Integrate[2 f[x], {x, 0, 1}]/2 === Integrate[f[x], {x, 0, 1}]

return the (wrong) result "False".

So my question: Is there something I am overlooking, or what is the
right "Mathematica" way to treat expressions like the one above.

Thanks a lot in advance,

Klaus
------------

Klaus Engel <klaus.engel at tiscali.it>

David Park

未讀,
2010年4月17日 清晨6:04:152010/4/17
收件者:
I don't think you are overlooking anything. You could write specific
transformation rules.

But the Presentations package ($50) at my web site has a section called
Student's Integral that allows the manipulation of single variable integrals
before evaluation. It is mainly meant for teaching integration techniques,
but could also be used for derivations in notebooks. You can do breakout of
integrals, and also apply integration techniques such as performing
operations on the integrand, change of variable, integration by parts and
trigonometric substitution. After manipulation, integral can be evaluated
either from a BasicIntegralTable such as students might use, or by using the
built-in Mathematica commands. Or you could create your own integral table.
You might have some complicated integral that takes Mathematica a long time
to evaluate and needs manipulation to a specific form for your use. If you
put this in your own table it will subsequently evaluate very quickly in the
form you desire.

Another nice feature is that the Assumptions are only put in at the time you
evaluate so you can have a nice standard integral display during any
derivation.

In any case, for your example we use only a minimal feature. (Unevaluated
integrals are entered with integrate instead of Integrate. I can't paste the
box form of the results into an email, but just copy and paste into your
notebook.)

Needs["Presentations`Master`"]

1/2 integrate[2 f[x], {x, 0, 1}]
% // BreakoutIntegral

1/2 \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(1\)]\(\(2\ f[x]\)
\[DifferentialD]x\)\)
\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(1\)]\(f[x]
\[DifferentialD]x\)\)


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/

Bill Rowe

未讀,
2010年4月17日 清晨6:04:372010/4/17
收件者:
On 4/16/10 at 5:53 AM, klaus...@tiscali.it (Klaus Engel) wrote:

>I tried to simplify an awkward looking integral with "Mathematica 7"
>using its "(Full)Simplify[...]" function. Unfortunately it failed to
>do so, even though I know that this would be possible. I boiled down
>the problem to the following very simple example ("f" is just a
>generic, undefined function): The input

>Integrate[2 f[x], {x, 0, 1}]/2 // FullSimplify

>returns just the input

>Integrate[2 f[x], {x, 0, 1}]/2

The problem is f is undefined. Consequently, Integrate[2 f...]
is returned unevaluated and neither FullSimplify nor Simplify
can do anything further with the unevaluated result.

>TrueQ[Integrate[2 f[x], {x, 0, 1}]/2 == Integrate[f[x], {x, 0, 1}]]

This will return False for the same reason FullSimplify and
Simplify fail to work

>SameQ[Integrate[2 f[x], {x, 0, 1}]/2 , Integrate[f[x], {x, 0, 1}]]
>Integrate[2 f[x], {x, 0, 1}]/2 === Integrate[f[x], {x, 0, 1}]

Both of these should return False since the left hand side and
right hand side are not identical. SameQ tests whether things
are identical which is not the same as being mathematically equal.

>So my question: Is there something I am overlooking, or what is the
>right "Mathematica" way to treat expressions like the one above.

As far as I know, there isn't anyway to do exactly what you are
asking. What you are asking is for Mathematica to partially
evaluate something it cannot fully evaluate. And it seems
currently something can either be evaluated or not, i.e., no
allowance for partial evaluation.

You could do something like:

In[5]:= Integrate[2 f[x], {x, 0, 1}]/2 /.
Integrate[a_?NumericQ b_, c_] :> a Integrate[b, c]

Out[5]= Integrate[f[x], {x, 0, 1}]

But this type of transform really isn't doing mathematics and
could break in some future version. It relies on the way Times
orders its arguments. And note restricting the pattern matching
to numeric arguments is essential since

In[6]:= Integrate[ x f[x], {x, 0, 1}]/x /.
Integrate[a_ b_, c_] :> a Integrate[b, c]

Out[6]= Integrate[f[x], {x, 0, 1}]

produces a result that is not generally mathematically valid.


Andreas Hinze

未讀,
2010年4月17日 清晨6:04:582010/4/17
收件者:
Hi Klaus

Klaus Engel schrieb:
> ... The input


>
> Integrate[2 f[x], {x, 0, 1}]/2 // FullSimplify
>
> returns just the input
>
> Integrate[2 f[x], {x, 0, 1}]/2
>


Why do you assume that Integrate[2 f[x], {x, 0, 1}] exist ?
(Assume i.e. f[x] has a pole at 1)

It seems to me that mathematica is not shure about this and so
it leaves the intgral expression untouched.

What happens when you define f[x] ?

Just my $0.01
Regards
AHz

0 則新訊息