# How to express one function in terms of another function?

I have two different functions. How can I express $f$ as a function of $g$ in Mathematica?

f[t_] = y0 (1 - t/T)^(2/5)
g[t_] = -((2 y0)/(5 T)) (1 - t/T)^(3/5)


What Mathematica function could I use? I was thinking about Solve; but didn't manage to do it...

Edit: I don't want to define f in terms of g myself; I want Mathematica to find out what f[g] would be based on my input...

Thanks!

## 3 Answers

f[t_] = y0 (1 - t/T)^(2/5);

g[t_] = -((2 y0)/(5 T)) (1 - t/T)^(3/5);


To express f in terms of g

(f[t] /. Solve[ig == g[t], y0][] // Simplify) /. ig -> Inactive[g][t] Verifying,

(% // Activate) == f[t]

(*  True  *)


EDIT:

expr = (f[t] /. Solve[ig == g[t], t][] // FullSimplify) /.
ig -> Inactive[g][t] (expr // Activate) == f[t]

(*  True  *)


Assuming, T > t > 0 && y0 < 0

expr2 = expr // PowerExpand Assuming[T > t > 0 && y0 < 0,
(expr2 // Activate) == f[t] // Simplify]

(*  True  *)

• Almost, but it should also be possible to completely eliminate the $t$ and create f[g]. In other words; I want the $t$ in the denominator also to be expressed in terms of $g$ – GambitSquared May 1 '17 at 17:12

Could define these as equations from which to eliminate t and solve for f.

polys = {y0 (1 - t/T)^(2/5) - f,
-((2 y0)/(5 T)) (1 - t/T)^(3/5) - g};
Solve[polys == 0, f, t]

During evaluation of In:= Solve::bdomv: Warning: t is not a valid domain specification. Assuming it is a variable to eliminate.

(* Out= {{f -> ((-5)^(2/3) g^(2/3) T^(2/3) y0^(1/3))/2^(
2/3)}, {f -> (5/2)^(2/3) g^(2/3) T^(2/3) y0^(
1/3)}, {f -> -(((-1)^(1/3) 5^(2/3) g^(2/3) T^(2/3) y0^(1/3))/2^(
2/3))}} *)

1. use := instead of = i.e. f[t_] := y0 (1 - t/T)^(2/5)
2. you can define f in terms of g like calling any other function f[t_]:= g[t]. You didn't express f in terms of g in the question

Edit To find symbolic value of f[g]

In:= f[t_] := y0 (1 - t/T)^(2/5)
g[t_] := -((2 y0)/(5 T)) (1 - t/T)^(3/5)

In:= f[g[t]]

Out= y0 (1 + (2 (1 - t/T)^(3/5) y0)/(5 T^2))^(2/5)


Edit Well not sure whether I understood the question correctly. What about taking $f^{-1}$ and applying it on $g$ ?

In:= g[t] /. t -> (InverseFunction[f] /. #1 -> f)

Out= -((2 y0 (1 - ((T y0^2 - T f^2 Sqrt[f/y0])/y0^2 &)/T)^(3/5))/(
5 T))

• I don't want to define f in terms of g myself, because I want Mathematica to find out what f[g] would be based on my input... – GambitSquared May 1 '17 at 15:42
• Please mention that in your question – Neel Basu May 1 '17 at 15:43
• What if you call f[g[value]] ? – Neel Basu May 1 '17 at 15:44
• I want the symbolic expression – GambitSquared May 1 '17 at 15:45
• f[g[t]] will give you the expected result – Neel Basu May 1 '17 at 15:47