I don't have much experience with solving equations using mathematica. I have the following equation:

$$A=u\cdot f^{-1}(u)-\int_a^{f^{-1}(u)}f(x)dx$$ For some given constant $A>0$ and $a\in[0,1]$, and given function $f$, with the following properties:

  • $f(x)\geq 0$. $f(x)=0$ on $x\in[0,a]$
  • $f^{-1}(u)\in [a,1]$
  • I know that $u>0$ will hold

How do I tell mathematica to solve for $u$? I don't know where to start. I would be satisfied with a numerical solution.

Actually, Perhaps there is some good tutorial that would teach me these things?


If you substitute

\[Lambda] -> (f^-1)[u]

your equation becomes

A==\[Lambda] f[\[Lambda]]-\!\(\*SubsuperscriptBox[\(\[Integral]\), \(a\),\(\[Lambda]\)]\(f[x] \[DifferentialD]x\)\)    

a little bit nicer! enter image description here

If you know the antiderivative function of f[x] you can solve your problem using FindRoot[], otherwice numerical integration...


gl = \[Lambda] Max[0, \[Lambda] - 0.5] -Integrate[Max[0, x - .5], {x, 0.5, \[Lambda]}] - 10
Plot[gl, {\[Lambda], 0, 10}]
NMinimize[{1, gl == 0}, \[Lambda]]
(* {\[Lambda] -> 4.5}*)

Numerical version(NIntegrate):

int[ \[Lambda]_?NumericQ] :=NIntegrate[Max[0, x - .5], {x, 0.5, \[Lambda]}]
gl = \[Lambda] Max[0, \[Lambda] - 0.5] - int[\[Lambda]] - 10
Plot[gl, {\[Lambda], 0, 10}]
NMinimize[{1, gl == 0}, \[Lambda]]
  • $\begingroup$ Thank you. The problem is, I know how to numerically integrate an integral, but I don't know how to do it if $\lambda$ as you've defined it, is unknown, and to then solve for lambda $\endgroup$ – user56834 Jan 9 '18 at 14:59
  • $\begingroup$ An example would help! $\endgroup$ – Ulrich Neumann Jan 9 '18 at 16:12
  • $\begingroup$ Ok, say $a=0.5$, and $f(x)=max(0,x-a)$, $A =10$ $\endgroup$ – user56834 Jan 9 '18 at 17:36


(My first version had a serious error.)

Your example function is simple enough that the problem can be solved exactly. If you have a more complicated function in mind, then it might make sense to use an NDSolve approach instead, but you will need to provide such an example before I show that approach.

First, here is your equation:

Block[{if = InverseFunction[f]},
    eqn = A == u[A] if[u[A]] - Integrate[f[x], {x, a, if[u[A]]}]
eqn //TeXForm

$A=u(A) f^{(-1)}(u(A))-\int_a^{f^{(-1)}(u(A))} f(x) \, dx$

The example in the comments had:

f[x_] := Max[0, x-a]

Having the inverse will also be convenient:

if[u_] = x /. First @ Solve[f[x] == u, x, Reals]

ConditionalExpression[a + u, u > 0]

Using the above example function, we obtain:

eqn2 = Simplify[eqn /. InverseFunction[f]->if, u[A]>0]

2 A == u[A] (2 a + u[A])

Solving for u[A] yields:

Simplify[Reduce[eqn2, u[A], Reals], u[A]>0 && a>0 && A>0]

Sqrt[a^2 + 2 A] == a + u[A]

Finally, we obtain the following plot for u[A]:

    Plot[-a + Sqrt[a^2 + 2 A], {A, 0, 10}]

enter image description here

  • $\begingroup$ I don't understand why those two constraints imply $a=0$? $\endgroup$ – user56834 Jan 9 '18 at 14:57
  • $\begingroup$ Where did you get $0=f^{-1}(u)$? $\endgroup$ – user56834 Jan 9 '18 at 17:39
  • $\begingroup$ I am not quite sure, but it seems that the by calculating the derivative of the initial equation with respect to u one immediately finds f^(-1)(u)==0, is not it? $\endgroup$ – Alexei Boulbitch Jan 10 '18 at 11:33
  • $\begingroup$ @AlexeiBoulbitch You're making the same error I originally made. Consider the equation $x^2=1$. Taking a derivative with respect to $x$ does not yield the same roots. $\endgroup$ – Carl Woll Jan 10 '18 at 15:10
  • $\begingroup$ @ Carl Woll That was also my concern. On the other hand, taking a derivative is a rather standard trick for integral equations, though, of course, all information about A is lost. $\endgroup$ – Alexei Boulbitch Jan 10 '18 at 15:45

I would suggest having a look at the reference docs...or trying again to search for closely related problems with google...you may end up on S.E again.



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.