solving partial differential equations tol - for in range( shape[ ])diff abs(u_exact(xt[ ] [ ,:]max(assert diff tol'diff= gdiff print 'diff=% at =% (difft[ ]with we reproduce the linear solution exactly this brings confidence to the implementationwhich is just what we need for attacking real physical problem next problems with reusing the rhs function the rhs function must take and as argumentsbecause that is required by the ode_fe function what about the variables betadxlxdsdtgand dudx that the rhs function needsthese are global in the solution we have presented so far unfortunatelythis has an undesired side effectwe cannot import the rhs function in new filedefine dudx and dsdt in this new file and get the imported rhs to use these functions the imported rhs will use the global variablesincluding functionsin its own module how can we find solutions to this problemtechnicallywe must pack the extra data betadxlxdsdtgand dudx with the rhs functionwhich requires more advanced programming considered beyond the scope of this text class is the simplest construction for packing function together with datasee the beginning of in [ for detailed example on how classes can be used in such context another solution in pythonand especially in computer languages supporting functional programmingis so called closures they are also covered in in the mentioned reference and behave in magic way the third solution is to allow an arbitrary set of arguments for rhs in list to be transferred to ode_fe and then back to rhs appendix in [ explains the technical details applicationheat conduction in rod let us return to the case with heat conduction in rod ( )-( assume that the rod is cm long and made of aluminum alloy the parameter equals % /where is the heat conduction coefficientis the densityand is the heat capacity we can find proper values for these physical quantities in the case of this aluminum alloy : kg/ mk kkg results in %cd : = preliminary simulations show that we are close to constant steady state temperature after hi the rhs function from the previous section can be reusedonly the functions sdsdtgand dudx must be changed (see file rod_fe py)def dudx( )return def ( )return