Numerical integration of a long symbolic expression with definite limits
조회 수: 3 (최근 30일)
이전 댓글 표시
I want to numerically integrate a long symbolic expression with definite limits without using the symbolic integration function (int) because it is very slow. A sample example (for short expression) would be
syms t a b c
y=a*sin(t)+(b*cos(2*t)+c*sin(3*t))^2
I want to integrate y with respect to t from 0 to pi. The result should be a symbolic expression in a , b, c.
Again, I don't want to use int function
댓글 수: 7
Walter Roberson
2020년 4월 9일
편집: Walter Roberson
2020년 4월 9일
?
The result of int(y) would not have any trignometric expressios left in it, just combinations of a, b, c, pi, and fractions. a appears up to a^10, b appears up to b^20, c appears up to c^20. You can extract the coefficients using coeff()
You can expand() y and work term by term, using children(), extract the symbolic coefficient multipliers, do numeric integration on the sin()^n*cos()^m part, multiply by the symbolic parts, record, and later sum() all the results. It is not clear this would be any more useful than using int(y) or int(vpa(expand(y)))
답변 (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!