Ackbach said:
You aren't going to be able to do this with any continuous function. You cannot take the logarithm of zero or a negative number.
I might be of more help if you could provide the wider context for this problem.
I am building a model of flow and density of traffic. We did one using Greenshield's in class and then have been given this one to do for our own models.
The model is the differential equation:
$$
\frac{\partial\rho}{\partial t}+c(\rho)\frac{\partial\rho}{\partial x}=0
$$
with
$$
\rho(x,0)=f(x),\ \ \ v=v(\rho),\ \ \ c(\rho)=v+\frac{\partial v}{\partial \rho}\rho
$$
We were given the functions:
$$
v(\rho)= \left\{
\begin{array}{1 1}
\ v_{max} && 0\leq\rho<\rho_c \\
&& \\
\frac{v_{max}}{\ln(\frac{\rho_{max}}{\rho_c})}\ln(\frac{\rho{max}}{\rho}) && \rho_c\leq\rho\leq 1
\end{array}\right.
$$
and
$$
f(x)= \left\{
\begin{array}{1 1}
0 && x>0 \\
\rho_{max} && x<0
\end{array}\right.
$$
$\rho$ is density, $\rho_c$ is some density between 0 and max density which I set at 1. $v$ is velocity, with $v_{max}$ the maximum velocity which I set to 70. We then use the method of characteristics to find $\rho(x,t)$.
For example:
When $x_0>0,\ f(x_0)=0$
So $x=c(f(x_0))t+x_0=v_{max}t+x_0$
Hence $x_0=x-v_{max}$
Then $\rho(x,t)=f(x_0)=0$
For $x>v_{max}$
etc
But when I do the characteristic curves it leaves a gap in the middle where no curve goes through. So we then open the gap at the origin by $\epsilon$ in either direction and create a function for that part between the two points.
In the Greenshield one we used the linear function:
$$
f(x)= \left\{
\begin{array}{1 1}
\ 0 && x>\epsilon \\
1-\frac{(x+\epsilon)}{2\epsilon} && -\epsilon\leq x\leq\epsilon \\
\ \rho_{max} && x<-\epsilon
\end{array}\right.
$$
but this doesn't work for this model as I end up with an $x_0$ inside the $\ln$ function as well as one outside when doing the step of rearranging for $x_0$, hence why I thought of using an exponential.
I did just come up with:
$$
f(x)=\sqrt{v_{max}+1}\times e^{\frac{-ln(v_{max}+1)}{\epsilon}x}
$$
by following a guide online but the next step is to let $\epsilon$ go to 0 which means I have a zero in the denominator so it still doesn't work. I was just listening back through my lecture and he did mention a hint about using the tan function with the exponential but I can't figure out how that would work.