(* AdjointFinder: If you use this in your research or teaching, please cite the webpage: 
https://gokulhari.github.io/webpage/AdjointFinder.html
and the paper:
G.Hariharan, S.Kumar, and M.R.Jovanovic, Well-conditioned ultraspherical and spectral integration methods for resolvent analysis of channel flows of Newtonian and viscoelastic fluids, Phys.Rev.Fluids, 2020, note:Submitted}
Written by Gokul Hariharan (harih020@umn.edu)
*)

Once[Get["~/Desktop/AdjointFinder.wl"]] (* Call this once, adjust this based on where you store the pack *)
(* Call Clear[AdjointFinder`] to clear all functions in this context *)
?Adjoint

(* Define the equations for a simple differential equation with mixed boundary conditions *)
eq1 = v''[y] + (2(y^2)+1)v'[y]+ v[y];
{eqAd,eqBc} = Adjoint[{eq1},{2 v[-1]+ 3v'[-1]} ,{4 v[1] + 5 v'[1]},{y,-1,1},{v,2}];
Print["Adjoint Equations: "]
Print[eqAd]
Print["Adjoint Boudary conditions: "]
Print[eqBc]