On Thu, May 07, 2009 at 06:17:59PM +0200, B. Philipp wrote:
> Hallo
> 
> kennt jemand einen Weg wie man {1 - 10^(-60)}^[3 * 10^(19)] als Dezimalzahl  
> in halblogarithmischer Schreibweise (x*10^n) darstellen lassen kann?

Hier noch zur Vervollständigung die numerische Lösung:

Man nehme:                                                                      
                                                            
                                                                                
                                                            
* ipython und                                                                   
                                                            
* mpmath von http://code.google.com/p/mpmath/ und installiert es:               
                                                            
                                                                                
                                                            
  % python setup.py install --prefix=/usr/local                                 
                                                            
                                                                                
                                                            
und dann gehts los:                                                             
                                                            
                                                                                
                                                            
% ipython                                                                       
                                                            
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)                                
                                                            
Type "copyright", "credits" or "license" for more information.                  
                                                            
                                                                                
                                                            
IPython 0.8.1 -- An enhanced Interactive Python.                                
                                                            
?       -> Introduction to IPython's features.                                  
                                                            
%magic  -> Information about IPython's 'magic' % functions.                     
                                                            
help    -> Python's own help system.                                            
                                                            
object? -> Details about 'object'. ?object also works, ?? prints more.          
                                                            
                                                                                
                                                            
In [1]: from mpmath import *                                                    
                                                            
                                                                                
                                                            
In [2]: mp.dps = 100 # Rechnengenauigkeit                                       
                                                            
                                                                                
                                                            
In [3]: P = (1 - mpf(10)**-60)**(3 * mpf(10)**19)                               
                                                            
                                                                                
                                                            
In [4]: print P                                                                 
                                                            
0.9999999999999999999999999999999999999999700000000000000000000000000000000000000004164770011064089061
                                      
                                                                                
                                                            
In [5]: nprint(P, 50) # offensichtlich reichen hier 50 Dezimalstellen aus       
                                                            
0.99999999999999999999999999999999999999997                                     
                                                            
                                                                                
                                                            
In [6]: nprint(1 - P, 50)                                                       
                                                            
2.9999999999999999999999999999999999999999583522999e-41 

Tschüs,

  Friedrich

_______________________________________________
Lug-dd maillist  -  [email protected]
https://ssl.schlittermann.de/mailman/listinfo/lug-dd

Antwort per Email an