I'm trying to compute c functions (from the theory of optimal transport), so I'll have to compute "supremums" for some functions $ f $ and costs $ c $

$$ g (y) = sup_ {x in mathbb {R}} c (x, y) -f (x) $$

My code works, but plotting is super slow.

```
c[x_,y_]: = - Log[Abs [x-y]+1]f[x_]: = Piecewise[{{E^(-x^2)x>0}{e^((-x^2)/5)x[{{E^(-x^2)x>0}{e^((-x^2)/5)x[{{E^(-x^2)x>0}{E^((-x^2)/5)x[{{E^(-x^2)x>0}{E^((-x^2)/5)x<=0}}]
h[x_,y_]:=c[x,y]-f[x]
g[y_]:=MaxValue[h[x,y],x]
Plot[f[x],{x,-1,1},PlotLabel->"F"]plot[g[y], {y, -1,1}, PlotLabel -> "f ^ c"]
```

How can I speed up plotting? I'm new to this area π