Ask Your Question
3

Is it possible to default to real field?

asked 2018-06-19 23:04:55 +0100

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 16:28:38 +0100

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 17:38:59 +0100 )edit
0

answered 2018-06-20 10:59:13 +0100

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 15:59:01 +0100 )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 23:37:58 +0100 )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 23:04:55 +0100

Seen: 301 times

Last updated: Jun 20 '18