Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004
# The two known points are (x0,y0) and (x1,y1) # The linear interpolant is the straight line between these points # (see http://en.wikipedia.org/wiki/Linear_interpolation#Linear_interpolation_between_two_known_points) x0,y0,x1,y1,x,y=var('x0,y0,x1,y1,x,y') eq = (y-y0)/(x-x0)==(y1-y0)/(x1-x0) #Solving the line equation for y gives the interpolation formula: solve([eq],y)
[y == ((x - x1)*y0 - (x - x0)*y1)/(x0 - x1)]
# at http://www.slideshare.net/thanr/c-5877576 we have a cost of $25 for 250000 customers, # $7 for 1000000 customers # Using the interpolation formula we can find out the cost for 450000 customers: y=((450000-1000000)*25-(450000-250000)*7)/(250000-1000000) y
101/5
# If we have a cost C to set up the business and expected revenue r from every unit # we can find the break even point with the system of equations r,C=var('r,C') solve([eq, x*(r-y)==C],x,y)
[[x == 1/2*(r*x0 - r*x1 - x0*y1 + x1*y0 + sqrt(r^2*x0^2 - 2*r^2*x0*x1 + r^2*x1^2 + x0^2*y1^2 + x1^2*y0^2 - 4*((x0 - x1)*y0 - (x0 - x1)*y1)*C + 2*(r*x0*x1 - r*x1^2)*y0 - 2*(r*x0^2 - r*x0*x1 + x0*x1*y0)*y1))/(y0 - y1), y == (r^2*x0 - r^2*x1 - r*x0*y1 + r*x1*y0 - 2*(y0 - y1)*C + sqrt(r^2*x0^2 - 2*r^2*x0*x1 + r^2*x1^2 - 2*r*x0^2*y1 + 2*r*x0*x1*y0 + 2*r*x0*x1*y1 - 2*r*x1^2*y0 + x0^2*y1^2 - 2*x0*x1*y0*y1 + x1^2*y0^2 - 4*C*x0*y0 + 4*C*x0*y1 + 4*C*x1*y0 - 4*C*x1*y1)*r)/(r*x0 - r*x1 - x0*y1 + x1*y0 + sqrt(r^2*x0^2 - 2*r^2*x0*x1 + r^2*x1^2 - 2*r*x0^2*y1 + 2*r*x0*x1*y0 + 2*r*x0*x1*y1 - 2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