Matlab/Octave finty

From RoboWiki
Revision as of 11:30, 17 February 2012 by Balogh (talk | contribs) (New page: Niektoré zaujímavé konštrukcie a postupy '''How to find square root of 2 in 15 significant figures''' octave:1> format long octave:2> sqrt(2) ans = 1.41421356237310 Alebo iný...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Niektoré zaujímavé konštrukcie a postupy

How to find square root of 2 in 15 significant figures

octave:1> format long
octave:2> sqrt(2)
ans =  1.41421356237310

Alebo iný postup

   x = 1.5;
   x = (x + 2/x) / 2;
   x = (x + 2/x) / 2;
   x = (x + 2/x) / 2;
   x = (x + 2/x) / 2;
   fprintf('%18.15f\n', x)