First time here? Check out the FAQ!

Ask Your Question
1

What does undef mean

asked 0 years ago

AndrewAndrew gravatar image

updated 0 years ago

Am getting terms with expressions like:

7.10000000000000undef + 3.98967171417774e277x

That is 7.10000000000000 times undef

what does undef mean in sage math and how can I simplify the expression or remove the undef?

EXAMPLE:

beta= 7.10000000000000 


y = 2.66778786276411e493*t^3*x - 1.93258971534823e247*x


result=beta*(integral(y, t,0,1))

print('value is:',result)

integral(y, t,0,1)
Preview: (hide)

Comments

I haven't seen this personally so please post a (minimal) reproducible example of SageMath code producing such a result, so it can be properly investigated.

rburing gravatar imagerburing ( 0 years ago )

Interesting, the huge coefficients break every algorithm used by Sage: integral(y, t, 0, 1, algorithm=a) breaks for each a in ['maxima', 'sympy', 'mathematica_free', 'fricas', 'giac', 'libgiac']. The undef comes from libgiac. The error from choosing 'sympy' looks like it should be fixable (on the developer side, not the user side).

rburing gravatar imagerburing ( 0 years ago )

Thanks for investigating. I see the point. As an alternative is there a way to round the expression? round(y,10) <- something like that

AndrewAndrew gravatar imageAndrewAndrew ( 0 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 0 years ago

rburing gravatar image

This is a bug in SageMath. I've reported it here: https://github.com/sagemath/sage/issu...

Here is a workaround, specific to polynomials:

var('x,t')
beta = 7.10000000000000
y = 2.66778786276411e493*t^3*x - 1.93258971534823e247*x
Y = SR(y.polynomial(RR).integral(t))
result = beta*(Y.subs(t=1) - Y.subs(t=0))
Preview: (hide)
link

Comments

Understood. Very grateful for the help.

AndrewAndrew gravatar imageAndrewAndrew ( 0 years ago )

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: 0 years ago

Seen: 242 times

Last updated: May 06 '24