Skip to content

Hi

3 messages · Moshe Kelner, Jeff Newmiller, David Winsemius

#
Hi ,

I'm asking for a way to compute the integral of:  function(x) {x*(log(x)+b)*((log(x)+b)^(a-1)-b^(a-1))/(a-1)*(b^(a-1)}
When a and b are between 1 to 10 and X is the integral parameter between 0 to 1 '

Thanks,

Moshe



This e-mail message may contain confidential, commercial and privileged information or data that
constitute proprietary information of Cellcom Israel Ltd. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient you are hereby notified that any use
of this information or data by any other person is absolutely prohibited.
If you are not the intended recipient, please delete all copies.

Thank You.
http://www.cellcom.co.il
#
Your function has mismatching parentheses.

I recommend using a computer algebra system like Maxima.
#
Problems here ----------------^^^-----and if(a==1)-----^^^---paren--^
                              |||                      |||         |

Annotation only useful with monospaced font. Not likely to be useful to Moshe if he will be using HTML for posting.
How are you planning to handle a value of log(0)? Or for that matter division by 0 if a==1

R does do limiting integrations (if that is the correct term for lim(integrate(func, lower=0, ...)) with the value of func(0) undefined. You may need to set the lower limit of integration to be a small positive number.

R also has difficulties with fractional powers of negative numbers:
[1] NaN 

Did you perhaps intend `a` to be in the set: 2:9 ?

If I set: 

 my_f <- function(x, a=1.1, b=1.1)   # will error out with those defaults
                    {x*(log(x)+b)*((log(x)+b)^(a-1)-b^(a-1))/(a-1)*(b^(a-1))}
-0.5063435 with absolute error < 4.6e-09
-0.4829606 with absolute error < 3.5e-05
-0.4813907 with absolute error < 4.8e-05
excised meaningless confidentiality message
Do read the Posting Guide which advises not to use HTML.