Integration with variable bounds

26 views
Skip to first unread message

Jonathan Becker

unread,
Apr 24, 2023, 2:57:23 PM4/24/23
to chebfun-users
Hi everyone,

I was wondering whether there is a possibility to construct the following expression as a chebfun:
Screen Shot 2023-04-24 at 2.34.47 PM.png
Unfortunately, I have not yet been successful in my attempts to make the (lower) integration limit a function of x. For instance, the prescription of an integrand chebfun2 to the effect that
Screen Shot 2023-04-24 at 2.50.11 PM.png
returns an error that the "Operator '>' is not supported for operands of type 'chebfun2' ".

Is there any way to achieve this?

Many thanks!

Jonathan Becker

unread,
Apr 24, 2023, 3:46:06 PM4/24/23
to chebfun-users
Just as a quick follow-up. I did try something along the lines of 
Screen Shot 2023-04-24 at 3.43.22 PM.png
which does, in principle, work. Unfortunately, however, this would seem to be orders-and-orders of magnitude slower than doing things brute-force w/o chebfuns.

Thanks!

Nick Hale

unread,
Apr 25, 2023, 3:56:37 AM4/25/23
to chebfun-users
Hi Jonathan

Unfortunately Chebfun2 does not directly allow for variable integration limits.

However, I think the following will work.

% Toy problem:
g = chebfun2(@(x,y) exp(-(x.^2+x.*y + y.^2)));
f = chebfun(@(x) sin(x));
fhat = 1;

% Suggested approach:
[C, D, R] = cdr(g);
V = sum(C, f, fhat);
h = (V.*R)*diag(D);
plot(h), hold on

% Previous approach
h = @(x) sum(chebfun(@(y) g(x,y).*(y>=f(x)), 'splitting', 'on'));
h = chebfun(@(x) h(x), 'splitting', 'on');
plot(h, '--'); hold off, shg

Screenshot-20230425094823-580x530.png

Here's a brief explanation:
* The chebfun2 g is stored in CDR form as g(x,y) = sum_{k=1}^r d_kk*c_k(y)*r_k(x).
* Substituting to your required integral we have h(x) = sum_{k=1}^r d_kk*r_k(x)*v_k(x)
where v_k(x) = \int_{f(x)}^{\hat f} c_k(y) dy

I hope this helps

Nick



Jonathan Becker

unread,
Apr 25, 2023, 10:06:36 AM4/25/23
to chebfun-users
Hi Nick,

Thanks so much for getting back to be me so quickly. Makes a lot of sense and works like a charm.

If I may ask a quick follow up question: Is there any chance to extend this to 3 dimensions, i.e. to recover a chebfun for
Screen Shot 2023-04-25 at 9.54.45 AM.png
Unfortunately, chebfun3 does not appear to have a cdr(t) method.

Many thanks!

Nick Hale

unread,
Apr 25, 2023, 10:15:46 AM4/25/23
to chebfun-users
Hi Jonathan

Chebfun3 is a bit beyond my ken, but I think tucker(g) is what you'd need:

>> help tucker
--- help for chebfun3/tucker ---

 tucker   SLICE-tucker expansion of a CHEBFUN3 object.
    [CORE, COLS, ROWS, TUBES] = tucker(F) returns the core tensor CORE and
    the three factor quasimatrices COLS, ROWS, and TUBES in the low-rank
    representation of a CHEBFUN3 object F. The factor quasimatrices are of
    size Inf-by-length(F, 1), Inf-by-length(F, 2) and Inf-by-length(F, 3),
    respectively and we have
 
    F(x,y,z) = CORE x_1 COLS(x,:,:) x_2 ROWS(:,y,:) x_3 TUBES(:,:,z).
 
    CORE = tucker(F) returns the core tensor used in the construction of F.
 
  See also chebfun2/cdr.

I hope this helps

Nick

Jonathan Becker

unread,
Apr 25, 2023, 10:27:13 AM4/25/23
to chebfun-users
Thanks a lot. That looks very promising.

Best wishes,
Jonathan

Reply all
Reply to author
Forward
0 new messages