Ask Your Question

Lynda's profile - activity

2022-05-05 07:14:39 +0200 received badge  Famous Question (source)
2017-10-11 08:55:31 +0200 received badge  Notable Question (source)
2017-05-17 11:10:06 +0200 received badge  Good Question (source)
2015-03-03 12:59:40 +0200 received badge  Famous Question (source)
2013-08-25 05:08:58 +0200 received badge  Popular Question (source)
2012-04-22 21:54:09 +0200 received badge  Notable Question (source)
2011-07-10 09:44:57 +0200 received badge  Popular Question (source)
2011-04-29 11:14:54 +0200 received badge  Nice Question (source)
2010-11-08 20:18:39 +0200 received badge  Student (source)
2010-11-08 20:18:39 +0200 received badge  Scholar (source)
2010-10-17 15:39:14 +0200 commented question Variable range()

Thank you Niles it works well for my needs

2010-10-16 17:36:53 +0200 marked best answer Variable range()

A lambda function might be the quickest workaround:

plot(lambda t: f(10000000,1,0.01,t),3,20)

And if you don't want to get the deprecation warning about range not taking float inputs, you could modify your function to:

def f(a,b,c,x):
    xtemp=a
    for i in range(b,ceil(x)):
        xtemp=xtemp-xtemp*c
    return xtemp
2010-10-16 15:57:24 +0200 asked a question Variable range()

Hello, I have the following code:

def f(a,b,c,x):
    xtemp=a
    for i in range(b,x):
        xtemp=xtemp-xtemp*c
    return xtemp   
var('t')
plot(f(10000000,1,0.01,t),3,20)

and got the error

TypeError: range() integer end argument expected, got
sage.symbolic.expression.Expression.

I understand that range does nor support 'var' object, but how can I have a variable range in this kind of function?

2010-10-08 07:05:36 +0200 asked a question How to use an external text editor to create script (interact) and render it in a browser

I am not very confortable with the notebook interface to edit long files (no colorisation, etc...), but I would like to be able to use interact objects. Is there a way to:

  1. Create a file in a text editor of my choice
  2. run it in sage
  3. have the ouput automatically opened in the browser

Thanks for your answers