Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: customizing Integrate with Unprotect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49276] Re: [mg49273] customizing Integrate with Unprotect
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 11 Jul 2004 02:16:11 -0400 (EDT)
  • References: <200407100648.CAA04632@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 10 Jul 2004, at 15:48, S. Narayan wrote:

> *This message was transferred with a trial version of CommuniGate(tm) 
> Pro*
> For some custom function F, I used Unprotect to "teach" Mathematica the
> integration (which involves a recursive definition) I am unable to use
> this integration in more than one dimension.
>
> Here is the example (in text, I have the mathematica session at the end
> of the post)
>
> Unprotect[Integrate];
> Clear[Integrate];
> Integrate[x_^n_ * F[a_ + b_* x_], x_] :=
> (n+1)a^n *Integrate[x^(n-1) * F[a + b*x], x] + (n-1)*b^n;
> Integrate[x_ * F[a_ + b_*x_], x_] := 2* a * F[a/b];
> Integrate[F[a_ + b_*x_], x_] := F[a/b];
>
> I require that n be a whole number and a, b real numbers.
> I tried a couple of examples in one dimension and it works correctly:
>
> Integrate[x*x*F[a + b*x], x]
>
>> b^2 + 6 a^3 F(a/b);
>
> When I try it in multiple dimensions, I don't get the right answer:
>
> Integrate[y*F[a + b*x + c*y], y]
>> 2*(a + b*x)* F[(a + b*x)/ c]
> Integrate[%, y]
>> 2Integrate[(a + b*x)*F[(a + b*x)/c], x]
>
> Note that it does not apply the integration form from above, correctly.
>
> Is there anyway I can get this integration performed in Mathematica ?
> (My problem is I have to do this nested integration in more than 2
> dimensions and cannot do it manually)
>
> Thanks,
> - narayan
>
>

The problem is that your pattern matching is not accurate enough. In 
addition to the problem you have noticed, your definition won't work if 
a=0 or b=1. This should do better:


Unprotect[Integrate];
Integrate[x_^n_*F[a_.+b_.*x_],x_]:=(
           n+1)a^n*Integrate[x^(n-1)*F[a+b*x],x]+(n-1)*b^n;
Integrate[x_*F[a_.+b_.*x_],x_]:=2*a*F[Expand[a/b]];
Integrate[F[a_.+b_.*x_],x_]:=F[Expand[a/b]];
Protect[Integrate]



Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Test for pure real complex quotient
  • Next by Date: Re: How to plot the surface of revolution graphics
  • Previous by thread: customizing Integrate with Unprotect
  • Next by thread: Re: customizing Integrate with Unprotect