Ask Your Question

foliot's profile - activity

2018-03-12 15:01:20 +0200 received badge  Famous Question (source)
2017-12-14 15:01:02 +0200 received badge  Popular Question (source)
2016-11-28 15:54:56 +0200 received badge  Notable Question (source)
2016-05-11 16:21:48 +0200 received badge  Popular Question (source)
2014-11-13 20:33:33 +0200 received badge  Student (source)
2014-11-13 20:24:59 +0200 received badge  Editor (source)
2014-11-13 20:22:49 +0200 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 19:50:10 +0200 received badge  Scholar (source)
2014-11-13 19:50:09 +0200 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 18:08:45 +0200 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.