Ask Your Question

foliot's profile - activity

2018-03-12 09:01:20 -0500 received badge  Famous Question (source)
2017-12-14 08:01:02 -0500 received badge  Popular Question (source)
2016-11-28 08:54:56 -0500 received badge  Notable Question (source)
2016-05-11 09:21:48 -0500 received badge  Popular Question (source)
2014-11-13 13:33:33 -0500 received badge  Student (source)
2014-11-13 13:24:59 -0500 received badge  Editor (source)
2014-11-13 13:22:49 -0500 asked a question Bizarre error

I'm sorry that the function in question is rather messy, but the problem is rather specific. I'm setting a constant 'c' and evaluating the local maximum of a function like so:

c = 1E6
find_local_maximum(lambda f: abs(1000*(2*pi*f*i)/(0.1*(2*pi*f*i)^2+1000*(2*pi*f*i)+c)), 1000, 3000)

In this case, I get the expected output. If I set c = 1E7, or a nearby value, like c = 1.123E7 or c = 3E7, I get the following error:

RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.

Now, if I set c = 5E7or c = 1E8, I get no error.

It's also worth noting that find_local_minimum with the exact same set of values and function does not have this same issue. Finally, the type of c is sage.rings.real_mpfr.RealLiteral in each case.

What could be causing this problem? Is there a workaround or a potential bug fix?

2014-11-13 12:50:10 -0500 received badge  Scholar (source)
2014-11-13 12:50:09 -0500 commented answer Unable to coerce to real

That works in this case. I have another problem, but I think it deserves a new question, so I'll ask it there.

2014-11-13 11:08:45 -0500 asked a question Unable to coerce to real

I'm having trouble with the find_local_minimum and find_local_maximum functions on the absolute value of a complex function. For instance, the following code is logical and works mathematically, but not in Sage:

x = var('x')
find_local_maximum(abs(i*x), 1000, 3000)

But alas, I get the error:

TypeError: unable to coerce to a real number

I've also tried adding an explicit conversion to real (desperate times):

x = var('x')
find_local_maximum(abs(i*x).real(), 1000, 3000)

This gave the same error.

How do I get around this issue? And is there the possibility that this could be resolved in the Sage codebase? It seems feasible, since the plot function works just fine with the exact same function.