# Revision history [back]

solve solves for variables, not for functions. But, noting that you do not use the function per se but only function value, you can get (approximately) what you want by substituting a temporary variable to this unknown function value. Executing :

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


gives you a warning:

/usr/local/sage-9/local/lib/python3.7/site-packages/sage/repl/load.py:272: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...) See http://trac.sagemath.org/5930 for details.

But, nonetheless :

sage: f
x |--> (2*e^(3*k) + e^(3*x))/(e^(3*k) - e^(3*x))


My preferences would rather go to :

k,z=var('k,z')
S=solve((-1/3*log(z + 1) + 1/3*log(z - 2) == -k+x), z, to_poly_solve=True)
f(x)=S[0].rhs()


which doesn't declare f only to redefine it two lines down...

HTH,