## Flux and Mixed Boundary Conditions

We now show a common trick that can be used to construct methods of the same accuracy as above when boundary conditions other than  are used; namely, while  specifies the value of the unknown at the boundaries (recall that it was set to 0 without loss of generality), in some problems it may be the flux of u, or a linear combination of « and its flux, that are to be specified. Since the flux of u is proportional to 8xu, it is the calculation of 8xu at the boundary with accuracy O(h2) that requires special treatment. Thus, consider the condition at, say, the left boundary, which replaces the first condition in :

where q(t) and b(t) are known for any t. When q(t) = 0, this is called a Neumann boundary condition, and when q(t) = 0, a mixed, or Robin, boundary condition. One discretizes  by introducing a fictitious node at x =—h :

where U—1 — u(—h, tn); the accuracy of this approximation is O(h2) (cf. ). This one equation introduces two new unknowns, U0 and U— j. Therefore, one more equation involving these quantities must be supplied. Such an equation is given by the first equation in  with m — 0 for explicit methods and by  with m — 0 for implicit ones. For explicit methods, this concludes the treatment of . For implicit methods, one more step is needed. Recall that to render the solution of the matrix equation  time-efficient, the matrix on its LHS must be tridiagonal. If  and  with m — 0 are both included separately into the counterpart of  arising for boundary conditions , the resulting matrix is not tridiagonal. To circumvent this problem, one should, instead of including the aforementioned two equations separately, solve  for U— 1 and substitute the result into  with m — 0. Then the matrix in question becomes tridiagonal and the analog of  can be solved time-efficiently. 