View or download solveTrigonometric.frink in plain text format
/** This contains sloppy and non-rigorous solvers for equations containing
trigonometric equations. It is only intended for real-valued arguments
and will not find all solutions. It is used as a starting point only.
THINK ABOUT: Will it be better to transform functions to be in terms
of sin and cos when possible? (Especially sec, csc, cot, etc., but maybe
also tan and hyperbolic functions?) This will greatly reduce the number
of solvers that we have to write.
TODO: Maybe implement some more simplifiers from here:
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
*/
transformations solveTrigonometric
{
// Trig solvers
solve[sin[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === arcsin[_y], _theta]
solve[cos[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === arccos[_y], _theta]
solve[tan[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === arctan[_y], _theta]
// Inverse trig solvers
solve[arcsin[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === sin[_y], _theta]
solve[arccos[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === cos[_y], _theta]
solve[arctan[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === tan[_y], _theta]
// Hyperbolic trig function solvers
solve[sinh[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === arcsinh[_y], _theta]
solve[cosh[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === arccosh[_y], _theta]
solve[tanh[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === arctanh[_y], _theta]
// Inverse hyperbolic trig function solvers
solve[arcsinh[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === sinh[_y], _theta]
solve[arccosh[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === cosh[_y], _theta]
solve[arctanh[_a] === _y, _theta] :: expressionContains[_a, _theta] <-> solve[_a === tanh[_y], _theta]
// Function and its inverse
sin[arcsin[_x]] <-> _x
cos[arccos[_x]] <-> _x
tan[arctan[_x]] <-> _x
arcsin[sin[_x]] <-> _x
arccos[cos[_x]] <-> _x
arctan[tan[_x]] <-> _x
sinh[arcsinh[_x]] <-> _x
cosh[arccosh[_x]] <-> _x
tanh[arctanh[_x]] <-> _x
arcsinh[sinh[_x]] <-> _x
arccosh[cosh[_x]] <-> _x
arctanh[tanh[_x]] <-> _x
// Simplifying functions
// See: https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
cos[arcsin[_x]] <-> sqrt[1 - _x^2]
tan[arcsin[_x]] <-> _x / sqrt[1 - _x^2]
sin[arccos[_x]] <-> sqrt[1 - _x^2]
tan[arccos[_x]] <-> sqrt[1 - _x^2] / _x
sin[arctan[_x]] <-> _x / sqrt[1 + _x^2]
cos[arctan[_x]] <-> 1 / sqrt[1 + _x^2]
// Turn csc, sec, cot in to expressions in terms of sin, cos, tan.
// This lets us write many fewer solving rules!
sec[_x] <-> 1 / cos[_x]
csc[_x] <-> 1 / sin[_x]
cot[_x] <-> 1 / tan[_x]
arcsec[_x] <-> arccos[1 / _x]
arccsc[_x] <-> arcsin[1 / _x]
arccot[_x] <-> arctan[1 / _x]
}
View or download solveTrigonometric.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 18377 days, 0 hours, 25 minutes ago.