Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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?
- ==============================================================================
- 1) is the price change from $10 to $9 a straight line?
- The price change from $10 to $9 is not straight line, because it goes up from 10$ to 12$ during January and then goes down from 12$ to 9$ during February.
- 2) How can I use two pieces of lines to describe the price movements from the beginning of January to the end of February?
- If we use date as our x-axis and price as our y-axis, we will have a Set S that have points on either one of the two lines:
- S = { (1,10), (31,12), (31+1,12), (31+28,9) }
- = { (1, 10), (31,12), (32,12), (59,9)}
- Now, we can get two equations from these points:
- M = (12 - 10)/(31 - 1)
- = 2/30 = 1/15
- Y= (1/15) * x + b
- Use (1,10)
- 10 = (1/15)*1 + b
- b = 10 – (1/15) = 149/15
- Therefore, we get the equation:
- Y = (1/15)*x + 149/15 while x interval = [1,31]
- M2 = (9 – 12)/(59 - 32)
- = -3/27 = -1/9
- Y = (-1/9)x + b
- Use (32,12)
- 12 = (-1/9)*32 + b = (-32/9) + b
- b = 12 + (32/9) = 140/9
- Therefore, we get another equation:
- Y = (-1/9)x + 140/9 while x interval = [32,59]
- To represent the price movement from January 1st to February 28th, we will get a piecewise function as below:
- f(x) = (1/15)*x + 149/15 while x interval = [1,31]
- f(x) = (-1/9)x + 140/9 while x interval = [32,59]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement