Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Repeated Integrals

22 views
Skip to first unread message

bria...@gmail.com

unread,
May 19, 2013, 5:46:32 AM5/19/13
to
I'm fairly new to Mathematica and I'm trying to create an expression for a set of nested integrals. The innermost integral is

int[0,x,L(y,a)g(y),dy]

Where g(y) is an arbitrary function and a is a parameter. The next integral is

int[0,w,L(x,b)h(x,a),dx]

Where b is a parameter and h(x,a) is the result of the previous integral.

The process then repeats N times. Is there a simple way to express this in Mathematica?


Bob Hanlon

unread,
May 20, 2013, 5:03:30 AM5/20/13
to

Read the documentation for Integrate


h[x_, a_] = Integrate[L[y, a] g[y], {y, 0, x}];


f[a_, b_, w_] = Integrate[L[x, b] h[x, a], {x, 0, w}];


It is not clear what you want to change and how they are to change during
the N repetitions: a, b, w, or some combination of them? Presumaby you
would use f[a,b,w] inside a Table perhaps flattening (Flatten) the Table
results if you prefer the output as a list rather than a matrix. Read the
documentation for Table and Flatten.


sol = Table[f[a, b, w], {a, 2}, {b, {b1, b2, b3}}, {w, 1, 5, 2}] // Flatten


Using a capital letter for a user-defined function (e.g., L) or starting
the name of a user-defined function with a capital letter is not
recommended.This could result in a conflict (now or in a future version)
with a built-in Mathematica name or function.



Bob Hanlon

W Craig Carter

unread,
May 21, 2013, 12:02:52 AM5/21/13
to

Hello,
I thought the poster might be looking for something recursive?

int[0, x_] = Integrate[lFunc[a[0], z] g[z], {z, 0, x}]

int[n_Integer, x_] :=
int[n, x] = Integrate[lFunc[a[n], z] int[n - 1, z], {z, 0, x}]

Craig

Peter Pein

unread,
May 21, 2013, 12:02:29 AM5/21/13
to
Nest/NestList are your friends:

intlist = With[ (* toy example *)
{L = HeavisideTheta[#1, 1 - #1/#2]&, g = Cos[Pi #]&, a = 3, b = 2},
Assuming[Element[x, Reals], (* needed in this case *)
NestList[
Block[{t}, Integrate[L[t, b] (# /. x->t), {t, 0, x}]]&,
Integrate[L[y, a] g[y], {y, 0, x}],
5]
]
];

Peter

P.S.: in this example, try the plot:

Plot[MapIndexed[#1*Gamma[#2 + 1] x^-#2 &, intlist] //
Evaluate, {x, -.1, 3.5}, PlotRange -> {-.22, 1},
Exclusions -> None, PlotLegends -> Automatic,
WorkingPrecision -> 1.5 $MachinePrecision]

0 new messages