My goal is to find u (and v) as function of x and y using Sympy module. the equations are:
the answer should be:
from sympy import cosh, sinh, symbols, sin, cos, Eq
u, v, x, y = symbols('u, v, x, y')
eqq1 = Eq(x, sin(u)*cosh(v))
eqq2 = Eq(y, cos(u)*sinh(v))
what's next?
I tried
result = solve((Eqq1, Eqq2), u, v)
obviously its not the right way
CodePudding user response:
Probably not the answer that you expect, but you can rework the problem by eliminating v
, as follows:
(x cos u)² - (y sin u)² = cos²u sin²u
Then with t = sin²u
, the equation is quadratic:
x² (1 - t) - y² t = (1 - t) t
CodePudding user response:
You already know u as a function of x and y so there remains only to find v in terms of them.
Divide the sides of the equation for y by the corresponding sides of the equation for x and solve for v:
>>> V = solve(Eq(y/x,cos(u)/sin(u)*sinh(v)/cosh(v)),v)
>>> a = sqrt((x*cos(u) y*sin(u))/(x*cos(u) - y*sin(u)))
>>> assert V == [log(-a), log(a)]
So for each value of u
(whose value you already gave as a function of x
and y
) there are two values of v
.
>>> U = asin((sqrt(y**2 (x 1)**2) - sqrt(y**2 (x - 1)**2)/2)
>>> xy={x:.2,y:.1}
>>> ui = U.xreplace(xy).n(3)
>>> vi = [i.xreplace(xy).xreplace({u:ui}).n(3) for i in V];(ui,vi)
(0.929, [0.809 3.14*I, 0.809])