Ask Your Question
0

Evaluation fail

asked 2015-03-29 12:35:31 +0100

updated 2023-01-10 02:21:20 +0100

tmonteil gravatar image

hello,

when running "0^0" the result is "1", but when defining "f(x)=0^x" and evaluating "f(0)" the evaluation fails with "ValueError: power::eval(): pow(0,0) is undefined". I guess this one is easy to fix... :)

version: Sage Version 6.5, Release Date: 2015-02-17

regards, manfred

edit retag flag offensive close merge delete

Comments

Using a python lambda function, this will work. That is, f = lambda x: 0^x will give a function that does what you want. So, this indicates that it is a matter of how Sage is defining its functions.

calc314 gravatar imagecalc314 ( 2015-03-29 15:15:25 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-03-29 16:14:09 +0100

tmonteil gravatar image

updated 2015-03-30 23:15:22 +0100

When you write:

sage: f(x)=0^x

You define a "symbolic function":

sage: type(f)
<type 'sage.symbolic.expression.Expression'>
sage: f.parent()
Callable function ring with argument x

This is a kind of mathematical formula (like exp(cos(pi)) + log(x)). This is an object you can derivate, integrate, and so on.

Instead you can define a Python function:

sage: def f(x):
....:     return 0^x
sage: f(0)
1
sage: type(f)
<type 'function'>

For such easy-to-define function, you can be shorter, by typing:

sage: f = lambda x : 0^x
sage: f(0)
1
sage: type(f)
<type 'function'>

EDIT

According to your comment, it seems i misunderstood your question. Actually, the problem is not about evaluating the symbolic function f but about SR(0)^SR(0) being not defined. Thanks for reporting, @kcrisman opened trac ticket 18088.

edit flag offensive delete link more

Comments

This is resolved in recent versions.

rws gravatar imagerws ( 2015-07-06 17:50:31 +0100 )edit
0

answered 2015-03-30 16:08:44 +0100

updated 2015-03-30 16:49:23 +0100

well thanks for the fast answer but i already knew this "workarround" ;)

i reported this problem as i thought that this was a (very small) bug since pow(0,0) evaluates to 1. hence, it does not make any sense at all that the exception "pow(0,0) is undefined" is thrown.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-03-29 12:35:31 +0100

Seen: 851 times

Last updated: Mar 30 '15