Use of variable integration limit

74 views
Skip to first unread message

Olivier

unread,
Dec 19, 2023, 4:41:30 AM12/19/23
to chebfun-users
Dear Chebfun users,

I have a problem that I have been trying to solve for several days, but unfortunately without great success.
Let us assume that a function f(x) defined on [0;1] is known and an expression to be calculated is of the form:

Image2.jpg

where B is a variable integration limit varying between 0 and 1, to finally plot the results A as a function of B.

My problem is related to the definition of B, because I do not see how to define the variable range in the use of cumsum (for the first integral) and in sum - cumsum (for the second integral).

Thanks in advance for any help
Best wishes
Oliver

Nick Trefethen

unread,
Dec 27, 2023, 5:25:48 AM12/27/23
to chebfun-users
Oliver, how about the code segment below?    - Nick Trefethen

dom = [0 1];
f = chebfun('sin(10*x)',dom);
s = cumsum(sin(f));
c = sum(cos(f)) - cumsum(cos(f));
A = chebfun(@(B) s(B)+c(B),dom);
plot(A)

Olivier

unread,
Jan 8, 2024, 9:40:24 AM1/8/24
to chebfun-users
Very happy new year to all chebfun-users.

Thanks a lot Nick for your help. Your code segment seems very interesting and probably answers my problem.

Oliver
Reply all
Reply to author
Forward
0 new messages