Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 :

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)

gives you a warning:

/usr/local/sage-9/local/lib/python3.7/site-packages/sage/repl/ 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 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 :

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

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