Graficas Mathematica

39
Representaciones gráficas con Mathematica La orden Plot , 8x, xmin, xmax<D representa f HxL entre xmin y , ...<, 8x, xmin, xmax<D representa varias funciones sup In[1]:= Plot@Cos@xD, 8x, 0, 2 Pi<D 1 2 3 4 5 6 -1 -0.5 0.5 1 Out[1]= Graphics Graficas.nb 1

description

PROGRAMA PARA ELABORAR CÁLCULOS Y GRÁFICAS

Transcript of Graficas Mathematica

Page 1: Graficas Mathematica

Representaciones

gráficas con

MathematicaLa orden Plot

, 8x, xmin, xmax <D representa f HxL entre xmin y, ... <, 8x, xmin, xmax <D representa varias funciones superpuestas

In[1]:= Plot @Cos@xD, 8x, 0, 2 Pi <D

1 2 3 4 5 6

-1

-0.5

0.5

1

Out[1]= � Graphics �

Graficas.nb 1

Page 2: Graficas Mathematica

In[2]:= Plot @8Cos@xD, Cos @2 xD, Cos @3 xD<, 8x, 0, 2 Pi <D;

1 2 3 4 5 6

-1

-0.5

0.5

1

ü Opciones

Como un último argumento de la función Plot se puede incluir una

secuencia de reglas de la forma nombre -> valor, que especifica los valores

que debe tomar la opción. Cualquier opción que no se especifique toma un

valor por defecto.

, opcion −> valor D grafica f especificando valores particulares

Algunas opciones de Plot:

Graficas.nb 2

Page 3: Graficas Mathematica

Valor por defecto ExplicaciónêGoldenRatio razón entre altura y ancho de la

Automatic incluye ejesNone nombres para los ejes

Automatic punto de cruce de los ejes$TextStyle estilo de texto por defecto

StandardForm tipo de formato de texto por$DisplayFunction forma de salida; Identity no imprime la

False dibujar o no un recuadro alrededorNone rotula para poner al recuadro

Automatic marcas a dibujar en el recuadro. NoneNone líneas de cuadrícula a incluirNone título de la gráfica

Automatic rango de coordenadasAutomatic marcas sobre los ejes

In[3]:= Plot @Cos@x^2 D, 8x, 0, 3 <D;

0.5 1 1.5 2 2.5 3

-1

-0.5

0.5

1

Graficas.nb 3

Page 4: Graficas Mathematica

In[4]:= Plot @Cos@x^2 D, 8x, 0, 3 <, Frame → True D;

0 0.5 1 1.5 2 2.5 3-1

-0.5

0

0.5

1

In[5]:= Plot @Cos@x^2 D, 8x, 0, 3 <,

AxesLabel → 8"x", "Sin @x^2 D" <D;

0.5 1 1.5 2 2.5 3x

-1

-0.5

0.5

1

Sin @x^2 D

Graficas.nb 4

Page 5: Graficas Mathematica

In[6]:= Plot @Cos@x^2 D, 8x, 0, 3 <,

Frame → True, GridLines → Automatic D;

0 0.5 1 1.5 2 2.5 3-1

-0.5

0

0.5

1

In[7]:= Plot @Cos@x^2 D, 8x, 0, 3 <, AspectRatio → 1D;

0.5 1 1.5 2 2.5 3

-1

-0.5

0.5

1

Graficas.nb 5

Page 6: Graficas Mathematica

Automatic usaalgoritmosinternos

None No incluyaesto

All incluya todo

True realica"

False no realica

Cuando Mathematica hace una gráfica cuadra las escalas x e y para incluir

solamente las partes "interesantes". Esto hace que para ciertas funciones no

se muestren partes de la gráfica. Al especifivar la opción PlotRange es

posible controlar exactamente los rangos de coordenadas que se quieren

incluir en la gráfica.

In[8]:= Plot @Cos@x^2 D, 8x, 0, 3 <, PlotRange → 80, 1.2 <D;

0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1

La función Sin[1ÅÅÅÅx ] oscila infinitamente cuando x > 0. Mathematica trata de

utilizar una densidad más alta de puntos en este tipo de regiones pero, en

muchos casos, nunca puede reproducir el número de puntos suficiente para

representar correctamente todas las oscilaciones.

Graficas.nb 6

Page 7: Graficas Mathematica

In[9]:= Plot @Sin @1 ê xD, 8x, −1, 1 <D;

-1 -0.5 0.5 1

-1

-0.5

0.5

1

In[10]:= Plot @Sin @1 ê xD, 8x, −0.1, .1 <D;

-0.1 -0.05 0.05 0.1

-1

-0.5

0.5

1

In[11]:= Plot @Sin @1 ê xD, 8x, −0.001, .001 <D;

-0.001 -0.0005 0.0005 0.001

-1

-0.5

0.5

1

Graficas.nb 7

Page 8: Graficas Mathematica

In[12]:= Plot @Sin @1 ê xD, 8x, −0.001, .001 <, PlotPoints → 1500D;

-0.001 -0.0005 0.0005 0.001

-1

-0.5

0.5

1

La orden Show. Combinación de Gráficos

Mathematica guarda información sobre las gráficas que hace, esto hace

posible madificarlas y cambiar algunas opciones

Show@ plot D vuelve a representar una gráfica

Show@ plot, option −> value D vuelvea representar con diferentesopcionesShow@plot1, plot2, ...D combina varias gráficas

GraphicsArray@88plot1, plot2, ...<, ...<DD imprime una matriz de gráficas

InputForm @ plot D muestrala informaciónqueseguardódela gráfica

Graficas.nb 8

Page 9: Graficas Mathematica

In[13]:= Plot @ChebyshevT @7, x D, 8x, −1, 1 <D

-1 -0.5 0.5 1

-1

-0.5

0.5

1

Out[13]= � Graphics �

In[14]:= Show@%D

-1 -0.5 0.5 1

-1

-0.5

0.5

1

Out[14]= � Graphics �

Graficas.nb 9

Page 10: Graficas Mathematica

In[15]:= Show@%, PlotRange → 8−1, 2 <D

-1 -0.5 0.5 1

-1

-0.5

0.5

1

1.5

2

Out[15]= � Graphics �

In[16]:= Show@%, PlotLabel → "Un polinomio de Chebyshev" D

-1 -0.5 0.5 1

-1

-0.5

0.5

1

1.5

2Un polinomio de Chebyshev

Out[16]= � Graphics �

In[17]:= gj0 = Plot @Sin @xD, 8x, 0, 10 <D;

gy1 = Plot @Sin @2 xD, 8x, 1, 10 <D;

Graficas.nb 10

Page 11: Graficas Mathematica

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

Note las escalas diferentes

In[19]:= gjy = Show@gj0, gy1 D;

2 4 6 8 10

-1

-0.5

0.5

1

Graficas.nb 11

Page 12: Graficas Mathematica

plot 1, plot 2, ... <DD varias gráficas , una

plot 1<, 8 plot 2<, ... <DD imprime una columna

11 , plot 12 , ... <, ... <DD imprime una matrizGraphicsSpacing → 8h, v <DD define el espacio vertical y horizontal

In[20]:= Show@GraphicsArray @88gj0, gjy <, 8gy1, gjy <<DD;

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

In[21]:= Show@%, Frame → True, FrameTicks → NoneD;

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

Graficas.nb 12

Page 13: Graficas Mathematica

In[22]:= Show@%ê. HTicks → Automatic L → HTicks → NoneLD;

In[23]:= Show@%, GraphicsSpacing → 80.3, 0 <D

Out[23]= � GraphicsArray �

Gráficas de Contorno y de Densidad

Una gráfica de contorno es un mapa topográfico de una función. Las líneas

unen puntos de la superficie que tienen la misma altura. Por defecto el

sombreado de las gráficas es tal que cuanto más alta sea la función esta se

ve más clara.

8x, xmin, xmax <, 8y, ymin, ymax <D gráfica de contorno8x, xmin, xmax <, 8y, ymin, ymax <D gráfica de densidad

Graficas.nb 13

Page 14: Graficas Mathematica

In[24]:= ContourPlot @Cos@xD Sin @yD, 8x, −2, 2 <, 8y, −2, 2 <D

-2 -1 0 1 2

-2

-1

0

1

2

Out[24]= � ContourGraphics �

defecto ExplicaciónAutomatic colores a utilizar en el sombreado

cantidad de contornos a imprimir, o lista de valoresAutomatic rango de valores a representar

True utilizar sombreadopuntos de evaluación en cada dirección

True compilar o no la función

Graficas.nb 14

Page 15: Graficas Mathematica

In[25]:= ContourPlot @Cos@xD Sin @yD, 8x, −2, 2 <,

8y, −2, 2 <, ColorFunction → HueD;

-2 -1 0 1 2

-2

-1

0

1

2

Graficas.nb 15

Page 16: Graficas Mathematica

In[26]:= Show@%, ContourShading → False D;

-2 -1 0 1 2

-2

-1

0

1

2

Las gráficas de densidad muestran los valores de la función en una matriz

regular de puntos. Regiones más claras están más altas

Graficas.nb 16

Page 17: Graficas Mathematica

In[27]:= DensityPlot @Cos@xD Sin @yD, 8x, −2, 2 <, 8y, −2, 2 <D

-2 -1 0 1 2

-2

-1

0

1

2

Out[27]= � DensityGraphics �

Graficas.nb 17

Page 18: Graficas Mathematica

In[28]:= Show@%, Mesh → False D;

-2 -1 0 1 2

-2

-1

0

1

2

"

ColorFunction Automatic coloresparasombrear; Hue utiliza unasecuenciade

True dibujaro nounacuadrícula

PlotPoints 25 puntosaevaluarencadadirección

Compiled True compilaro no la función

La orden Plot3D

xmin , xmax <, 8y, ymin, ymax <D gráfica de superficie de f , función

Graficas.nb 18

Page 19: Graficas Mathematica

In[29]:= Plot3D @Cos@x y D, 8x, 0, 3 <, 8y, 0, 3 <D

0

1

2

3 0

1

2

3

-1

-0.5

0

0.5

1

0

1

2

Out[29]= � SurfaceGraphics �

Valor por defecto ExplicaciónTrue incluir ejesNone rótulos para los ejesTrue caja alrededor de la superficie

Automatic colores para el sombreado$TextStyle estilo de texto

StandardForm formato de texto

$DisplayFunction como mostrar la gráfica. Identity no laNone cuadriculas sobre las caras deTrue dibujar la superficie sólidaTrue colorear utilizando luz simuladaTrue dibuja una cuadricula sobre la

Automatic rango de las coordenadas a incluirTrue sobrea la superficie

81.3, −2.4, 2 < coordenadas del punto de vista25 número de puntos a evaluar en cada

True compila la función

Graficas.nb 19

Page 20: Graficas Mathematica

In[30]:= Show@%, PlotRange → 8−0.5, 0.5 <D;

0

1

2

3 0

1

2

3

-0.4-0.2

00.20.4

0

1

2

In[31]:= Plot3D @10 Cos@x + Sin @yDD, 8x, −10, 10 <, 8y, −10, 10 <D;

-10

-5

0

5

10 -10

-5

0

5

10

-10

-5

0

5

10

-10

-5

0

5

Graficas.nb 20

Page 21: Graficas Mathematica

In[32]:= Plot3D @10 Cos@x + Sin @yDD,

8x, −10, 10 <, 8y, −10, 10 <, PlotPoints → 50D;

-10

-5

0

5

10 -10

-5

0

5

10

-10

-5

0

5

10

-10

-5

0

5

In[33]:= Show@%, AxesLabel → 8"T", "Prof.", "Valor" <,

FaceGrids → All D;

-10

-5

0

5

10

T

-10

-5

0

5

10

Prof.

-10-505

10

Valor

-10

-5

0

5T

Graficas.nb 21

Page 22: Graficas Mathematica

In[34]:= Plot3D @Sin @x y D, 8x, 0, 3 <, 8y, 0, 3 <D;

0

1

2

3 0

1

2

3

-1

-0.5

0

0.5

1

0

1

2

In[35]:= Show@%, ViewPoint → 80, −2, 0 <D;

0 1 2 3

01

2 3

-1

-0.5

0

0.5

1

81.3 , −2.4 , 2< punto de vista por defecto

80, −2, 0< defrente

80, −2, 2< defrente y arriba

80, −2, −2< defrente y abajo

8−2, −2, 0< esquina izquierda

82, −2, 0< esquina derecha

80, 0, 2< arriba

Graficas.nb 22

Page 23: Graficas Mathematica

In[36]:= g = Plot3D @Exp@−Hx^2 + y^2 LD, 8x, −2, 2 <, 8y, −2, 2 <D;

-2

-1

0

1

2 -2

-1

0

1

2

0

0.25

0.5

0.75

1

-2

-1

0

1

In[37]:= Show@g, Mesh → False D;

-2

-1

0

1

2 -2

-1

0

1

2

0

0.25

0.5

0.75

1

-2

-1

0

1

Graficas.nb 23

Page 24: Graficas Mathematica

In[38]:= Show@g, Shading → False D;

-2

-1

0

1

2 -2

-1

0

1

2

0

0.25

0.5

0.75

1

-2

-1

0

1

In[39]:= Show@g, Lighting → False D;

-2

-1

0

1

2 -2

-1

0

1

2

0

0.25

0.5

0.75

1

-2

-1

0

1

Graficas.nb 24

Page 25: Graficas Mathematica

Representación gráfica de listas de puntos

ListPlot @ 8 y1, y2, … < D representa y1 , y2 , ... en valoresde

ListPlot @ 8 8 x1, y1 <, 8 x2, y2 <, … < D representa puntos Hx1, y1L , ...

ListPlot @ list, PlotJoined −> True D une los puntos con líneas

z11, z12, … <, 8 z21, z22, … <, … < D hace una gráfica tridimensional de

ListContourPlot @ array D hace una gráfica de contorno dealturas

ListDensityPlot @ array D hace una gráfica de densidad dealturas

In[40]:= t = Table @i ^2 − i, 8i, 10 <D;

In[41]:= ListPlot @t D

4 6 8 10

20

40

60

80

Out[41]= � Graphics �

Graficas.nb 25

Page 26: Graficas Mathematica

In[42]:= ListPlot @t, PlotJoined → True D;

4 6 8 10

20

40

60

80

In[43]:= Table @8i ^2, 2 i^2 + i <, 8i, 10 <D;

In[44]:= ListPlot @%D;

20 40 60 80 100

50

100

150

200

In[45]:= t3 = Table @Mod@x, y D, 8y, 20 <, 8x, 30 <D;

Graficas.nb 26

Page 27: Graficas Mathematica

In[46]:= ListPlot3D @t3 D;

10

20

30

5

10

15

20

0

5

10

15

10

20

In[47]:= Show@%, ViewPoint → 81.5, −0.5, 0 <D;

1020

30 5 10 15 20

0

5

10

15

Graficas.nb 27

Page 28: Graficas Mathematica

In[48]:= ListDensityPlot @t3 D;

0 5 10 15 20 25 30

0

5

10

15

20

Representación de curvas y superficies paramétricas

ParametricPlot @ 8 f x, f y <, 8 t, tmin, tmax < D gráficaparamétrica

ParametricPlot @ 8 8 f x, f y

, 8 gx, gy <, … <, 8 t, tmin, tmax < D

varias curvas a la vez

ParametricPlot @ 8 f x, f y <, 8 t, tmin,

tmax <, AspectRatio −> Automatic D

tratademantenerla formadelas

Graficas.nb 28

Page 29: Graficas Mathematica

In[49]:= ParametricPlot @8Sin @t D, Sin @2 t D<, 8t, 0, 2 Pi <D

-1 -0.5 0.5 1

-1

-0.5

0.5

1

Out[49]= � Graphics �

In[50]:= ParametricPlot @8Sin @t D, Cos @t D<, 8t, 0, 2 Pi <D;

-1 -0.5 0.5 1

-1

-0.5

0.5

1

Graficas.nb 29

Page 30: Graficas Mathematica

In[51]:= Show@%, AspectRatio → Automatic D;

-1 -0.5 0.5 1

-1

-0.5

0.5

1

ParametricPlot3D @ 8 f x, f y, f z <, 8 t, tmin, tmax < D gráficaen3D

ParametricPlot3D @ 8 f x, f y, f z

8 t, tmin, tmax <, 8 u, umin, umax < D

representación paramétrica de

ParametricPlot3D @ 8 f x, f y, f z, s <, … D sombreala gráficadeacuerdo

8 8 f x, f y, f z <, 8 gx, gy, gz <, … <, … D variosobjetosa la vez

Graficas.nb 30

Page 31: Graficas Mathematica

In[52]:= ParametricPlot3D @8Sin @t D, Cos @t D, t ê 3<, 8t, 0, 15 <D

-1 -0.5 0 0.5 1

-1-0.5

00.5

1

0

2

4

-0.500.5

1

Out[52]= � Graphics3D �

Graficas.nb 31

Page 32: Graficas Mathematica

In[53]:= ParametricPlot3D @8t, u, Sin @t u D<, 8t, 0, 3 <, 8u, 0, 3 <D

0

1

2

3

0

1

2

3

-1

-0.5

0

0.5

1

0

1

2

0

1

2

Out[53]= � Graphics3D �

Graficas.nb 32

Page 33: Graficas Mathematica

In[54]:= ParametricPlot3D @

8t, u^2, Sin @t u D<, 8t, 0, 3 <, 8u, 0, 3 <D;

01

23

0

2

4

6

8

-1

-0.5

0

0.5

1

01

2

0

2

4

6

8

Graficas.nb 33

Page 34: Graficas Mathematica

In[55]:= ParametricPlot3D @

8u Sin @t D, u Cos @t D, t ê 3<, 8t, 0, 15 <, 8u, −1, 1 <D;

-1 -0.5 0 0.51

-1-0.5

00.5

1

0

2

4

-0.500.5

1

Graficas.nb 34

Page 35: Graficas Mathematica

In[56]:= ParametricPlot3D @

8Sin @t D, Cos @t D, u <, 8t, 0, 2 Pi <, 8u, 0, 4 <D;

-1-0.5

00.5

1

-1-0.5

00.5

1

0

1

2

3

4-1

-0.50

0.5

In[57]:= ParametricPlot3D @

8Cos@t D H3 + Cos@uDL, Sin @t D H3 + Cos@uDL, Sin @uD<,

8t, 0, 2 Pi <, 8u, 0, 2 Pi <D;

-4

-2

0

2

4-4

-2

0

2

4

-1-0.5

00.5

1

-4

-2

0

2

Graficas.nb 35

Page 36: Graficas Mathematica

In[58]:= ParametricPlot3D @

8Cos@t D Cos@uD, Sin @t D Cos@uD, Sin @uD<,

8t, 0, 2 Pi <, 8u, −Pi ê 2, Pi ê 2<D;

-1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

-1

-0.5

0

0.5

-1

-0.5

0

0.5

El paquete Graphics

Graphics` carga un paquete con funciones gráficas

xmin , xmax <D gráfica log − lineal

xmin, xmax <D gráfica log − log

@lista D gráfica log − lineal de los puntos

LogLogListPlot @lista D gráfica log − log de los puntos

tmin, tmax <D gráfica polar del radio r como función

y1, dy 1<, ... <D genera una gráfica con barras

, '' s1 '' <, ... <D representa una lista de puntos, cada punto es

lista D gráfica de barras

lista D gráfica de sectores

xmin , xmax <, 8y, ymin, ymax <D campo vectorial de la función

ListPlotVectorField @lista D campo vectorial correspondiente a los

min , max <, 8phi, min, max <D gráfica esférica en

In[59]:= <<Graphics`

Graficas.nb 36

Page 37: Graficas Mathematica

In[60]:= LogPlot @Exp@−xD + 4 Exp@−2 xD, 8x, 0, 6 <D

0 1 2 3 4 5 6

0.01

0.1

1

Out[60]= � Graphics �

In[61]:= p = Table @Prime @nD, 8n, 10 <D

Out[61]= 82, 3, 5, 7, 11, 13, 17, 19, 23, 29 <

In[62]:= TextListPlot @pD

4 6 8 10

10

15

20

25

12

34

56

78

9

10

Out[62]= � Graphics �

Graficas.nb 37

Page 38: Graficas Mathematica

In[63]:= BarChart @pD;

1 2 3 4 5 6 7 8 9 10

5

10

15

20

25

In[64]:= PieChart @pD;

12

3

4

56

7

8

9

10

Animaciones

Se genera una secuencia de gráficos y si se hace doble click sobre alguna

está se mueve.

Graficas.nb 38

Page 39: Graficas Mathematica

In[65]:= Table @Plot3D @Cos@Sqrt @x^2 + y^2 D + t D,

8x, −10, 10 <, 8y, −10, 10 <, Axes → False,

PlotRange → 8−0.5, 1.0 <D, 8t, 0, 20 <D;

Graficas.nb 39