Classical Wave Equations in SageMathCloud
Suppose we want to find out whether a function is a solution to the one-dimensional classical wave equation
The variables are
- the spatial coordinate
- the time
In addition there is a parameter
- the wave's velocity, a real-valued constant independent of and
This page offers a two-step process using Sage to answer the question.
1. Solve for velocity.
If Sage finds one or more solutions for real for the above differential equation, then we know is a wave function. The value for must not depend on or . If Sage does not find a solution, we don't know for sure either way.
Use for in the following discussion.
In Sage, is given by f.diff(z,z).
Start by defining one function of , solve_for_wave_velocity() that attempts to solve the general wave equation for .
2. Test possible solutions in the original equation.
Define a second function, try_solution(f,v), that, given symbolic expressions for and , allows us to see whether substituting these expressions in the wave equation gives a tautology, i.e. that the left-hand-side is identically zero for the given definitions of and . The value returned is a symbolic expression. Sometimes the result of substitution will need additional simplification to show that it is identically zero.
Example 1.
Is a solution to the wave equation?
Example 2.
Is a solution to the wave equation?
The expression for returned by solve_for_wave_velocity() for Example 2 depends on and . That suggests this is not a wave function. In this case, it is not helpful to check the result with try_solution(f,v).
Example 3.
Is a solution to the wave equation?
Since the solution for v is a constant and the result checks, Example 3 with is a solution to the wave equation.
Example 4. A surprise.
Start with a known wave function. Change one of the constants in an attempt to "break" the function so that it is no longer a solution. Run the tests and find out the change created a new wave function.
So the second definition in Example 4 is also a wave function. How did that happen? Here are a few calculations.
References
See Week 1 content from the online course, QMSE01 Quantum Mechanics for Scientists and Engineers.
There is a matching textbook from Cambridge University Press, Quantum Mechanics for Scientists and Engineers.
The general solution to the one-dimensional wave equation, in the form , is provided by d´Alembert's formula.