In plot2d(r4(s),...) you are plotting the expression r4(s):
(%i1) r4(s) := block([s:bfloat(s)], s!/(((s/4)!)^4 * 4^s))$
(%i2) r4(s);
(%o2) s!/(4^s*(s/4)!^4)
so you get the same result as you first attempt. r4(s) is computed
before plot2d starts evaluating in the sample points which are
therefore not converted to bfloats.
In plot2s(r4,...) you are plotting the function r4. The sample points
will be converted to bfloats in the function.
Andrej
On Wed, Mar 11, 2009 at 9:36 PM, Kostas Oikonomou <ko at research.att.com> wrote:
> Thanks to all for the replies. ?I like Andrej's solution most.
> But why doesn't it work if I say
>
> plot2d(r4(s), [s,200,300])?
>
> "r4" instead of "r4(s)" is confusing.
>
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Kostas
>
> Andrej Vodopivec wrote:
>>
>> Use bfloats:
>>
>> r4(s) := block([s:bfloat(s)], s!/(((s/4)!)^4 * 4^s));
>> plot2d(r4, [s,200,300]);
>>
>> Andrej
>>
>> On Wed, Mar 11, 2009 at 8:36 PM, Kostas Oikonomou <ko at research.att.com>
>> wrote:
>>>
>>> I have a function
>>>
>>> r4(s) := s!/(((s/4)!)^4 * 4^s)
>>>
>>> and I am trying to plot it over the range [200,300]:
>>>
>>> plot2d(r4(s), [s,200,300])
>>>
>>> plot2d returns silently, i.e. it produces nothing. ? I am
>>> fairly sure the problem is that the computation involves
>>> intermediate numbers that are too large, although the final
>>> result is well within the rang of an ordinary float. ?E.g.
>>> r4(300) is of the order of 10^-4.
>>>
>>> I thought I had seen a solution to this kind of problem with
>>> plot somewhere on the list, but I can't find it. ? It seems
>>> to me the answer would be worth adding to the documentation
>>> for plotting.
>>>
>>> (This is Maxima 5.17.1 using SBCL, same with CMUCL)
>>>
>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Kostas
>>
>
>