MathGroup Archive 2004

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

Search the Archive

Re: customizing Integrate with Unprotect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49303] Re: customizing Integrate with Unprotect
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 13 Jul 2004 04:32:34 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <cco4bd$4n3$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

try

Unprotect[Integrate];
Clear[Integrate];
Integrate[x_^n_*F[a_. + b_.*x_], x_] /; 
      Element[n, Integers] := (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];

Integrate[a_.*F[prod_Times], x_] := 
  Integrate @@ {Expand[a*F[Expand[prod]]], x}

Integrate[a_Plus, x_] /; ! FreeQ[a, F] := Integrate[#, x] & /@ a

Protect[Integrate]


Regards
  Jens

"S. Narayan" wrote:
> 
> 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
> 
> (* Here is the mathematica notebook  *)
> 
> \!\(\(Unprotect[Integrate];\)\[IndentingNewLine]
>    \(Clear[Integrate];\)\[IndentingNewLine]
>    \(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;\)\n
>    \(Integrate[x_*F[a_\  + \ b_*x_], x_] := 2*a*F[a\/
>        b]\ ;\)\[IndentingNewLine]
>    \(Integrate[F[a_\  + \ b_*x_], x_] := \ F[a\/b];\)\[IndentingNewLine]
> (*\ \
> run\ some\ examples\ *) \[IndentingNewLine]
>    Integrate[F[a\  + \ b*x], \ x]\[IndentingNewLine]
>    Integrate[x*F[a\ \  + \ b*x], \ x]\[IndentingNewLine]
>    Integrate[x*x*F[a\  + \ b*x], \
>      x]\[IndentingNewLine] (*\ now\ try\ two\ dimensions\ *) \
> \[IndentingNewLine]
>    Integrate[y*F[a\  + \ b*x\  + \ c*y], \ y]\[IndentingNewLine]
>    Integrate[%, \ x]\)


  • Prev by Date: AW: Sum of list elements
  • Next by Date: Re: Sum of list elements
  • Previous by thread: Re: customizing Integrate with Unprotect
  • Next by thread: Hypergeometric and MeijerG