On Dec 4, 2011, at 9:52 AM, e eeyore wrote: > This is not homework, I calculate some expectations and to finish > that I must solve integral like this one.. > Upper bound have some unknown parameter, but I dont know how to > write it in R.
You almost did write it in R. You just left the "m" unspecified. If you replace "m" by 5 the code works. > > Do I must define m like symbol, or something else, just need help > with that. > I know how this work in MatLab, but in R I have problem. > Is there any solution how to solve integral like this one? > > Can you help me please little more or direct me to right way, I will > appreciate your effort. > > Thanks > > > On Sun, Dec 4, 2011 at 6:06 AM, David Winsemius <dwinsem...@comcast.net > > wrote: > > On Dec 3, 2011, at 10:23 PM, grttt nbbfg wrote: > > Sorry for my English, is not my first language.. > > I have some trouble in terms of using integrate function in R. > fx is a function of m and x where m is supposed to be a unknown > parameter. > > R is not an algebraic solver (and R-help is not a homework list.). > > > > fx=function(m,x){ > + x*2/(3*m)*(1-x/(3*m)) > + } > > The problem is in upper bound, it depends on parameter m. > > integrate(fx,lower=0,upper=3*m)$value > > Is it possible to use the integrate function when bounds depend on a > parameter? > > If it is known, yes. You could also do some investigation: > > curve(x*2/(3*5)*(1-x/(3*5)), 0, 15) > > > > How to define m to solve this integral? The result should be m. > > As I said, no homework answers here. > David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.