P Purkayastha
unread,Apr 23, 2013, 4:39:34 AM4/23/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sage-s...@googlegroups.com
On 04/21/2013 09:50 AM, Kenneth Lin wrote:
> Hi Sage,
>
> I'm not sure if it's that I'm not doing this right, but I have this
> function that has a ceiling in it. I defined it like so:
>
> |
> botrk(h0_prime,a0,s0,c0)=h0_prime /ceil(log(20*(a0 +25)/(h0_prime
> +20*(a0 +25)),0.95))*(s0 +0.4)*(1+c0)
> |
>
> But it won't do approximations of the ceiling, only returning another
> symbolic expression that can't be approximated.
>
> |
> sage: botrk(3000, 10, 1, 0.1)
> 4620.00000000000/ceil(-19.4957257462237*log(7/37))
> sage: botrk(3000, 10, 1, 0.1).n()
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
> <ipython-input-63-503406e1b435> in <module>()
> ----> 1 botrk(Integer(3000), Integer(10), Integer(1), RealNumber('0.1')).n()
>
> /usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/expression.so
> in sage.symbolic.expression.Expression._numerical_approx
> (sage/symbolic/expression.cpp:21011)()
>
> TypeError: cannot evaluate symbolic expression numerically
>
> |
>
> Does anyone know how to approximate ceilings? For my purpose, I could
> just plug this in again and get a result, but I was hoping for a better,
> cleaner way of doing it.
Don't know why it stumbles on the ceiling. A function works on the other
hand, since it avoids symbolics.
sage: def botrk(h0_prime, a0, s0, c0): return h0_prime / ceil(log(20 *
(a0 + 25) / (h0_prime + 20 * (a0 + 25)), 0.95)) * (s0 + 0.4) * (1 + c0)
....:
sage: botrk(3000, 10, 1, 0.1)
140.000000000000