[Date Index]
[Thread Index]
[Author Index]
customizing Integrate with Unprotect
*To*: mathgroup at smc.vnet.net
*Subject*: [mg49273] customizing Integrate with Unprotect
*From*: "S. Narayan" <narayans at btv.ibm.com>
*Date*: Sat, 10 Jul 2004 02:48:51 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
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:
**Re: question about Integrate**
Next by Date:
**Re: what kind of a programming language is Mathematica?**
Previous by thread:
**Font Name Change**
Next by thread:
**Re: customizing Integrate with Unprotect**
| |