# How would I use mathematica to solve this equation?

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]


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


a little bit nicer!

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

example:

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]]

• 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 – user56834 Jan 9 '18 at 14:59
• An example would help! – Ulrich Neumann Jan 9 '18 at 16:12
• Ok, say $a=0.5$, and $f(x)=max(0,x-a)$, $A =10$ – user56834 Jan 9 '18 at 17:36

Update

(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.

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$

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]:

Block[{a=.5},
Plot[-a + Sqrt[a^2 + 2 A], {A, 0, 10}]
]


• I don't understand why those two constraints imply $a=0$? – user56834 Jan 9 '18 at 14:57
• Where did you get $0=f^{-1}(u)$? – user56834 Jan 9 '18 at 17:39
• 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? – Alexei Boulbitch Jan 10 '18 at 11:33
• @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. – Carl Woll Jan 10 '18 at 15:10
• @ 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. – 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.

https://reference.wolfram.com/language/ref/Integrate.html