# Finding a function that meets these requirements

• March 13th 2011, 06:04 PM
kodek
Finding a function that meets these requirements
Hi everyone! This is my first post, so go easy on me :)

I'm trying to find a smooth function that can replace the intersection of a continuous piecewise function made up of two lines of different slopes, one of which starts at the origin. Right now, I'm trying to find a logarithmic function that goes from the origin (or close to it) and smoothly turns into some line mx+b where m>=1, b>0.

What I've been trying to do is find an intersection of some logarithmic function with the line where the slopes are the same. This would allow me to form a smooth, continuous piecewise function thats an upward curve from 0<x<P, and a straight line from P<=x<inf.

After doing 900 mathematica commands, I'm at a complete loss. Does anyone know if this is even possible?

Thanks everyone,

KodeK
• March 13th 2011, 06:48 PM
mmm4444bot
Quote:

Originally Posted by kodek

and smoothly turns into some line mx+b where m>=1, b>0

If you're free to choose your own values for P, m, and b, then it might be easier to approach the splice from the other direction.

I hope that I understand your exercise correctly.

You could shift a log function so that it passes through the origin.

Determine the slopes of this curve at both the origin and at x = P.

Once you know these slopes, you can create lines using the Point-Slope formula.

If you're not free to choose P, m, and b, then please post all of the given information, and show us a few of the approaches that you tried in mathematica.

Cheers ~ Mark
• March 13th 2011, 07:18 PM
kodek
Unfortunately, m and b are given, but P can be anything. The idea is to find a smooth function (any, really, although I started with log functions first) that starts at the origin and connects with the line at some point P. The simpler way of doing this is by connecting the origin and the line with some other line that passes through the origin and intersects the original line. This line has an arbitrary slope m2, which leads to the intersection point P. The problem with this approach is that it leads to a piecewise function that's not smooth at the intersection point.

One of my other approaches was making a direction field where the slope at x=0 is some arbitrary value s, and the slope at x=P is m (from the main line). This leads me to a differential equation that connects these two points:

$m_{\text{slope}}=\frac{m-s}{P}$

$y'=m_{\text{slope}}*x + s$

From there, I can solve it and get a function of slope s at x=0 and slope m at x=P, but plotting this function with the line leads to a function that's not continuous. I think this is a better approach, but I can't figure out how I would connect both in an elegant way.

Thanks again!

Edit: The issue I'm having with my second approach is that I need to find values for s and P for a given line mx+b. If I can't find values for both, I don't mind making one a function of the other.
• March 13th 2011, 10:40 PM
kodek
I figured it out!

Solving the DE gave me a function of x,s and p. After this, I found the intersection of this new function and the line, which gave me two solutions. I set these two solutions equal to each other to find the case when there's only ONE intersecting point, and then I used that solution to find s in terms of P.

This gave me a function of x and p, where P is used to find how quickly the two functions meet.

$m x+\frac{2 b x}{P}-\frac{b x^2}{P^2}$