Writing Equations from Patterns