Interpolatingfunction : Borra Resolvedor Diferencial Numérico

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

In[2]:= Clear[y]; NDSolve[y '[x] ⩵ 3 x - 2 y[x] && y[0] ⩵ 1, y[x], {x, 0, 5}]

borra resolvedor diferencial numérico

Domain: {{0., 5.}}


Out[2]= y[x] → InterpolatingFunction [x]
Output: scalar

In[12]:= sol = NDSolve[y '[x] ⩵ 3 x - 2 y[x] && y[0] ⩵ 1, y[x], {x, 0, 5}][[1, 1, 2]]
resolvedor diferencial numérico

Domain: {{0., 5.}}


Out[12]= InterpolatingFunction [x]
Output: scalar

In[13]:= Plot[Evaluate[sol], {x, 0, 5}]


repr⋯ evalúa
7

4
Out[13]=
3

1 2 3 4 5

In[16]:= NIntegrate[sol, {x, 0, 5}]


integra numéricamente

15.875

In[39]:= sol[x_] := NDSolve[y '[t] ⩵ 3 t - 2 y[t] && y[0] ⩵ 1, y[t], {t, 0, 7}][[1, 1, 2]] //. t → x;
resolvedor diferencial numérico
sol[2.5]
sol '[2.5]
NIntegrate[sol[x], {x, 0, 5}]
integra numéricamente

Out[40]= 3.01179

Out[41]= 1.47642

Out[42]= 15.875

In[44]:= Plot[Evaluate[sol[x]], {x, 0, 5}]


repr⋯ evalúa
2

4
Out[44]=
3

1 2 3 4 5

In[45]:= tabla = Table[{x, sol[x]}, {x, 0, 5, 0.5}]


tabla
TableForm[Join[{{x, y[x]}}, tabla], TableAlignments → Center]
forma de ta⋯ junta alineamientos de tabla centro

Out[45]= {{0., 1.}, {0.5, 0.643789}, {1., 0.986837}, {1.5, 1.58713}, {2., 2.28205}, {2.5, 3.01179},
{3., 3.75434}, {3.5, 4.5016}, {4., 5.25059}, {4.5, 6.00022}, {5., 6.75008}}
Out[46]//TableForm=
x y[x]
0. 1.
0.5 0.643789
1. 0.986837
1.5 1.58713
2. 2.28205
2.5 3.01179
3. 3.75434
3.5 4.5016
4. 5.25059
4.5 6.00022
5. 6.75008

In[47]:= Clear[y]; DSolve[y '[t] ⩵ 3 t - 2 y[t] && y[0] ⩵ 1, y[t], t] //. t → x


borra resolvedor diferencial

Out[47]= y[x] → 1 ⅇ-2 x 7 - 3 ⅇ2 x + 6 ⅇ2 x x


4
3

In[76]:= Clear[sol, f];


borra
sol[x_] := NDSolve[y '[t] ⩵ 3 t - 2 y[t] && y[0] ⩵ 1, y[t], {t, 0, 7}][[1, 1, 2]] //. t → x;
resolvedor diferencial numérico
1
f[x_] := ⅇ-2 x 7 - 3 ⅇ2 x + 6 ⅇ2 x x;
4
Plot[Evaluate[{sol[x], f[x]}], {x, 0, 5},
repr⋯ evalúa
AspectRatio → 1 , PlotStyle → {Orange, {Dashed, Red, Thick}}]
cociente de aspecto estilo de repre⋯ naranja rayado rojo grueso
7

Out[78]=

1 2 3 4 5
4

In[79]:= Clear[sol, f];


borra
sol[x_] := NDSolve[y '[t] ⩵ 3 t - 2 y[t] && y[0] ⩵ 1, y[t], {t, 0, 7}][[1, 1, 2]] //. t → x;
resolvedor diferencial numérico
1
f[x_] := ⅇ-2 x 7 - 3 ⅇ2 x + 6 ⅇ2 x x;
4
diferencias = Table[{x, Abs[sol[x] - f[x]]}, {x, 0, 5, 0.5}]
tabla valor absoluto
TableForm[Join[{{x, Abs[y[x] - approx[x]] // TraditionalForm}}, diferencias],
forma de ta⋯ junta valor absoluto forma tradicional
TableAlignments → Center]
alineamientos de tabla centro

Out[81]= {0., 0.}, 0.5, 8.7844 × 10-8 , 1., 1.71113 × 10-7 , 1.5, 3.52172 × 10-9 ,
2., 9.04689 × 10-8 , 2.5, 3.18353 × 10-8 , 3., 2.4643 × 10-8 , 3.5, 1.28291 × 10-8 ,
4., 7.00039 × 10-9 , 4.5, 1.02249 × 10-8 , 5., 1.46047 × 10-9 
Out[82]//TableForm=
x y(x) - approx(x)
0. 0.
0.5 8.7844 × 10-8
1. 1.71113 × 10-7
1.5 3.52172 × 10-9
2. 9.04689 × 10-8
2.5 3.18353 × 10-8
3. 2.4643 × 10-8
3.5 1.28291 × 10-8
4. 7.00039 × 10-9
4.5 1.02249 × 10-8
5. 1.46047 × 10-9

You might also like