##plot
library(mosaic)
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
library(mosaicCalc)
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D
library(ggplot2)
#makefuntion
TC <- makeFun(4700+0.294*q~q)
TC(1:10)
##  [1] 4700.294 4700.588 4700.882 4701.176 4701.470 4701.764 4702.058 4702.352
##  [9] 4702.646 4702.940
TR <- makeFun(3*q~q)
TR(1:10)
##  [1]  3  6  9 12 15 18 21 24 27 30
##FindZero
findZeros((3*q)-(4700+0.294*q)~q)
##          q
## 1 1736.881

{ r } #Culcalare area r=antiD(TR(q)-TC(q)~q)

#graph 
ggplot() + 
  geom_function(fun=TC, col="red", lwd = 1 )+
  geom_function(fun=TR, col="blue", lwd = 1)+
  xlim(1, 3000)+ ylab("maney")+ xlab("Product")