# [Maxima] Solving a two equation system yields strange results

Jason Filippou jason.filippou at gmail.com
Wed May 9 15:58:11 CDT 2012

```The link I forgot to send was this:
http://en.wikipedia.org/wiki/Gamma_Distribution

Thanks

On Wed, May 9, 2012 at 11:56 PM, Jason Filippou
<jason.filippou at gmail.com> wrote:
> Yes, this particular equation is only defined if k is an integer.
> However, even after I make this known in maxima, the system appears to
> have no solutions:
>
> (%i2) declare(k, integer);
> (%o2)                                done
> (%i3) solve([b*(k - 1) = 0.1, exp(-1/b) * sum(1/(i! * b^i), i, 0, k
> -1) = 0.02], [b, k]);
>
> rat: replaced -0.1 by -1/10 = -0.1
>
> rat: replaced -0.02 by -1/50 = -0.02
> (%o3)                                 []
> (%i4) solve([b*(k - 1) = a, exp(-1/b) * sum(1/(i! * b^i), i, 0, k -1)
> = 0.02], [b, k]);
>
> rat: replaced -0.02 by -1/50 = -0.02
> (%o4)                                 []
>
> FYI, what I'm trying to do here is to fit the parameters θ (theta) and
> k of a gamma distribution such that 98% of its mass is contained
> within the interval [0, 1]. In addition, I require that the "top" of
> the distribution, which is situated at θ*(κ - 1) is equal to 0.1, or a
> in the general case. Unfortunately I can't use the first
> characterization of the CDF (as described in the link above, where x =
> 1) to do this because Maxima does not support the incomplete gamma
> function γ), so I'm using the second characterisation, which includes
> a sum of k terms.
>
> Two unknown quantities, two equations; there should be a solution to this.
>
> Jason
>
> On Wed, May 9, 2012 at 11:24 PM, Raymond Toy <toy.raymond at gmail.com> wrote:
>>
>>
>> On Wed, May 9, 2012 at 11:46 AM, Jason Filippou <jason.filippou at gmail.com>
>> wrote:
>>>
>>> Good afternoon.
>>>
>>> I've been using  Maxima 5.21.1 in a Debian GNU / Linux 2.6.32-5-686
>>> system to solve a particular two equation system that I have to. The
>>> system is as follows:
>>>
>>> (1): b*(k - 1) = 0.1
>>>
>>> (2): exp(-1/b) / sum(i! * b^i, i, 0, k -1) = 0.02
>>>
>>> I've been using solve/2 for this, but I've been returned an empty
>>> solution set. Namely:
>>>
>>> %i9) solve([b * (k - 1) = 0.1, exp(-1/b) / sum(i! * b^i, i, 0, k -1) =
>>> 0.02], [b, k]);
>>>
>>> rat: replaced -0.1 by -1/10 = -0.1
>>>
>>> rat: replaced -0.02 by -1/50 = -0.02
>>> (%o9)                                 []
>>>
>>> Now, normally I would assume that this means that the system doesn't
>>> have a solution, but after substituting beta with its equivalent from
>>> the first equation, i.e 0.1 / (k - 1), I noticed that the evaluation
>>> of the second equation halts after a couple of steps:
>>>
>>> (%i5) solve([exp(-(k - 1) / 0.1) * sum(1/(i! * (0.1 / (k-1))^i), i, 0,
>>> k -1) = 0.02], [k]);
>>>
>> This seems a bit ill-defined.  Since k is the upper limit of the sum, what
>> do you expect sum(...,i,0,k-1) be when k is not an integer?  Do you mean to
>> take the floor of k-1?
>>
>> Ray
>>
>
>
>
> --
> Jason Filippou
> Research Associate
> NCSR Demokritos
> NCSR Webpage: http://users.iit.demokritos.gr/~jfilip/
> D.I.T Webpage: http://cgi.di.uoa.gr/~std06142/

--
Jason Filippou
Research Associate
NCSR Demokritos
NCSR Webpage: http://users.iit.demokritos.gr/~jfilip/
D.I.T Webpage: http://cgi.di.uoa.gr/~std06142/