I
I
Ilya Garbazhiy2020-11-27 12:20:28
Python
Ilya Garbazhiy, 2020-11-27 12:20:28

Non-decimal fractions and Python how?

There is an expression cos (a) / sin (a), in simple terms it is arctg (a).
sin(alpha) = a/c
cos(alpha) = b/c
As far as I understand (not strong in trigonometry, because I'm an eighth grader). Everyone knows that when dividing a sine by a cosine, c will decrease. I need to get ax and bx from this expression, where x is a certain coefficient. x is arbitrary and is set by me directly from the code. That is, in fact, I need to get the numerator and denominator separately of the fraction a / b, while not knowing c.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-11-27
@fox_12

There is a sympy module in Python for this .
I can’t figure out what expression you need to compose, but it copes with symbolic mathematics:

import sympy as sym

x = sym.Symbol('x')
sym.simplify(sym.sin(x)/sym.cos(x))
# tan(x)

a = sym.Symbol('a')
b = sym.Symbol('b')
c = sym.Symbol('c')
sym.simplify((a/c)/(b/c))
# a/b

5fc0c9813bf11264540641.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question