func parseAdvancedOperations(equation string, debug bool) string {
	// starts from the innermost power in the equation
	powerOpRegex := regexp.MustCompile(`\-?\d+(\.\d+)?\^\{[^\{\}]*\}`)
	// starts from the innermost sqrt in the equation
	sqrtOpRegex := regexp.MustCompile(`sqrt\{[^\{\}]+\}`)
	// starts from the innermost sin in the equation
	sinOpRegex := regexp.MustCompile(`sin\{[^\{\}]+\}`)
	// starts from the innermost cos in the equation
	cosOpRegex := regexp.MustCompile(`cos\{[^\{\}]+\}`)
	// starts from the innermost tan in the equation
	tanOpRegex := regexp.MustCompile(`tan\{[^\{\}]+\}`)

	// parse all sqrt in equation
	for sqrtOpIndex := sqrtOpRegex.FindStringIndex(equation); sqrtOpIndex != nil; sqrtOpIndex = sqrtOpRegex.FindStringIndex(equation) {
		equation = parseSqrt(sqrtOpIndex, equation, debug)
	}
	// parse all exponents in equation
	for powerOpIndex := powerOpRegex.FindStringIndex(equation); powerOpIndex != nil; powerOpIndex = powerOpRegex.FindStringIndex(equation) {
		equation = parsePower(powerOpIndex, equation, debug)
	}
	// parse all sin in equation
	for sinOpIndex := sinOpRegex.FindStringIndex(equation); sinOpIndex != nil; sinOpIndex = sinOpRegex.FindStringIndex(equation) {
		equation = parseSin(sinOpIndex, equation, debug)
	}
	// parse all cos in equation
	for cosOpIndex := cosOpRegex.FindStringIndex(equation); cosOpIndex != nil; cosOpIndex = cosOpRegex.FindStringIndex(equation) {
		equation = parseCos(cosOpIndex, equation, debug)
	}
	// parse all tan in equation
	for tanOpIndex := tanOpRegex.FindStringIndex(equation); tanOpIndex != nil; tanOpIndex = tanOpRegex.FindStringIndex(equation) {
		equation = parseTan(tanOpIndex, equation, debug)
	}
	return equation
}
// parses all advanced operations (any that have {} brackets)
parses all advanced operations (any that have {} brackets)
// parses all advanced operations ( any that have {} brackets )
func parseAdvancedOperations(equation string, debug bool) string {
	powerOpRegex := regexp.MustCompile(`\-?\d+(\.\d+)?\^\{[^\{\}]*\}`)
	sqrtOpRegex := regexp.MustCompile(`sqrt\{[^\{\}]+\}`)
	sinOpRegex := regexp.MustCompile(`sin\{[^\{\}]+\}`)
	cosOpRegex := regexp.MustCompile(`cos\{[^\{\}]+\}`)
	tanOpRegex := regexp.MustCompile(`tan\{[^\{\}]+\}`)
	for sqrtOpIndex := sqrtOpRegex.FindStringIndex(equation); sqrtOpIndex != nil; sqrtOpIndex = sqrtOpRegex.FindStringIndex(equation) {
		equation = parseSqrt(sqrtOpIndex, equation, debug)
	}
	for powerOpIndex := powerOpRegex.FindStringIndex(equation); powerOpIndex != nil; powerOpIndex = powerOpRegex.FindStringIndex(equation) {
		equation = parsePower(powerOpIndex, equation, debug)
	}
	for sinOpIndex := sinOpRegex.FindStringIndex(equation); sinOpIndex != nil; sinOpIndex = sinOpRegex.FindStringIndex(equation) {
		equation = parseSin(sinOpIndex, equation, debug)
	}
	for cosOpIndex := cosOpRegex.FindStringIndex(equation); cosOpIndex != nil; cosOpIndex = cosOpRegex.FindStringIndex(equation) {
		equation = parseCos(cosOpIndex, equation, debug)
	}
	for tanOpIndex := tanOpRegex.FindStringIndex(equation); tanOpIndex != nil; tanOpIndex = tanOpRegex.FindStringIndex(equation) {
		equation = parseTan(tanOpIndex, equation, debug)
	}
	return equation
}
func parseAdvancedOperations ( equation string , debug bool ) string { powerOpRegex := regexp . MustCompile ( `\-?\d+(\.\d+)?\^\{[^\{\}]*\}` ) sqrtOpRegex := regexp . MustCompile ( `sqrt\{[^\{\}]+\}` ) sinOpRegex := regexp . MustCompile ( `sin\{[^\{\}]+\}` ) cosOpRegex := regexp . MustCompile ( `cos\{[^\{\}]+\}` ) tanOpRegex := regexp . MustCompile ( `tan\{[^\{\}]+\}` ) for sqrtOpIndex := sqrtOpRegex . FindStringIndex ( equation ) ; sqrtOpIndex != nil ; sqrtOpIndex = sqrtOpRegex . FindStringIndex ( equation ) { equation = parseSqrt ( sqrtOpIndex , equation , debug ) } for powerOpIndex := powerOpRegex . FindStringIndex ( equation ) ; powerOpIndex != nil ; powerOpIndex = powerOpRegex . FindStringIndex ( equation ) { equation = parsePower ( powerOpIndex , equation , debug ) } for sinOpIndex := sinOpRegex . FindStringIndex ( equation ) ; sinOpIndex != nil ; sinOpIndex = sinOpRegex . FindStringIndex ( equation ) { equation = parseSin ( sinOpIndex , equation , debug ) } for cosOpIndex := cosOpRegex . FindStringIndex ( equation ) ; cosOpIndex != nil ; cosOpIndex = cosOpRegex . FindStringIndex ( equation ) { equation = parseCos ( cosOpIndex , equation , debug ) } for tanOpIndex := tanOpRegex . FindStringIndex ( equation ) ; tanOpIndex != nil ; tanOpIndex = tanOpRegex . FindStringIndex ( equation ) { equation = parseTan ( tanOpIndex , equation , debug ) } return equation }
parses all advanced operations (any that have {} brackets)
parses all advanced operations ( any that have {} brackets )
// starts from the innermost power in the equation // starts from the innermost sqrt in the equation // starts from the innermost sin in the equation // starts from the innermost cos in the equation // starts from the innermost tan in the equation // parse all sqrt in equation // parse all exponents in equation // parse all sin in equation // parse all cos in equation // parse all tan in equation