vpa(Fv,5) can not consider all the terms
    5 views (last 30 days)
  
       Show older comments
    
    MINATI PATRA
 on 5 Jun 2021
  
    
    
    
    
    Commented: MINATI PATRA
 on 6 Jun 2021
            Fv = - 4.4574e-25*x^21 + 3.0044e-21*x^20 - 5.6303e-17*x^19 + 1.7379e-13*x^18 - 1.4891e-9*x^17 + 1.3636e-8*x^16 - 2.8806e-9*x^15 - 2.0262e-7*x^14 - 7.3855e-8*x^13 - 4.8971e-7*x^12 + 0.000011088*x^11 + 0.000021129*x^10 - 0.000080694*x^9 + 0.00010399*x^8 - 0.0011636*x^7 - 0.010797*x^6 - 0.00084088*x^5 - 0.2542*x^4 + 0.1897*x^3 - 2.0757*x^2 + 0.78487*x + 0.078487;
%% And Can it be arranged in ascending order (Please help!)
%% vpa(Fv,5)  can not consider all the terms
Have a try!
0 Comments
Accepted Answer
  Walter Roberson
      
      
 on 5 Jun 2021
        It is not clear what you mean about considering all of the terms. vpa(Fv,5) looked fine to me. I did notice, though, that vpa() rounds to that number of significant digits, and perhaps what you want is to round in absolute digits. 
sympref('PolynomialDisplayStyle', 'ascend')
syms x
Fv = - 4.4574e-25*x^21 + 3.0044e-21*x^20 - 5.6303e-17*x^19 + 1.7379e-13*x^18 - 1.4891e-9*x^17 + 1.3636e-8*x^16 - 2.8806e-9*x^15 - 2.0262e-7*x^14 - 7.3855e-8*x^13 - 4.8971e-7*x^12 + 0.000011088*x^11 + 0.000021129*x^10 - 0.000080694*x^9 + 0.00010399*x^8 - 0.0011636*x^7 - 0.010797*x^6 - 0.00084088*x^5 - 0.2542*x^4 + 0.1897*x^3 - 2.0757*x^2 + 0.78487*x + 0.078487
mapSymType(Fv, 'rational', @(e)round(e,5))
Is that what you were talking about?
Notice that a lot of the high-order terms are now missing, because their coefficient rounded to 5 decimal places was 0.
5 Comments
  Walter Roberson
      
      
 on 6 Jun 2021
				None of the built-in MATLAB display formats will do that for you. 
If you were preparing a character vector with the results, then you would have more options.
Do you need the result to be character? Do you need the result to be symbolic? Do you need to write this out to a file? Is this to be displayed in a GUI? 
More Answers (0)
See Also
Categories
				Find more on Number Theory in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



