67 lines
1.4 KiB
HTML
67 lines
1.4 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>Exp# ( x# )</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
x = any number.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
This is e^x where e = 2.71828...
|
|
|
|
<br />
|
|
|
|
<br />
|
|
For the curious, e is defined by the infinite sum:
|
|
|
|
<br />
|
|
|
|
<br />
|
|
2 + 1/(2) + 1/(2*3) + 1/(2*3*4) + 1/(2*3*4*5) + ...
|
|
|
|
<br />
|
|
|
|
<br />
|
|
See also Log()
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../2d_examples/Exp.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; Exp example
|
|
<br />
|
|
|
|
<br />
|
|
; Exp(x) is the same as e^x.
|
|
<br />
|
|
|
|
<br />
|
|
; Actually, due to the approximate nature of floating point arithmetic
|
|
<br />
|
|
; these will not be exactly equal. But in the following example
|
|
<br />
|
|
; the difference is so small you can't see it.
|
|
<br />
|
|
|
|
<br />
|
|
e# = 2.71828182845905 ; over-specified, might help and can't hurt.
|
|
<br />
|
|
|
|
<br />
|
|
x# = .125 ; = 1/8
|
|
<br />
|
|
|
|
<br />
|
|
Print " x Exp(x) e^x "
|
|
<br />
|
|
Print "======= ========= ========="
|
|
<br />
|
|
|
|
<br />
|
|
For k = 1 To 7
|
|
<br />
|
|
|
|
<br />
|
|
Write " " + LSet( x , 7 )
|
|
<br />
|
|
Write RSet( Exp( x ), 10 )
|
|
<br />
|
|
Print RSet( e^x , 12 )
|
|
<br />
|
|
x = 2 * x
|
|
<br />
|
|
|
|
<br />
|
|
Next
|
|
<br />
|
|
|
|
<br />
|
|
WaitKey() : End
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<a target=_top href=../index.htm>Index</a><br>
|
|
<br>
|
|
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Exp&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
|
|
</html>
|