Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solving for an unknown function in a logarithmic expression

Hello,

Please consider the following code:

k=var('k')
f=function('f')(x)
solve(-1/3*log(f(x) + 1) + 1/3*log(f(x) - 2) == -k+x, f,to_poly_solve=True)

even if I call the solve function as

solve(-1/3*log(f(x) + 1) + 1/3*log(f(x) - 2) == -k+x, f(x),to_poly_solve=True)

or

solve(-1/3*log(f + 1) + 1/3*log(f - 2) == -k+x, f,to_poly_solve=True)

or

solve(-1/3*log(f+ 1) + 1/3*log(f - 2) == -k+x, f(x),to_poly_solve=True)

This always throws back [] at me.

However, if I substitue the function f with the variable z as shown below

k=var('k')
f=function('f')(x)
z=var('z')
solve((-1/3*log(f(x) + 1) + 1/3*log(f(x) - 2) == -k+x).subs(f(x)==z), z,to_poly_solve=True)

I get an answer

[z == (2*e^(3*k) + e^(3*x))/(e^(3*k) - e^(3*x))]

Under normal circumstances (where I don't need to use to_poly_solve=True) solve solves for the function.

Is there anyway to solve for a function (without the need to substitute it with a variable) when to_poly_solve=True is enabled?

Thanks in advance