• Lenguaje

    JavaScript

  • Descripción

    Obtener una función exponencial, la cual está dada por:
    e^x = 1+x/1! + x²/2! + x³/3! + ...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Función exponencial</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <script>
 
function algoritmo()
{
    let n;
    let ex, factorial, x;
    if(i==1)
    {
        ex=1;
        factorial=1;
    }
    factorial=factorial*i;
    ex=ex+Math.pow(x,i)/factorial;
}
 
        </script>
    </head>
    <body>
        <form name="formulario1">
            <table style="text-align: left; margin-left: auto; margin-right: auto;">
                <tbody>
                    <tr align="center">
                        <td colspan="2" rowspan="1">
                            <input value="Procesar" type="button" onclick="algoritmo();" />
                            <input type="reset" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>