Filter löschen
Filter löschen

How to get results from symbolic variable integration

2 Ansichten (letzte 30 Tage)
Hosup Song
Hosup Song am 27 Jul. 2016
Kommentiert: Walter Roberson am 28 Jul. 2016
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 27 Jul. 2016
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 Kommentare
Hosup Song
Hosup Song am 28 Jul. 2016
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 am 28 Jul. 2016
Yes, it would give you a numeric value for the integral.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Andrei Bobrov
Andrei Bobrov am 27 Jul. 2016
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 Kommentar
Hosup Song
Hosup Song am 27 Jul. 2016
Bearbeitet: Walter Roberson am 27 Jul. 2016
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by