Learning and Teaching for Mathematical Literacy

Supporting materials – 13A

Simple quadratic equation solution

ltml.mathlit.org

This is a simple Excel spreadsheet using the familiar formula to find the roots of a quadratic. For those who wish to investigate coding, a Python version is also available.

Simple quadratic equation solution as a spreadsheet

Screen shot of spreadsheeet - click to download the spreadsheet file

Simple quadratic equation solution as python code

import math
# Enter the coefficients of the
# quadratic equation ax^2+bx+c
# below
a = 2
b = -6
c = 3

# Simple solution
d = b*b-4*a*c
print ( "Discriminant = ",d)

if d < 0:
    print ("No real solution")
    exit()

x1 = (-b-math.sqrt(d))/(2*a)
x2 = (-b+math.sqrt(d))/(2*a)

print("x = ",x1," or ",x2)

# Output:
# Discriminant =  12
# x =  0.6339745962155614  or  2.3660254037844384
The easiest way to experiment with the Python code is to click on Copy code above and then paste it into any online interpreter – such as this one from Python Principles.

The simple spreadsheets and python examples on this page may be copied freely.

Supporting material for the book Learning and Teaching for Mathematical Literacy by Hugh Burkhardt, Daniel Pead and Kaye Stacey (ISBN 9781032301174).

Contents of ltml.mathlit.org website – except where specified otherwise and excluding external link content - Copyright © Hugh Burkhardt, Kaye Stacey, Daniel Pead 2024, all rights reserved. These materials are offered "as is" with no warranty as to accuracy or fitness for purpose.

SIte operated by the BBDSC Trust