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 -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
