Está en la página 1de 3

Práctica 0

Gráficas
En Mathematica es posible graficar ecuaciones de una o más variables. Por ejemplo, para
grafica la función f(x)=2x 2 en el intervalo -2≤x≤5, se procede como:

Plot[2 x ^ 2, {x, - 2, 5}, PlotRange  All,


AxesLabel  {x, "f(x)"}, LabelStyle  Directive[Bold, Medium]]
In[9]:=

f(x)
50

40

30
Out[9]=

20

10

-2 -1
x
1 2 3 4 5

Otro caso: graficar la superficie de revolución g(x,y) = 3x 2 +2y 2 en el rectángulo (x.y)∈


[-6,6]×[-6,6]:

Plot3D[3 x ^ 2 + 2 y ^ 2, {x, - 6, 6}, {y, - 6, 6}, PlotRange  All,


AxesLabel  {x, y, "g(x,y)"}, LabelStyle  Directive[Bold, Medium]]
In[10]:=

Out[10]=
2 Practica_0.nb

Ecuaciones diferenciales
Podemos resolver EDO con condiciones iniciales, como:

In[25]:= DSolve[{f ''[t] + 4 f[t]  0, f[0]  1, f '[0]  2}, f[t], t]

Out[25]= {{f[t]  Cos[2 t] + Sin[2 t]}}

Graficar soluciones:

Plot[f[t] /. %[[1]], {t, 0, 10}, PlotRange  All,


AxesLabel  {x, "f(t)"}, LabelStyle  Directive[Bold, Medium]]
In[26]:=

f(t)
1.5

1.0

0.5
Out[26]=
x
2 4 6 8 10
-0.5

-1.0

-1.5

Movimiento armónico simple


x (t) = Acos (ωt + ϕ),
Se declara la función de la posición para un bloque atado a un resorte

donde ω = k / m , que admite distintos valores para m y k.

In[18]:= x[A_, t_, k_, m_, ϕ_] := A Cos[Sqrt[k / m] t + ϕ]

Se puede conocer el efecto de algunas de las variables del sistema en el movimiento del
bloque:
Practica_0.nb 3

Manipulate[Plot[x[2, t, k, m, 0], {t, 0, 10}, PlotRange  All, AxesLabel  {t, "x(t)"},


LabelStyle  Directive[Bold, Medium]], {k, 1, 4, 0.5}, {m, 1, 10, 0.1}]
In[21]:=

x(t)
2

Out[21]= 1

t
2 4 6 8 10

-1

-2

También podría gustarte