# Solving integral equation via Laplace transform

I want to solve the following integral equation

$$\int_0^\tau \ddot{\Psi}(t-t')g(t')dt'= g(\tau^-)\dot{\Psi}(\tau-t)+g(0^+)\dot{\Psi}(t),$$

where $$\Psi$$ is a even function, $$g(\tau^-)\neq g(0^+)$$ and $$0. This problem arrives from the optimization of a functional.

I know integral equations are hard to solve, but I tried to give me a chance and use Laplace transform $$\mathcal{L}$$ in the variable $$t$$ to solve that problem. In this manner,

$$\mathcal{L}\left[\int_0^\tau \ddot{\Psi}(t-t')g(t')dt'\right]= \mathcal{L}\left[g(\tau^-)\dot{\Psi}(\tau-t)+g(0^+)\dot{\Psi}(t)\right]$$

$$\int_0^\tau e^{-st'}g(t')dt' = \frac{(g(0^+)-g(\tau^-)e^{-s\tau})(s\tilde{\Psi}(s)-\Psi(0^+))}{s^2\tilde{\Psi}(s)-s\Psi(0^+)-\dot{\Psi}(0^+)}.$$

Using the inverse Laplace Transform $$\mathcal{L}^{-1}$$, we have

$$g(t) = \int_0^\tau \delta(t'-t)g(t')dt' = \mathcal{L}^{-1}\left[\frac{(g(0^+)-g(\tau^-)e^{-s\tau})(s\tilde{\Psi}(s)-\Psi(0^+))}{s^2\tilde{\Psi}(s)-s\Psi(0^+)-\dot{\Psi}(0^+)}\right].$$

However, when I tried to use that formula in a simple example I got a wrong answer. Below my code from Mathematica for $$\Psi(t)=\cos{(t)}:$$

RelaxF[t_] = Cos[t];
DRelaxF[t_] = D[RelaxF[t], t];

LaplaceRelaxF[s_] = LaplaceTransform[RelaxF[t], t, s];
P[s_] = Simplify[(A - B Exp[-s \[Tau]]) (s LaplaceRelaxF[s] -
Limit[RelaxF[x], x -> 0,
Direction -> "FromAbove"])/(s^2 LaplaceRelaxF[s] -
s Limit[RelaxF[x], x -> 0, Direction -> "FromAbove"] -
Limit[DRelaxF[x], x -> 0, Direction -> "FromAbove"])];

(* A = g[0]   ;   B = g[\[Tau]] *)

g[A_, B_, t_] = FullSimplify[InverseLaplaceTransform[P[s], s, t]];



whose result is

$$g(t) = g(0^+)-g(\tau^-)\text{Heaviside}(t-\tau),$$

which can not satisfy the first equation. Can anyone show me where I did wrong?