필터 지우기
필터 지우기

How to use integral when limits are anonymous functions

조회 수: 2 (최근 30일)
Aviral Srivastava
Aviral Srivastava 2024년 4월 25일
댓글: Walter Roberson 2024년 4월 25일
Greetings
I am evaluating an integral wherein the limits are functions themselves and symbolic variables are involved. I can't use int because it does not yield a complete answer (some of the integrals couldn't be solved symbollically), hence I am using integral with ArrayValued enabled.
My code is something like this:
syms x y(x) f(x,y)
dx = 1e-8;
I = @(x) integral( @y f(x,y), y1(x), y2(x), 'ArrayValued', true)
dI = (I(x=x_0+dx) - I(x))/dx + other leibniz terms as limits are functions of x
When I run this code, I get that A and B ( the limits in the integral function must be floating point scalars)
How do I overcome this?

채택된 답변

Walter Roberson
Walter Roberson 2024년 4월 25일
Your problem is unsolvable (in the form stated)
You cannot use integral() with symbolic limits: integral() is strictly a numeric integrator, and cannot handle symbolic limits.
You need to use int(), and just live with the fact that int() is unable to find a solution.
  댓글 수: 3
Walter Roberson
Walter Roberson 2024년 4월 25일
I = @(x) integral( @y f(x,y), y1(x), y2(x), 'ArrayValued', true)
is not valid syntax. Perhaps you meant
I = @(x) integral( @(y) f(x,y), y1(x), y2(x), 'ArrayValued', true)
Walter Roberson
Walter Roberson 2024년 4월 25일
integral() does not support functions for its limits.
For any one numeric x, you can calculate y1(x), y2(x) and use those constants in integral(). However, you cannot do this for generic symbolic x.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by