1
$\begingroup$

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!

$\endgroup$

3 Answers 3

1
$\begingroup$
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][[1]] // Simplify) /. ig -> Inactive[g][t]

enter image description here

Verifying,

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

(*  True  *)

EDIT:

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

enter image description here

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

(*  True  *)

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

expr2 = expr // PowerExpand

enter image description here

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

(*  True  *)
$\endgroup$
1
  • $\begingroup$ 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$ $\endgroup$ May 1, 2017 at 17:12
3
$\begingroup$

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[91]:= Solve::bdomv: Warning: t is not a valid domain specification. Assuming it is a variable to eliminate.

(* Out[92]= {{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))}} *)
$\endgroup$
0
$\begingroup$
  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[3]:= f[t_] := y0 (1 - t/T)^(2/5)
g[t_] := -((2 y0)/(5 T)) (1 - t/T)^(3/5)

In[5]:= f[g[t]]

Out[5]= 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[10]:= g[t] /. t -> (InverseFunction[f] /. #1 -> f)

Out[10]= -((2 y0 (1 - ((T y0^2 - T f^2 Sqrt[f/y0])/y0^2 &)/T)^(3/5))/(
 5 T))
$\endgroup$
8
  • $\begingroup$ 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... $\endgroup$ May 1, 2017 at 15:42
  • $\begingroup$ Please mention that in your question $\endgroup$
    – Neel Basu
    May 1, 2017 at 15:43
  • $\begingroup$ What if you call f[g[value]] ? $\endgroup$
    – Neel Basu
    May 1, 2017 at 15:44
  • $\begingroup$ I want the symbolic expression $\endgroup$ May 1, 2017 at 15:45
  • $\begingroup$ f[g[t]] will give you the expected result $\endgroup$
    – Neel Basu
    May 1, 2017 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.