Lines can be used to approximate a wide variety of functions; often a function can be described using many lines.

If a stock price goes from $10 to $12 from January 1st to January 31, and from $12 to $9 from February 1st to February 28th, is the price change from $10 to $9 a straight line?

How can I use two “pieces” of lines to describe the price movements from the beginning of January to the end of February?

I don't believe it will be a straight line, but how do I do the second part of using two pieces of lines to describe the price movements?

1 answer

If we use x as the number of days since the start of the year,

build each piece with a y=mx+b section, where the price starts a t b and the line has slope m ($/day)

January is y = 10 + 2/31 x
February is 12 - 3/28 (x-31)