math

package
v0.0.0-...-5cc4ecd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicExpression

type BasicExpression struct {
	First      int    `json:"first"`      // First number of the expression
	Second     int    `json:"second"`     // Second number of the expression
	Operation  string `json:"operation"`  // Symbol of the operation
	Expression string `json:"expression"` // Full expression as a string
	Answer     int    `json:"answer"`     // Result of the expression
}

Basic structure of the expressions with addition, subtraction, multiplication, and division

func GetAddition

func GetAddition(minFirst, maxFirst, minSecond, maxSecond int) BasicExpression

Get a random addition expression with a given range of numbers

func GetDivision

func GetDivision(minFirst, maxFirst int) BasicExpression

Get a random division expression with a given range of numbers

func GetMultiplication

func GetMultiplication(minFirst, maxFirst, minSecond, maxSecond int) BasicExpression

Get a random multiplication expression with a given range of numbers

func GetSubtraction

func GetSubtraction(minFirst, maxFirst, minSecond, maxSecond int, allowNegative bool) BasicExpression

Get a random subtraction expression with a given range of numbers

type QuadraticEquation

type QuadraticEquation struct {
	Equation     string `json:"equation"`     // Full quadratic equations as a string
	A            int    `json:"a"`            // A coefficient of the quadratic equations
	B            int    `json:"b"`            // B coefficient of the quadratic equations
	C            int    `json:"c"`            // C coefficient of the quadratic equations
	Discriminant int    `json:"discriminant"` // Discriminant of the quadratic equations
	X1           string `json:"x1"`           // First root of the quadratic equation
	X2           string `json:"x2"`           // Second root of the quadratic equation
}

Structure for quadratic equation

func GetQuadratic

func GetQuadratic(minA, maxA, minB, maxB, minC, maxC int) QuadraticEquation

Get a random quadratic expression with a given range of coefficients

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL