I am looking for differentiable functions $f$ from the unit interval to itself that satisfy the following equation $\forall\:p \in \left( 0,1 \right)$:


Is there a way to use Mathematica to solve such equations?
DSolve is of course unable to handle this -- unless there are tricks I don't know about.

  • $\begingroup$ Can you assume that an inverse exists on that interval? Might be able to use the inverse function theorem, though the changes of variables escaped me. $\endgroup$ – jlperla Oct 7 '13 at 21:34
  • $\begingroup$ jlperla: I would prefer not to assume an inverse exists, but will be still be glad to find one or more solutions under that, or any other reasonable assumption. $\endgroup$ – WillO Oct 7 '13 at 22:44
  • $\begingroup$ If you define $g(p) = f\bigl(f(p)\bigr)$, the equation becomes $1 - p - g(p) - f(p)g'(p)/f'(p) = 0$, but I don't know if you can get anywhere from here. $\endgroup$ – user484 Oct 8 '13 at 2:28
  • $\begingroup$ @RahulNarain: Yes, I was ahead of you on this --- and if you multiply through by $f'(p)$, you get the derivative of $(fg)$ showing up there --- but I didn't manage to make much use of it. $\endgroup$ – WillO Oct 8 '13 at 2:56
  • 1
    $\begingroup$ @Wizard: I did in fact ask a version of this question on MSE, but this (it seems to me) is a genuinely different question, i.e. "Does Mathematica have any built-in packages that are equipped to solve such equations?". That, I think, is a question about Mathematica and not about mathematics. No? $\endgroup$ – WillO Oct 8 '13 at 15:25

At least you can eliminate $p$:

continue[{exprs__}, f_] :=
  , Rule | RuleDelayed, # /. f &
  , _, f]@Last@#]& @ {exprs}

toRHS[term_][lhs_ == rhs_] := lhs - term == rhs - term
multiplyBothSidesBy[x_]@e_Equal := # x & /@ e
privateDRule = f_'[x_] :> d[f@x]/d[x];
integrateLocally = u_ d[v_] :> d[u v] - v d[u];
integrateGlobally = u_ d[v_] + v_ d[u_] :> d[u v];
outMinus = d[-x_] :> -d[x];

Check the result:

Column[#, Spacings -> 1]& @
Fold[continue, {1 - p - f[f[p]] - f[p] f'[f[p]] == 0}, {
  f[p] -> u,
  toRHS[1 - p],
  privateDRule, Expand,
  MapAt[# /. integrateLocally &, #, 1] &,
  Composition[Simplify /@ # &, multiplyBothSidesBy[-(d@u)^-1]],
  p -> InverseFunction[f][u]}] // TraditionalForm

$\frac{d(u f(u))}{du}=1-f^{-1}(u)$

I give this “answer” primarily because I rarely see people using Mathematica this way — and your nasty nested (no pun intended) expression allows a clear demonstration of this use of Mma. The language is good for explaining the (possibly incomplete) idea, and for immediate check if the idea works, in the same time.

| improve this answer | |

If f is differentiable in the unit interval then it has a power series expansion in that interval. Use an assumed polynomial trial of order order in variable var to denote that expansion

ClearAll[trial, equation, solutions];

    trial[order_, var_] := 
 Block[{vars = Table[ToExpression["a" <> ToString[i]], {i, 0, order}]},
  vars.(var^Range[0, order])

then you can plug this into the differential equation:

equation[order_, var_] := Module[{f},
  f[var2_] := trial[order, var2];
  1 - var - f[f[var]] - f[var] f'[f[var]]

and for every order you get an equation in the coefficients of the trial polynomial which you can use Solve on:

solutions[order_, var_] := 
 Block[{vars = Table[ToExpression["a" <> ToString[i]], {i, 0, order}]},
  Solve[Thread[CoefficientList[equation[order, var], var] == 0], vars]

You see that the equation is solved by a first order polynomial (and its CC) and higher order coefficients are zero (up to order 5 this is reasonably fast to calculate):

solutions[3, p]

{{a0 -> 1/3 (1 - I Sqrt[2]), a1 -> I/Sqrt[2], a2 -> 0, 
  a3 -> 0}, {a0 -> 1/3 (1 + I Sqrt[2]), a1 -> -(I/Sqrt[2]), a2 -> 0, 
  a3 -> 0}}

so your equation is solved by:

{f1[p_],f2[p_]} = trial[1, p] /. solutions[1, p]

{1/3 (1 - I Sqrt[2]) + (I p)/Sqrt[2], 
 1/3 (1 + I Sqrt[2]) - (I p)/Sqrt[2]}

Check that

1 - p - f[f[p]] - f[p] f'[f[p]]/.f->f1// Simplify
(* 0 *)


1 - p - f[f[p]] - f[p] f'[f[p]]/.f->f2// Simplify
(* 0 *)
| improve this answer | |
  • $\begingroup$ Thanks. I do appreciate the effort, but your $f$ is not a function from the unit interval to itself. In fact I now have a proof that there are no such functions. $\endgroup$ – WillO Apr 25 '14 at 19:53

To answer the question of: does mathematica have facilities for this sort of thing. I think there may be 2 parts: 1) Does mathematica have facilities for general function equations (forgetting even the differential)? I think the answer is no in general. There are certain (recurrence) equations it can solve with RSolve, but the function is mostly intended for difference equations. Regardless, it doesn't seem that RSolve is intended to solve coupled recurrence and differential equations (which I think are called delay-differential equations).

2) If I transform you ODE into something more standard, I think the best you could do is invert pieces of the function and then use the inverse function theorem to transform derviatives between/from the inverse (with a smart set of changes of variables).

But... based on the structure of the problem, my guess is that the best you could possibly transform it into is a delay differential equation as you would end up with an $f^{-1}(p-1)$ after the first inversion. Mathematica has facilities for delay-differential equations, but I think they are only numerical. http://www.wolfram.com/products/mathematica/newin7/content/DelayDifferentialEquations/

| improve this answer | |
  • $\begingroup$ But, there's a big but...t, Mathematica can solve functional equations :) $\endgroup$ – Sektor Oct 8 '13 at 17:11
  • $\begingroup$ Great! Can it solve general functional equations or just in certain examples? How would I solve the canonical: $f[x + y] == f[x] f[y]$ (where one solution is $f[x]:= e^{c x}$ of course, for any c) $\endgroup$ – jlperla Oct 8 '13 at 17:26
  • $\begingroup$ Look up RSolve under Basic Examples $\endgroup$ – Sektor Oct 8 '13 at 17:29
  • $\begingroup$ I thought RSolve only helped with recurrence equations (and mostly linear ones)? If so, I don't see how it can be used to solve $f(x + y) == f(x) f(y)$? But perhaps there is a way I don't see? Can you show the mathematica code? $\endgroup$ – jlperla Oct 8 '13 at 17:33
  • 2
    $\begingroup$ See my change above to the answer above. Would love to see the solution to the above functional equation (which I don't think is a difference equation, but would really help me out if you could solve it). $\endgroup$ – jlperla Oct 8 '13 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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