It should be pretty easy to generalize my version of the `plot.gamma()`
function to a version of `curve()` with an extra `discontinuities` argument.
Duncan Murdoch
On 13/02/2024 1:44 p.m., Leo Mada wrote:> Dear Duncan,
>
> Thank you very much for the response. I suspected that such an option
> has not been implemented yet.
>
> The plot was very cluttered due to those vertical lines. Fortunately,
> the gamma function?is easy to handle. But the feature remains on my
> wishlist as useful more in general.
>
> Sincerely,
>
> Leonard
>
> ------------------------------------------------------------------------
> *From:* Duncan Murdoch <murdoch.duncan at gmail.com>
> *Sent:* Tuesday, February 13, 2024 6:05 PM
> *To:* Leo Mada <leo.mada at syonic.eu>; r-help at r-project.org
> <r-help at r-project.org>
> *Subject:* Re: [R] Skip jumps in curve
> On 13/02/2024 10:29 a.m., Leo Mada via R-help wrote:
>> Dear R-Users,
>>
>> Is there a way to skip over without plotting the jumps/discontinuities
in curve()?
>>
>> I have not seen such an option, but maybe I am missing something.
>>
>> plot.gamma = function(xlim = c(-6, -1), ylim = c(-1,3), hline = NULL, n
= 1000) {
>>???? curve(gamma(x), from = xlim[1], to = xlim[2], ylim=ylim, n=n);
>>???? if( ! is.null(hline)) abline(h = hline, col = "green");
>> }
>>
>> Euler = 0.57721566490153286060651209008240243079;
>> plot.gamma(hline = Euler)
>>
>> Adding an option to the function curve may be useful:
>> options = c("warn", "silent",
"unconnected")
>>
>> This is part of some experiments in math; but that's another topic.
For latest version:
>> https://github.com/discoleo/R/blob/master/Math/Integrals.Gamma.Inv.R
>
<https://github.com/discoleo/R/blob/master/Math/Integrals.Gamma.Inv.R>
>
> If you know where the discontinuities are, plot multiple times with the
> discontinuities as endpoints:
>
> plot.gamma = function(xlim = c(-6, -1), ylim = c(-1,3), hline = NULL, n
> = 1000) {
> ?? start <- floor(xlim[1]):floor(xlim[2])
> ?? end <- start + 1
>
> ?? start[1] <- xlim[1]
> ?? end[length(end)] <- xlim[2]
>
> ?? n <- round(n/length(start))
>
> ?? curve(gamma(x), from = start[1], to = end[1], ylim=ylim, n=n, xlim >
xlim)
> ?? for (i in seq_along(start)[-1])
> ???? curve(gamma(x), from = start[i], to = end[i], add = TRUE, n)
> ?? if( ! is.null(hline)) abline(h = hline, col = "green");
> }
>
> Euler = 0.57721566490153286060651209008240243079;
> plot.gamma(hline = Euler)
>
> If you don't know where the discontinuities are, it would be much
> harder, because discontinuities can be hard to detect unless the jumps
> are really big.
>
> Duncan Murdoch
>
>