Pregunta

I am working on a solution to solve a Partial Differential Equation, Fick's Second Law of Diffusion to be exact. I was able to produce a 3D Plot using the NDSolve and Plot3D functions. Code used:

NDSolve[{D[c[t, h], t] == 1*D[c[t, h], h, h],
               c[0, h] == Erfc[h/(2*81.2)], 
               c[t, 0] == 1, 
            c[t, 4000] == 3.08*^-18}, c, {t, 0, 900}, {h, 0, 274}]

Instead of a graphical representation, I would like to find numerical points of the graph at t = 900. I would like to know how to put in t = 900 into NDSolve (or other functions) so as to generate detailed numerical points of the solution.

¿Fue útil?

Solución

Try saving the solution in a variable first:

e = NDSolve[{D[c[t, h], t] == 1*D[c[t, h], h, h], c[0, h] == Erfc[h/(2*81.2)], c[t, 0] == 1, c[t, 4000] == 3.08*^-18}, c, {t, 0, 900}, {h, 0, 274}]

Then we can Evaluate this expression for our desired variables:

Evaluate[c[900, 10] /. e]
(*{0.914014}*)

Or to make it more versatile, we can use Manipulate:

Manipulate[Evaluate[c[t, h] /. e], {t, 0, 900}, {h, 0, 274}]

Manipulate

Update: Considering the information I received from the comments below; we can define a function like q[t,h] which will give us the solution as a function:

q[t_, h_] := Evaluate[c[t, h] /. e]
q[900, 10]
(*{0.914014}*)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top