How to use integral when limits are anonymous functions
2 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
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
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
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 Center および File Exchange で Calculus についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!