[sage-support] Handling of backslashes in functions

2013-04-23 Thread Kenneth Lin
Hey Sage,

So I'm trying to make a really long function that I wanted to put on 
multiple lines to look nice. However, Sage's backslash preprocessing, 
combined with the preprocessing of making functions, doesn't allow me to do 
this:

sage: botrk(h0_prime, a0, s0, c0) = h0_prime / ceil(log(20 * (a0 + 25) / 
(h0_prime + 20 * (a0 + 25)), 0.95)) *   
  File ipython-input-51-0e90997af202, line 1
__tmp__=var(h0_prime,a0,s0,c0); botrk = symbolic_expression(h0_prime 
/ ceil(log(Integer(20) * (a0 + Integer(25)) / (h0_prime + Integer(20) * (a0 
+ Integer(25))), RealNumber('0.95'))) *).function(h0_prime,a0,s0,c0)


  ^
SyntaxError: invalid syntax

sage: botrk(h0_prime, a0, s0, c0) = h0_prime / ceil(log(20 * (a0 + 25) / 
(h0_prime + 20 * (a0 + 25)), 0.95)) * \
  File ipython-input-52-fe3774a6c1a7, line 1
__tmp__=var(h0_prime,a0,s0,c0); botrk = symbolic_expression(h0_prime 
/ ceil(log(Integer(20) * (a0 + Integer(25)) / (h0_prime + Integer(20) * (a0 
+ Integer(25))), RealNumber('0.95'))) *  * BackslashOperator() * 
).function(h0_prime,a0,s0,c0)


^
SyntaxError: invalid syntax


Does anyone know more about this? If there's planning to be a patch to fix 
this, or I'm doing something wrong, or otherwise? If it's an easy fix I'd 
be down to help fix it.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Numerical approximation of ceiling functions?

2013-04-23 Thread Kenneth Lin
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.000/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.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.