First time here? Check out the FAQ!

Ask Your Question
3

Is it possible to default to real field?

asked 6 years ago

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.]

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 6 years ago

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.

Preview: (hide)
link

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 ( 6 years ago )
0

answered 6 years ago

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]
Preview: (hide)
link

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 ( 6 years ago )

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 ( 6 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: 6 years ago

Seen: 322 times

Last updated: Jun 20 '18