Ask Your Question
3

Is it possible to default to real field?

asked 2018-06-19 16:04:55 -0600

Richard_L gravatar image

It appears that Sage defaults symbolic variables to the complex field. This is passed along to Maxima, eventually triggering segfaults. Given that all of my variables are real, is it possible to default the symbolic domain to the real field BEFORE asking any calculations of Maxima?

[Related to my thread on the Development mailing list.]

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2018-06-20 09:28:38 -0600

Richard_L gravatar image

Nils Bruin provided the answer over on sage-devel. It is to insert

maxima_calculus.eval("domain:real;")

before the variable declarations.

edit flag offensive delete link more

Comments

and it's a hack. Other parts of sage probably expect domain: complex to be active when maxima code is expected, so you may find failures in other areas. This is definitely in the "warranty voided if opened" category. Sage doesn't come with warranty, so you don't lose much ...

nbruin gravatar imagenbruin ( 2018-06-20 10:38:59 -0600 )edit
0

answered 2018-06-20 03:59:13 -0600

tmonteil gravatar image

You can use the assume function (which is not alwys reliable, so you shoud test it):

sage: var('t')
t
sage: assume(t,'real')
sage: assumptions()
[t is real]
edit flag offensive delete link more

Comments

Thanks,but that does not work. Sage will send to Maxima something like:

domain: complex;
declare( t, real );

Alas, certain expressions involving t will now fail. What I'm looking for is a way to cause Maxima to execute "domain:real;".

Richard_L gravatar imageRichard_L ( 2018-06-20 08:59:01 -0600 )edit

You may try to wrap your computation in a try...except...finally structure, starting with maxima_calculus("domain:real") and maxima_calculus("domain:complex") in the finally clause. or, even better, define a decorator or a context.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2018-06-20 16:37:58 -0600 )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: 2018-06-19 16:04:55 -0600

Seen: 62 times

Last updated: Jun 20