Advanced Calculus and its Applications in Variational Quantum Mechanics and Relativity Theory