필터 지우기
필터 지우기

Simplify expression after collect function

조회 수: 1 (최근 30일)
Tom Klijn
Tom Klijn 2016년 2월 12일
답변: Walter Roberson 2016년 2월 12일
Hello I have written a code that performs newton interpolation. After I determined the coefficients I want to display the simplified expression like this: p(x) = p14*x^14 + p13*x^13 + ... + p0
But when I use the collect function it displays the result as follows:
((1613572414787747*13^(1/2)*17^(1/2))/1667355148462087077893881565539536391777188164935759167488 + (1613572414787747*22^(1/2))/2157753721539171512568552614227635330535184684034511863808 + 3914999446024239438846407105870793530675/11373727500204176163375146989836406690440670303259304015465585573888)*X^14 + ...
I would like to display 3.4421e-28*X^14 + ...
How do I do that?
This is the code I used to create formula out of th calculated cofficients:
%display the formula (collect or factor function)
syms X;
p_x = collect( a(1)...
+ a(2)*(X-x(1))...
+ a(3)*(X-x(1))*(X-x(2))...
+ a(4)*(X-x(1))*(X-x(2))*(X-x(3))...
+ a(5)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))...
+ a(6)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))...
+ a(7)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))...
+ a(8)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))...
+ a(9)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))...
+ a(10)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))...
+ a(11)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))*(X-x(10))...
+ a(12)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))*(X-x(10))*(X-x(11))...
+ a(13)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))*(X-x(10))*(X-x(11))*(X-x(12))...
+ a(14)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))*(X-x(10))*(X-x(11))*(X-x(12))*(X-x(13))...
+ a(15)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))*(X-x(10))*(X-x(11))*(X-x(12))*(X-x(13))*(X-x(14))...
+ a(16)*(X-x(1))*(X-x(2))*(X-x(3))*(X-x(4))*(X-x(5))*(X-x(6))*(X-x(7))*(X-x(8))*(X-x(9))*(X-x(10))*(X-x(11))*(X-x(12))*(X-x(13))*(X-x(14))*(X-x(15))...
, X )
Thanks in advance!

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 12일
call vpa() on the expression.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by