Simplify expression after collect function
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numbers and Precision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!