||'''Book'''|| Advanced Engineering Mathematics || ||'''Author'''|| Erwin Kreyszig || ||'''Edition'''|| 8th Edition || /* code_begins */ {{{ x = var('x') # define a variable x y = function('y',x) # define y to be a function of that variable DE = diff(y,x)*cosh(x)^2 - sin(y)^2 == 0 print 'Differential Equation:' show(DE) soln = desolve(DE, [y,x]) print 'Solution:' show(soln) print 'Explicit solution:' esoln = soln.solve(y) esoln inc_simp = (soln.solve(y)[0].rhs().subs(x=0)==pi/2) inc_simp simp = 1/tan(inc_simp).simplify_full() simp c = solve(simp,soln.variables()[0]) print 'Integration constant:' show(c) print 'Explicit solution:' esoln[0].subs(c=c[0].rhs()) }}} /* code_ends */ # Notes: desolve sometimes cannot solve the DE if ics (initial conditions) are given, but can solve it if they are not given. This shouldn't be the case, since it is simply a direct substitution * '''Solution by''': * Pankaj Pandey, Student, IIT Bombay