Ask Your Question
1

What does undef mean

asked 2024-05-05 10:08:47 +0200

AndrewAndrew gravatar image

updated 2024-05-05 10:42:55 +0200

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)
edit retag flag offensive close merge delete

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 ( 2024-05-05 10:14:14 +0200 )edit

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 ( 2024-05-05 10:55:39 +0200 )edit

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 ( 2024-05-06 06:43:13 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2024-05-06 11:39:08 +0200

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))
edit flag offensive delete link more

Comments

Understood. Very grateful for the help.

AndrewAndrew gravatar imageAndrewAndrew ( 2024-05-08 01:16:07 +0200 )edit

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: 2024-05-05 10:08:47 +0200

Seen: 106 times

Last updated: May 06