Figure markdownandlatexforfinancialformulaemagiccommandsoneofipythonsstrengthsliesinitsmagiccommands theyaddsomereallyhelpfulandpowerfulfunctionstothestandardpythonshell functionality magicipythonsmagicfunctions themagicfunctionsystemprovidesaseriesoffunctionswhichallowyouto controlthebehaviorofipythonitself features lsmagicininteractivecomputing tasks importnumpyasnpin timenp cputimes walltime msout array prunnp functioncallsin secondsorderedby string module numpy methoddisable wholecellintheipythonnotebook timeitnp loops msperloopthisfunctionexecutesanumberofloopstogetmorereliableestimatesforthedurationof afunctioncallorasnippetofcode informationaboutanditscommands table selectedhelpfunctionsincludedinipythonname introductionandoverviewofipythonfeaturesquickreferencehelp pythonsownhelpsystem object configurationcapabilitiesisalsofoundinthe thebookmarkingofarbitrarydirectoriesbytheuseofyourcustomnamessuchthatyou canlaternomatterwheretheipythonkernelisinvokedfromandnomatterwhatthe currentdirectoryisnavigatetoanyofyourbookmarkeddirectoriesimmediately
Figure�2-5.�Markdown�and�LaTeX�for�financial�formulae
The�magic�function�system�provides�a�series�of�functions�which�allow�you�to control�the�behavior�of�IPython�itself,�plus�a�lot�of�system-type
features.�There�are�two�kinds�of�magics,�line-oriented�and�cell-oriented.…
In�[4]:�%time�np.sin(np.arange(1000000))
CPU�times:�user�31.8�ms,�sys:�7.87�ms,�total:�39.7�ms Wall�time:�39�msOut[5]:
array([�0.��������,��0.84147098,��0.90929743,�…,��0.21429647,�������-0.70613761,�-0.97735203])In�[6]:�%timeit�np.sin(np.arange(1000000))
10�loops,�best�of�3:�27.5�ms�per�loopThis�function�executes�a�number�of�loops�to�get�more�reliable�estimates�for�the�duration�of a�function�call�or�a�snippet�of�code.
|
|
||
---|---|---|---|
� �%quickref |
|
||
|
|
Another�feature�of�IPython�is�that�it�is�highly�configurable.�Information�about�the configuration�capabilities�is�also�found�in�the�.