필터 지우기
필터 지우기

How to get results from symbolic variable integration

조회 수: 2 (최근 30일)
Hosup Song
Hosup Song 2016년 7월 27일
댓글: Walter Roberson 2016년 7월 28일
Pretty straight forward, I'm trying to do integration with symbolic variables.
I'm doing some complex integration with a mix of high degree polynomials and trig functions.
This is what I tried so far:
syms x
b4 = (x^127+x^32-x^12+78*x^2-5*cos(x))
int(b4, 0, 1)
I was hoping to get some number for the answer, but instead, I got this:
ans =
int((x^127+x^32-x^12+78*x^2-5*cos(x)), x, 0, 1)
I don't know why this is happening. How do I get the actual answer in numbers?

채택된 답변

Walter Roberson
Walter Roberson 2016년 7월 27일
There is no readily-found closed-form solution for your actual integral. You will need to use vpa() or double() to request numeric integration.
  댓글 수: 2
Hosup Song
Hosup Song 2016년 7월 28일
so would i have to do something like
b4 = (((1+x^3+x^i)^(1/2))*((1/0.00149912)*(cos(x)-30*(6-11*sin(1)+...
6*cos(1))*x^2+(192-336*sin(1)+168*cos(1))*x-36+57*sin(1)-24*cos(1))))
A = int(b4, 0, 1)
double(A)
Would this give me a numeral value for the answer?
Walter Roberson
Walter Roberson 2016년 7월 28일
Yes, it would give you a numeric value for the integral.

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

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2016년 7월 27일
in R2016a
>> syms x
b4 = (x^127+x^32-x^12+78*x^2-5*cos(x));
int(b4, 0, 1)
ans =
1425581/54912 - 5*sin(1)
>>
  댓글 수: 1
Hosup Song
Hosup Song 2016년 7월 27일
편집: Walter Roberson 2016년 7월 27일
ok i guess that was a bad example to use, since it works out nicely. The actual function I'm using is
b4 = (((1+x^3+x^i)^(1/2))*((1/0.00149912)*(cos(x)-30*(6-11*sin(1)+...
6*cos(1))*x^2+(192-336*sin(1)+168*cos(1))*x-36+57*sin(1)-24*cos(1))))
I'm trying to integrate this and when I use int(b4, 0, 1), i get ans =
int((x^3 + x^1i + 1)^(1/2)*((1885688952269973342506590723*x)/77371252455336267181195264 + (5867504283985271*cos(x))/8796093022208 + (1423673755532221964006035379175*x^2)/4951760157141521099596496896 - 1657186126350190416636264063127/2475880078570760549798248448), x, 0, 1)
How do i get rid of this.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by