Section courante

A propos

Section administrative du site

 Langage  Elément  Programmation  Cadre d'application  Gabarit  UI  Extension  Projet  IDE  Langage  Outils  Annexe  Aide 
ABAP/4
Ada
Assembleur
Assembly & bytecode
ASP (Active Server Pages)
Basic
C
C++
C# (C Sharp)
Cobol
ColdFusion
Fortran
HTML
Java
JavaScript
LISP
Logo
LotusScript
Oberon
Pascal
Perl
PHP
PL/1
Prolog
Python
Rebol
REXX
Ruby
Rust
SAS
NoSQL
SQL
Swift
X++ (Axapta)
GNAT
SMALLAda
VHDL
Assembleur 370
Assembleur 1802
Assembleur 4004
Assembleur 6502
Assembleur 6800
Assembleur 68000
Assembleur 8080 et 8085
Assembleur 8089
Assembleur 80x86
Assembleur AGC4
Assembleur ARM
Assembleur DPS 8000
Assembleur i860
Assembleur Itanium
Assembleur MIPS
Assembleur PDP-11
Assembleur PowerPC
Assembleur RISC-V
Assembleur SPARC
Assembleur SuperH
Assembleur UNIVAC I
Assembleur VAX
Assembleur Z80
Assembleur Z8000
Assembleur z/Architecture
ASSEMBLER/MONITOR 64
Micol Assembler
GFA Assembler
A86
MASM (Macro Assembler)
TASM (Turbo Assembler)
CIL
Jasmin
LLVM
MSIL
Parrot
P-Code (PCode)
SWEET16
G-Pascal
ASP 1.0
ASP 2.0
ASP 3.0
ASP.NET
ASP.NET Core
ABasiC (Amiga)
Adam SmartBASIC
Altair BASIC
AmigaBASIC (Amiga)
AMOS Basic (Amiga)
Atari Basic (Atari 400, 600 XL, 800, 800XL)
Basic Apple II (Integer BASIC/APPLESOFT)
Basic Commodore 64 (CBM-BASIC)
Basic Commodore 128 (BASIC 7.0)
Basic Commodore VIC-20 (CBM-BASIC 2.0)
Basic Coco 1 (Color Basic)
Basic Coco 2 (Extended Color Basic)
Basic Coco 3 (Extended Color Basic 2.0)
BASICA (PC DOS)
Basic Pro
BBC BASIC
Blitz BASIC (Amiga)
DarkBASIC
Dartmouth BASIC
GFA-Basic (Atari ST/Amiga)
GWBASIC (MS-DOS)
Liberty BASIC
Locomotive BASIC (Amstrad CPC)
MSX-Basic
Omikron Basic (Atari ST)
Oric Extended Basic
Power Basic
Quick Basic/QBasic (MS-DOS)
Sinclair BASIC (ZX80, ZX81, ZX Spectrum)
ST BASIC (Atari ST)
Turbo Basic
Vintage BASIC
VBScript
Visual Basic (VB)
Visual Basic .NET (VB .NET)
Visual Basic pour DOS
Yabasic
BeckerBASIC
SIMONS' BASIC
Basic09 d'OS-9
Disk Extended Color Basic
Basic09 d'OS-9
Disk Extended Color Basic
Access
Excel
Visual Basic pour Windows
Visual Basic .NET pour Windows
C Shell Unix (csh)
C pour Amiga
C pour Atari ST
C pour DOS
C pour Falcon030
C pour GEMDOS (Atari ST)
C pour Linux
C pour PowerTV OS
C pour OS/2
C pour Unix
C pour Windows
Aztec C
CoCo-C
GNU C
HiSoft C
IBM C/2
Introl-C
Lattice C
Microsoft C
MinGW C
MSX-C
Open Watcom C
OS-9 C Compiler
Pure C
Quick C
Turbo C
HiSoft C for Atari ST
HiSoft C for CP/M (Amstrad CPC)
C++ pour OS/2
C++ pour Windows
Borland C++
C++Builder
IBM VisualAge C++
Intel C++
MinGW C++
Open Watcom C++
Symantec C++
Turbo C++
Visual C++
Visual C++ .NET
Watcom C++
Zortech C++
C# (C Sharp) pour Windows
Apple III Cobol
Microsoft Cobol
BlueDragon
Lucee
OpenBD
Railo
Smith Project
Microsoft Fortran
WATFOR-77
CSS
FBML
Open Graph
SVG
XML
XSL/XSLT
LESS
SASS
GCJ (GNU)
JSP
Jython
Visual J++
Node.js
TypeScript
AutoLISP
ACSLogo
LotusScript pour Windows
Amiga Oberon
Oberon .NET
Apple Pascal
Delphi/Kylix/Lazarus
Free Pascal
GNU Pascal
HighSpeed Pascal
IBM Personal Computer Pascal
Lisa Pascal
Maxon Pascal
MPW Pascal
OS-9 Pascal
OSS Personal Pascal
Pascal-86
Pascal du Cray Research
Pascal/VS
Pascal-XT
PURE Pascal
QuickPascal
RemObjets Chrome
Sun Pascal
THINK Pascal
Tiny Pascal (TRS-80)
Turbo Pascal
UCSD Pascal
VAX Pascal
Virtual Pascal
Turbo Pascal for CP/M-80
Turbo Pascal for DOS
Turbo Pascal for Macintosh
Turbo Pascal for Windows
CodeIgniter (Cadre d'application)
Drupal (Projet)
Joomla! (Projet)
Phalanger (PHP .NET)
phpBB (Projet)
Smarty (balise)
Twig (balise)
Symfony (Cadre d'application)
WordPress (Projet)
Zend (Cadre d'application)
PL360
PL/M-80
PL/M-86
Turbo Prolog
CPython
IronPython
Jython
PyPy
AREXX
Regina REXX
JMP
Btrieve
Cassandra
Clipper
CouchDB
dBASE
Hbase
Hypertable
MongoDB
Redis
Access
BigQuery
DB2
H2
Interbase
MySQL
Oracle
PostgreSQL
SAP HANA
SQL Server
Sybase
U-SQL
Introduction
Balises de ASP.NET
Les remarques
Les opérateurs
Les instructions conditionnelles
Les instructions de boucles
Les type de données
Variables
Directives de page
Versus
Bonjour
Formulaire
Géographie
Géométrie
Mathématique
Météorologie
Sport
Téléverser YouTube
Distance en Km entre deux longitudes et latitudes
Aire d'un cercle
Aire d'une surface de prisme rectangulaire
Aire d'un triangle
Distance entre deux points
Ackermann
Exp
Factoriel
Fibonacci
Log
Nombre premier
Odd
Random
Sqrt
Triangle Pascal
Unité de mesure
Hockey
.NET
ASP.NET MVC Framework
Entity Framework
Razor
Telerik UI pour ASP.NET AJAX
PdfViewer.dll
Umbraco
Visual Studio
C#
VB.NET
CFF Explorer
IL DASM
.NET Reflector
Vocabulaire
Fichiers spéciaux
Bibliographie
Web.config
.resx
Préface
Notes légal
Dictionnaire
Recherche

Après avoir effectué des recherches dans de nombreux livres comme Scientific Pascal, Dictionnaire mathématique,..., je n'ai jamais trouvé aucun livre fournissant une réponse correct du calcul du logarithme, outre le projet GNU (HaypoCALC). Bien qu'il existe de nombreuses fonctions de logarithme (Math.Log en C# ou Math.Log en VB.NET) dans la classe Math du .NET, il peut être intéressant d'effectuer les calculs par nous même :

ASP.NET (VB.NET) ASP.NET (C# (C Sharp))
  1. <%@ Page Language="VB" %> 
  2. <script runat="server"> 
  3.  Function SquareRoot(ByVal X As Double) As Double
  4.         Dim A, B, M, XN As Double
  5.         If X = 0.0 Then
  6.             Return 0.0
  7.         Else
  8.             M = 1.0
  9.             XN = X
  10.             While XN >= 2.0
  11.                 XN = 0.25 * XN
  12.                 M = 2.0 * M
  13.             End While
  14.             While XN < 0.5
  15.                 XN = 4.0 * XN
  16.                 M = 0.5 * M
  17.             End While
  18.             A = XN
  19.             B = 1.0 - XN
  20.             Do
  21.                 A = A * (1.0 + 0.5 * B)
  22.                 B = 0.25 * (3.0 + B) * B * B
  23.             Loop While B >= 0.000000000000001
  24.             Return A * M
  25.         End If
  26.     End Function
  27.  
  28.     Function Ln(ByVal x As Double) As Double
  29.         Dim negatif As Boolean = False
  30.         Dim fois As Double = 1
  31.         Dim ajout As Double = 0
  32.         If x <= 0.0 Then Return 0
  33.         If x < 1.0 Then
  34.             negatif = True
  35.             x = 1.0 / x
  36.         End If
  37.         While x >= 10.0
  38.             x /= 10.0
  39.             ajout += 2.3025850929940459
  40.         End While
  41.         While x >= 1.1
  42.             x = SquareRoot(x)
  43.             fois *= 2
  44.         End While
  45.         x -= 1
  46.         Dim savx As Double = x
  47.         Dim i As Double = 2
  48.         Dim xp As Double = x * x
  49.         Dim quotient As Double = (xp / i)
  50.         Dim dl As Double = x - quotient
  51.         While 0.000000000000001 < quotient
  52.             i += 1
  53.             xp *= x
  54.             dl += (xp / i)
  55.             i += 1
  56.             xp *= x
  57.             quotient = (xp / i)
  58.             dl -= quotient
  59.         End While
  60.         dl *= fois
  61.         dl += ajout
  62.         If negatif Then dl = -dl
  63.         Return dl
  64.     End Function 
  65. </script> 
  66. <%
  67. Dim i As Double
  68. For i = 0 To 2.0 Step 0.1
  69.     Response.Write("Ln(" & i & ")=" & Ln(i) & "<br />")
  70. Next 
  71. %>
  1. <%@ Page Language="C#" %> 
  2. <script runat="server"> 
  3.     public static double SquareRoot(double X)
  4.     {
  5.         double A, B, M, XN;
  6.         if (X == 0.0)
  7.         {
  8.             return 0.0;
  9.         }
  10.         else
  11.         {
  12.             M = 1.0;
  13.             XN = X;
  14.             while (XN >= 2.0)
  15.             {
  16.                 XN = 0.25 * XN;
  17.                 M = 2.0 * M;
  18.             }
  19.             while (XN < 0.5)
  20.             {
  21.                 XN = 4.0 * XN;
  22.                 M = 0.5 * M;
  23.             }
  24.             A = XN;
  25.             B = 1.0 - XN;
  26.             do
  27.             {
  28.                 A = A * (1.0 + 0.5 * B);
  29.                 B = 0.25 * (3.0 + B) * B * B;
  30.             } while (B >= 1.0E-15);
  31.             return A * M;
  32.         }
  33.     }
  34.  
  35.     static double Ln(double x)
  36.     {
  37.         bool negatif = false;
  38.         double fois = 1;
  39.         double ajout = 0;
  40.         if (x <= 0.0) return 0;
  41.         if (x < 1.0)
  42.         {
  43.             negatif = true;
  44.             x = 1.0 / x;
  45.         }
  46.         while (x >= 10.0)
  47.         {
  48.             x /= 10.0;
  49.             ajout += 2.302585092994046;
  50.         }
  51.         while (x >= 1.1)
  52.         {
  53.             x = SquareRoot(x);
  54.             fois *= 2;
  55.         }
  56.         x--;
  57.         double savx = x;
  58.         double i = 2;
  59.         double xp = x * x;
  60.         double quotient = (xp / i);
  61.         double dl = x - quotient;
  62.         while (1.0E-15 < quotient)
  63.         {
  64.             i++;
  65.             xp *= x;
  66.             dl += (xp / i);
  67.             i++;
  68.             xp *= x;
  69.             quotient = (xp / i);
  70.             dl -= quotient;
  71.         }
  72.  
  73.         dl *= fois;
  74.         dl += ajout;
  75.         if (negatif) dl = -dl;
  76.         return dl;
  77.     } 
  78. </script> 
  79. <%
  80. for (double I = 0; I <= 2.0; I += 0.1)
  81. {
  82.     Response.Write("Ln(" + I + ")=" + Ln(I) + "<br />");
  83. }     
  84. %>

on obtiendra le résultat suivant :

Ln(0.0)=0.0
Ln(0.1)=-2.302585092994046
Ln(0.2)=-1.6094379124341056
Ln(0.3)=-1.2039728043259357
Ln(0.4)=-0.916290731874156
Ln(0.5)=-0.6931471805599471
Ln(0.6)=-0.5108256237659916
Ln(0.7)=-0.3566749439387316
Ln(0.8)=-0.22314355131420963
Ln(0.9)=-0.10536051565782642
Ln(1.0)=0.09531017980432469
Ln(1.2)=0.18232155679395437
Ln(1.3)=0.2623642644674894
Ln(1.4)=0.3364722366212136
Ln(1.5)=0.40546510810816594
Ln(1.6)=0.47000362924573785
Ln(1.7)=0.5306282510621684
Ln(1.8)=0.5877866649021186
Ln(1.9)=0.6418538861723971

Voir également

Science - Mathématique

PARTAGER CETTE PAGE SUR
Dernière mise à jour : Samedi, le 31 août 2017