Ask Your Question

twosan's profile - activity

2016-06-21 21:57:01 +0100 received badge  Editor (source)
2016-06-21 21:40:08 +0100 received badge  Nice Question (source)
2016-06-21 10:20:40 +0100 received badge  Student (source)
2016-06-21 00:18:52 +0100 asked a question assume certain properties of the output of a function


I've just started using SAGE and I want to "declare" a symbolic function f(t) and to be able to hint that f(t) > 5 && f(t) < 100, for any value of t (the values are just for the purpose of example).

I know I can use assume for variables, but it seems it doesn't also work on functions, so I'm trying to see what alternatives I have left.

I have thought of "defining" the function f(t), with some mock values which don't contradict my assumptions(I don't actually know f(t), I only know some of it's properties), but I'm not sure how to force sage not to expand the function. I have tried f(t, hold=True) but it didn't seem to work(while this works for the default functions like sin).

Edit: Upon the comment made by @eric_g I add the following information:

f = function('f') ; t = var('t')
(f(t) > 4).assume()
print('a) bool(f(3)>5) : '+str(bool(f(3)>5)))
print('b) bool(f(3)>4) : '+str(bool(f(3)>4)))
print('c) bool(f(2)>5) : '+str(bool(f(2)>5)))
print('d) bool(f(t)>5) : '+str(bool(f(t)>5)))


[f(t) > 4, f(3) > 5, t > 1, f(t) > 5]
a) bool(f(3)>5) : True
b) bool(f(3)>4) : False
c) bool(f(2)>5) : False
d) bool(f(t)>5) : False

Two things puzzle me:

  • How to get "c)" and "d)" to return true
  • While "a)" returns true probably due to the second assumption, I would expect "b)" to also be true

Is the behavior I'm seeing incorrect, or am I just using SAGE wrong?