Top Banner
“Un sistema experto desarrollado en el software Mathematica para analizar funciones de R en RVII FAST WORKSHOP ON APPLIED AND COMPUTATIONAL MATHEMATICS Robert Ipanaqué Chero Trujillo, 08 de Enero de 2014 1
26

Ponencia

Aug 02, 2015

Download

Education

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ponencia

“Un sistema experto desarrollado en elsoftware Mathematica para analizar

funciones de R en R”VII FAST WORKSHOP ON APPLIED AND COMPUTATIONAL MATHEMATICS

Robert Ipanaqué Chero

[email protected]

http://www.unp.edu.pe/pers/ripanaque

Trujillo, 08 de Enero de 2014

1

Page 2: Ponencia

IntroducciónEsta presentación describe el nuevo sistema expertoFunctions, codificado en el lenguaje de programación delMathematica v.9.0. Este sistema experto amplía lascapacidades del Mathematica para analizar funciones realesde variable real.

Específicamente se ha conseguido mejorar las gráficas de lasfunciones definidas a trozos, implementar comandos pararealizar operaciones concernientes al álgebra de funciones yautomatizar el cálculo de la función inversa.

La descripción se hace mostrando, inicialmente, los comandoscon los que cuenta el Mathematica para analizar funciones yluego se muestran los comandos incorporados en el nuevosistema experto; de esta manera el lector puede comparar lassalidas obtenidas.

2

Page 3: Ponencia

El MathematicaEl Mathematica es un Sistema de Álgebra Computacional(SAC), es decir, es un programa de ordenador que facilita elcálculo simbólico (trabaja con ecuaciones y fórmulassimbólicamente, en lugar de numéricamente).

Cálculo numérico: 4 + 36− 1 −→ 39Cálculo simbólico: 7x − 3x + 6 −→ 4x + 6

Mathematica

Una característica muy importante del Mathematica es que efectúa la reduc-ción de cuantificadores. Esto puede apreciarse al calcular el dominio de lasiguiente función.

In[1]:= Reduce

[∃y

(y =

√2|x |−x2+2√

x(3x−2)

), Reals

]Out[1]= 2

3 < x ≤ 1 +√

3

3

Page 4: Ponencia

Comandos del Mathematica para analizarfunciones

Comando PiecewiseExpand

Mathematica

Expansión de una expresión con Piecewise anidado en una función con unsolo Piecewise.

In[1]:= Piecewise[{{Piecewise[{{1, x < 1}},2], x > 0}},3]

Out[1]=

{

1 x < 12 True

x > 0

3 TrueIn[2]:= PiecewiseExpand[%]

Out[2]=

1 0 < x < 12 x ≥ 13 True

4

Page 5: Ponencia

Mathematica

Conversión de un arreglo de funciones especiales a trozos en un único objetoPiecewise.

In[3]:= Piecewise[{{Max[x , x2],−2 < x < 2},{UnitStep[x ], True}}]

Out[3]=

{Max

[x , x2] −2 < x < 2

UnitStep[x ] True

In[4]:= PiecewiseExpand[%]

Out[4]=

1 x ≥ 2x 0 ≤ x ≤ 1x2 −2 < x < 0 ∨ 1 < x < 20 True

5

Page 6: Ponencia

Mathematica

Expansión de una función con un número infinito de trozos sobre un intervaloacotado.

In[5]:= PiecewiseExpand[Floor[x ],0 < x < 4]

Out[5]=

1 1 ≤ x < 22 2 ≤ x < 33 x ≥ 30 True

6

Page 7: Ponencia

Comando Plot

Mathematica

Gráfica de la función f (x) = JxK.

In[6]:= Plot[Floor[x ], {x ,−3,3}]

Out[6]= -3 -2 -1 1 2 3

-3

-2

-1

1

2

7

Page 8: Ponencia

Mathematica

Gráfica de una función obtenida al incluir algunas opciones de Plot.

In[7]:= f [x_]:={

x − Floor[2x ] −1 ≤ x < 1x2 + Floor[x ] 1 ≤ x < 4

In[8]:= Plot[ f [x ], {x ,−2,5}, PlotRange→ All, · · · ]

Out[8]=

-1 1 2 3 4

1

2

3

4

5

8

Page 9: Ponencia

Suma de funcionesMathematica

Resultado incorrecto de la suma de dos funciones a trozos.

In[9]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[10]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[11]:= PiecewiseExpand[f [x ] + g[x ]]

Out[11]=

9(x − 1) −2 < x < 02(x + 4) 4 ≤ x < 5

2(2x + 1) 0 ≤ x < 27x − 3 −3 < x ≤ −2

x2 + 2x + 6 2 ≤ x < 40 True

9

Page 10: Ponencia

Producto de funcionesMathematica

Resultado aparentemente correcto; sin embargo, note que los dominios par-ciales están en desorden y que el producto no debería estar definido parax 6∈ [0, 4] (en este caso tiene el valor 0).

In[12]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[13]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[14]:= PiecewiseExpand[f [x ] ∗ g[x ]]

Out[14]=

4(x − 3)(x + 4) 0 ≤ x < 2

2(x − 3)(7x − 3) −2 < x < 02(x + 4)

(x2 − 2

)2 ≤ x < 4

0 True

10

Page 11: Ponencia

Cociente de funcionesMathematica

Resultado incorrecto del cociente de dos funciones a tozos.

In[15]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[16]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[17]:= PiecewiseExpand[f [x ] ∗ g[x ]]

Out[17]=

Indeterminate x ≥ 5 ∨ x ≤ −3x+4x−3 0 ≤ x < 27x−3

2(x−3) −2 < x < 02(x+4)x2−2 2 ≤ x < 4

ComplexInfinity True

11

Page 12: Ponencia

Composición de funcionesMathematica

Resultado incorrecto de la composición de dos funciones a tozos.

In[18]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[19]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[20]:= PiecewiseExpand[Composition[f ,g][x ]]

Out[20]=

7(2x − 6)− 3 3

2 < x < 22(x2 − 2

)+ 8 2 ≤ x <

√7

8 2 ≤ x <√

7 ∨ x ≥ 4 ∨ x ≤ −20 True

12

Page 13: Ponencia

Inversa de una funciónMathematica

Resultado aparentemente correcto de la inversa de una función; sin embargo,no hay información con respecto al dominio de definición de dicha inversa.

In[21]:= h[x_]:=√

x2 + 7 + xIn[22]:= InverseFunction[h][x ]

Out[22]= x2−72x

13

Page 14: Ponencia

El sistema experto Functions

Comando PwExpand

Mathematica

Expansión de una expresión con Piecewise anidado en una función con unsolo Piecewise.

In[1]:= Piecewise[{{Piecewise[{{1, x < 1}},2], x > 0}},3]

Out[1]=

{

1 x < 12 True

x > 0

3 TrueIn[2]:= PwExpand[%]

Out[2]=

3 x ≤ 01 0 < x < 12 x ≥ 1Null True

14

Page 15: Ponencia

Mathematica

Conversión de un arreglo de funciones especiales a trozos en un único objetoPiecewise.

In[3]:= Piecewise[{{Max[x , x2],−2 < x < 2},{UnitStep[x ], True}}]

Out[3]=

{Max

[x , x2] −2 < x < 2

UnitStep[x ] True

In[4]:= PwExpand[%]

Out[4]=

x 0 ≤ x ≤ 1x2 −2 < x < 0 ∨ 1 < x < 20 x ≤ −21 x ≥ 2Null True

15

Page 16: Ponencia

Mathematica

Expansión de una función con un número infinito de trozos sobre un intervaloacotado.

In[5]:= PwExpand[Floor[x ],0 < x < 4]

Out[5]=

0 0 < x < 11 1 ≤ x < 22 2 ≤ x < 33 3 ≤ x < 4Null True

16

Page 17: Ponencia

Comando PwPlot

Mathematica

Gráfica de la función f (x) = JxK.

In[6]:= PwPlot[Floor[x ], {x ,−3,3}]

Out[6]= -2. -1. 1. 2. 3.

-3.

-2.

-1.

1.

2.

17

Page 18: Ponencia

Mathematica

Gráfica de una función obtenida al incluir algunas opciones propias de Plot,conjuntamente con la opción EndsSize.

In[7]:= f [x_]:={

x − Floor[2x ] −1 ≤ x < 1x2 + Floor[x ] 1 ≤ x < 4

In[8]:=

PwPlot[ f [x ], {x ,−2,5}, EndsSize→ 5, PlotRange→ All, · · · ]

Out[8]=

-1.-0.5 0.5 1. 2. 3. 4.-0.5

0.5

1.

1.5

2.

3.

3.5

4.5

5.

18

Page 19: Ponencia

Suma de funcionesMathematica

Resultado correcto de la suma de dos funciones a trozos.

In[9]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[10]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[11]:= (f + g)[x ]

Out[11]=

9x − 9 −2 < x < 04x + 2 0 ≤ x < 2

x2 + 2x + 6 2 ≤ x < 4Null True

19

Page 20: Ponencia

Producto de funcionesMathematica

Resultado correcto del producto de dos funciones a trozos.

In[12]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[13]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[14]:= (f ∗ g)[x ]

Out[14]=

14x2 − 48x + 18 −2 < x < 04x2 + 4x − 48 0 ≤ x < 2

2x3 + 8x2 − 4x − 16 2 ≤ x < 4Null True

20

Page 21: Ponencia

Cociente de funcionesMathematica

Resultado correcto del cociente de dos funciones a tozos.

In[15]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[16]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[17]:= (f/g)[x ]

Out[17]=

3−7x6−2x −2 < x < 0x+4x−3 0 ≤ x < 2

2(x+4)x2−2 2 ≤ x < 4Null True

21

Page 22: Ponencia

Composición de funcionesMathematica

Resultado correcto de la composición de dos funciones a tozos.

In[18]:= f [x_]:={

7x − 3 −3 < x < 02x + 8 0 ≤ x < 5

In[19]:= g[x_]:={

2x − 6 −2 < x < 2x2 − 2 2 ≤ x < 4

In[20]:= (f ◦ g)[x ]

Out[20]=

14x − 45 3

2 < x < 22x2 + 4 2 ≤ x <

√7

Null True

22

Page 23: Ponencia

Inversa de una funciónMathematica

Resultado correcto de la inversa de una función.

In[21]:= h[x_]:=√

x2 + 7 + x

In[22]:= IFunction[{h[x ] x > 0 , x ]

Out[22]=

{x2−7

2x x >√

7Null True

23

Page 24: Ponencia

Mathematica

Resultado correcto de la inversa de una función a trozos.

In[23]:= IFunction

[{2x + 1 x ≤ 0x2 + 1 x > 0

, x]

Out[23]=

x−1

2 x ≤ 1√x − 1 x > 1Null True

24

Page 25: Ponencia

BibliografíaIPANAQUÉ, R. Y VELESMORO, R., Breve Manual delMathematica 5.1, Eumed.net, 2005,http://www.eumed.net/libros-gratis/2005/ric2/ric2.pdf

WIKIPEDIA, Mathematica,http://es.wikipedia.org/wiki/Mathematica

WOLFRAM MATHEMATICA DOCUMENTATION CENTER,Element,http://reference.wolfram.com/mathematica/ref/Element.html

WOLFRAM MATHEMATICA DOCUMENTATION CENTER,Exists,http://reference.wolfram.com/mathematica/ref/Exists.html

WOLFRAM MATHEMATICA DOCUMENTATION CENTER,ForAll,http://reference.wolfram.com/mathematica/ref/ForAll.html

25

Page 26: Ponencia

www.mathematica.com

¡MUCHAS GRACIAS!

26