Ask Your Question

Tony-64's profile - activity

2020-06-29 02:31:49 -0500 received badge  Enthusiast
2020-06-28 05:59:16 -0500 commented answer How to find arbitrary complex constants in symbolic expressions?

Thanks again. The updated approach works when we know the expressions up front. However, one step more difficult is when they result from a computation. Here is another example. Interestingly enough, when solving the equation for x, the .find(I*w0) approach works. However, when solving for y, it doesn't.

w0 = SR.wild(0)

var('y')
assume(x, 'real')
assume(y, 'real')



eqn = (x^3 + y^3 / 27 == 1)

sols = solve(eqn, x)

f, g, h = [sol.rhs() for sol in sols]

expressions = [f, g, h]

for expr in expressions:
    print(expr.find(I*w0))



sols = solve(eqn, y)

f, g, h = [sol.rhs() for sol in sols]

expressions = [f, g, h]

for expr in expressions:
    print(expr.find(I*w0)
2020-06-27 15:53:35 -0500 commented answer How to find arbitrary complex constants in symbolic expressions?

Thanks for the answer. You are correct that I meant x to be a real number. I thought of this approach too, but unfortunately, it breaks down when the expression becomes a more complex. Here is an example.

w0 = SR.wild(0)

f = sqrt(1-x^2) + I*(1-x^3)^(1/3)
g = sqrt(1-x^2) + 2*I*(1-x^3)^(1/3)

assume(x, 'real')

print(f.find(I*w0))
print(g.find(I*w0))

print(f.imag())
print(g.imag())

In this example, .find(I*w0) yields the term containing the cube root from f, but not from g. However, .imag() yields complicated expressions for both f and g because it takes into account that abs(x) may be greater than 1.

2020-06-27 09:40:36 -0500 asked a question How to find arbitrary complex constants in symbolic expressions?

How do I go about finding terms in a symbolic expression containing arbitrary complex constants? I had hoped that the code fragment below would yield something like [2Ix], [Ix], [I], and [2I]. However, instead it yields [], [I*x], [], and []. Is there another way to isolate the terms containing an arbitrary complex constant?

w0 = SR.wild(0)

f = x^2 + 2*I*x + 1
g = x^2 + I*x + 1
h = x^2 + 2*x + I
k = x^2 + x + 2*I

print(f.find(I*w0))
print(g.find(I*w0))
print(h.find(I*w0))
print(k.find(I*w0))
2020-06-22 13:24:57 -0500 commented question DeprecationWarning

I understand about the second case. However, it is the first example that is puzzling me.

def testing(fn):
    print(fn(1))
    return

expr=x
testing(expr) # DeprecationWarning
print(expr(1)) # No DeprecationWarning
2020-06-22 11:21:31 -0500 asked a question DeprecationWarning

See the question in the example below. What is the cause off the inconsistency with respect to generating the DeprecationWarning?

 def testing(fn):
    print(fn(1))
    return

expr=x
testing(expr) # Yields DeprecationWarning: Substitution using function-call syntax and unnamed arguments ...
print(expr(1)) # No deprecation warning here. Why?

fn(x)=x
testing(fn) # No deprecation warnings here either.
print(fn(1))
2020-02-25 11:51:28 -0500 received badge  Famous Question (source)
2020-02-11 08:33:17 -0500 received badge  Notable Question (source)
2020-02-11 08:33:17 -0500 received badge  Popular Question (source)
2020-01-17 13:17:48 -0500 answered a question SageMath 9.0 app macOS: jupyter server fails to start

See Samuel Lelièvre's answer to my question here.

2020-01-17 13:16:50 -0500 received badge  Commentator
2020-01-17 13:16:50 -0500 commented question SageMath 9.0 app macOS: jupyter server fails to start

Another cloud-based folder (such as OneDrive) does work as well. So fortunately it's still possible to have the same view on one's Sage projects from multiple machines...

2020-01-17 13:09:03 -0500 commented answer Sage 9.0 installation issues on macOS 10.15.2 Catalina

Yes, I thought it would be something to do with increased security hurdles.

Thanks for the explanation of the steps to take. Eventually, all I had to do was to execute the xattr command, and run sage from a terminal window once. This resulted in all patches being applied and sage starting normally. After quitting sage, I was able to use the app as usual, with one exception. I had to steer the default Jupyter path away from the Sage folder on my iCloud Drive. Using another cloud-based folder (such as OneDrive) does not caused Jupyter to fail, however. Apparently, it's time to move my stuff from iCloud to OneDrive...

2020-01-16 10:34:58 -0500 asked a question Sage 9.0 installation issues on macOS 10.15.2 Catalina

When I install sage-9.0-OSX_10.15.2-x86_64.app.dmg on macOS Catalina (10.15.2) and run if for the first time, the "starting" web page comes up almost immediately, followed by a pop-up error window saying that "Jupyter Server failed to start." From the log, it looks like the patching of the installation files does not finish properly. See a copy of the log entries below. Note that the last line is not complete.

Does anyone have an idea what the issue could be? I have a working installation of Sage 9.0 on another Mac running 10.15.2, albeit not completely free of issues, but cannot see the difference between the two. (As a side note, the log file of the working installation does not show the "patching" lines at all. Actually, the log is not showing any new information at all anymore. Has a new log been created on that system and is the app showing the previous version of the log?)

From the log on the installation that isn't working

This might take a few minutes but only has to be done once.

patching /Applications/SageMath-9.0.app/Contents/Resources/sage/build/make/Makefile-auto
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/config.status
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/2to3-3.7
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/ESingular
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/NRswitchg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/QuadraticSieve
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/R
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/Rscript
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/Singular
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/TSingular
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/addedgeg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/adjacency
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/adjacency_gmp
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/allfaces
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/allfaces_gmp
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/amtog
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/annotate
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/biplabg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cas_help
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/catg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cddexec
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cddexec_gmp
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cl
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/complg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/converseg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/copyg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/countg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cu2
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cubex
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cubhamg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/curve_keygen
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cygdb
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cysignals-CSI
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cython
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/cythonize
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/deledgeg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/delptg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/directg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/dreadnaut
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/dretodot
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/dretog
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/easy_install
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/easy_install-3.7
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/ecl
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/ecl-config
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/ecm
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/f2py
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/f2py3
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/f2py3.7
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/fai
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/fflas-ffpack-config
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/fourier
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/fourier_gmp
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/fplll
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/freetype-config
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/futurize
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gac
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gac-e
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gap-bin
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gcc-ar
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gcc-nm
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gcc-ranlib
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gcov
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gcov-dump
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gcov-tool
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gd2copypal
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gd2togif
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gd2topng
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gdcmpgif
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gdlib-config
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gdparttopng
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gdtopng
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/genbg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/genbgL
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/geng
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/genquarticg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/genrang
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/genspecialg
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gentourng
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gfan
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gfortran
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/giftogd2
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/givaro-config
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/givaro-makefile
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/glpsol
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gp-2.11
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gphelp
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gsl-config
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gsl-histogram
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/gsl-randist
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/hamheuristic
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/hevea2mml
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/icas
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/idle3.7
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/iptest
patching /Applications/SageMath-9.0.app/Contents/Resources/sage/local/bin/iptest3
patching /Applications/SageMath-9.0.app/Contents/Resources/sa
2020-01-11 09:31:36 -0500 commented question SageMath 9.0 app macOS: jupyter server fails to start

Same here (MacOs Catalina 10.15.2, sage-9.0-OSX_10.15.2-x86_64.app.dmg).

I like to work with my default Sage folder mapped to iCloud (through the Documents folder). When I change the default Jupyter path (in the app's preferences) to a folder on the local machine (i.e. not mapped to iCloud), the issue does not occur. With Sage 8.8 and lower, my preference for mapping my default Sage folder to iCloud was never a problem...

2020-01-07 14:02:04 -0500 received badge  Famous Question (source)
2018-12-30 17:55:09 -0500 received badge  Student (source)
2018-12-30 13:26:20 -0500 received badge  Editor (source)
2018-12-30 13:22:52 -0500 asked a question Sage 8.5 on MacOS10.14 asking for Xcode command line tools

Has anyone seen a pop-up window asking for the Xcode command line tools to be installed after starting sage-8.5-OSX_10.14.2-x86_64.app? The pop-up says they are required to run gcc. I have just installed this version on a clean machine running MacOS 10.14.2 (no Xcode or older sage version installed). Sage appears to run fine without these tools, so for now I am just ignoring the pop up. Which functionality won't be available without having them installed?

BTW: I have observed the same pop up with sage 8.4 on MacOS 10.14. I haven't seen it with earlier sage versions on MacOS 10.13.

BTW2: The log file doesn't mention gcc missing.

UPDATE: Unfortunately, Sage does not run fine. It starts OK and runs relative simple code aw expected. However, when trying to execute more complicated code, Sage unexpectedly throws runtime errors and floating point exceptions. The only way to get Sage running as expected is to install the Xcode command line tools. (No need to install the full Xcode environment).

Perhaps this should be mentioned somewhere in the docs?

2018-11-02 23:09:17 -0500 received badge  Notable Question (source)
2018-11-02 09:35:14 -0500 answered a question problem running Sage on MacOS 10.14, Mojave

Probably a different issue, but each time I start 8.4 on MacOS 10.14 Mojave, I get a pop-up window indicating that the gcc command requires installation of the developer command line tools. However, about half a minute later Sage does start as usual, opening the Jupyter home screen and everything appears to work fine. So far, I ignored the pop-up and did not install the command line tools...

2017-08-23 13:23:48 -0500 received badge  Popular Question (source)
2017-06-19 16:09:17 -0500 commented answer Supposedly real function returning a complex result

Nice trick! It certainly gives me some food for further thought about how to optimize the rest of the application. Obviously, the function f represents only a small part of the stuff I have to visualize ;-)

Anyway, with respect to the question about region_plot(real(g) < 0) failing with TypeError: unable to coerce to a real number, is this a bug? If yes, how and where should I report it?

2017-06-19 15:53:22 -0500 commented answer Supposedly real function returning a complex result

Thanks for the example. Whereas cg calculates about a factor of 5 faster on my machine, region_plot(cg) takes about the same time toe execute as region_plot(g). Apparently, region_plot() doesn't spend the bulk of its time doing the raw calculations.

2017-06-19 15:33:55 -0500 received badge  Supporter (source)
2017-06-16 17:20:31 -0500 asked a question Supposedly real function returning a complex result

Hi all,

I have this function:

f(x, y) = 100*abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

and need to create a plot showing where its derivative with respect to x is negative:

region_plot(diff(f, x) < 0, (x, 0.7, 1.7), (y, 0, 1))

Unfortunately, region_plot fails with a TypeError: unable to coerce to a real number.

Apparently, rounding errors cause the derivative to have a small complex part. Here is some sample code to demonstrate the effect:

var('x, y')
assume(x, 'real')
assume(y, 'real')
assume(x > 0)
assume(y > 0)

f(x, y) = 100*abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

g(x, y) = diff(f, x)

print f
print
print g
print

xv = 1.37
yv = 0.28

print "rational arguments: f(", QQ(xv), ",", QQ(yv), ") =", N(f(QQ(xv), QQ(yv)))
print "rational arguments: g(", QQ(xv), ",", QQ(yv), ") =", N(g(QQ(xv), QQ(yv)))
print

print "float arguments: f(", xv, ",", yv, ") =", f(xv, yv)
print "float arguments: g(", xv, ",", yv, ") =", g(xv, yv)
print

print "float arguments: real(f(", xv, ",", yv, ")) =", real(f(xv, yv))
print "float arguments: real(g(", xv, ",", yv, ")) =", real(g(xv, yv))
print

and its output:

(x, y) |--> 100*abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

(x, y) |--> 50*(x*((245*(40*x + 20*I*y + I)*x^4/(20*x^2 + I*x*(20*y + 1) - 20)^2 - 980*x^3/(20*x^2 + I*x*(20*y + 1) - 20) + 200*x + I)*x/(245*x^4/(20*x^2 + I*x*(20*y + 1) - 20) - 100*x^2 - I*x + 100)^2 + 1/(245*x^4/(20*x^2 + I*x*(20*y + 1) - 20) - 100*x^2 - I*x + 100))/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100) + x*((245*(40*x - 20*I*y - I)*x^4/(20*x^2 - I*x*(20*y + 1) - 20)^2 - 980*x^3/(20*x^2 - I*x*(20*y + 1) - 20) + 200*x - I)*x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100)^2 + 1/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))/(245*x^4/(20*x^2 + I*x*(20*y + 1) - 20) - 100*x^2 - I*x + 100))/abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

rational arguments: f( 137/100 , 7/25 ) = 2.57021481299952
rational arguments: g( 137/100 , 7/25 ) = -8.24860099120441

float arguments: f( 1.37000000000000 , 0.280000000000000 ) = 2.57021481299952
float arguments: g( 1.37000000000000 , 0.280000000000000 ) = -8.24860099120440 + 1.68733316297436e-15*I

float arguments: real(f( 1.37000000000000 , 0.280000000000000 )) = 2.57021481299952
float arguments: real(g( 1.37000000000000 , 0.280000000000000 )) = -8.24860099120440

Clearly, as long as the arguments x and y are rationals, the derivative of f (g in the sample code) yields a real number. However, when the arguments are given as floating point values, in many cases the result has a small imaginary component. By the way, f itself always yields a real number.

Whereas it is possible to take this component away by taking the real part, this work-around apparently does not help in the region_plot function: region_plot(real(g) < 0, (x, 0.7, 1.7), (y, 0, 1)) fails with the same TypeError: unable to coerce to a real number.

Why doesn’t this work-around work? Is it a Sage bug?

Anyway, the only feasible work-around that I have been able to find so far is to replace the abs function with my_abs(z) = sqrt(real(z)^2 + imag(z)^2). Here is the code

my_abs(z) = sqrt(real(z)^2 + imag(z)^2)

f(x, y) = 100*my_abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

g(x, y) = diff(f, x)

print f
print
print g
print

xv = 1.37
yv = 0.28

print "rational arguments: f(", QQ(xv), ",", QQ(yv), ") =", N(f(QQ(xv), QQ(yv)))
print "rational arguments: g(", QQ(xv), ",", QQ(yv), ") =", N(g(QQ(xv), QQ(yv)))
print

print "float arguments: f(", xv, ",", yv, ") =", f(xv, yv)
print "float arguments: g(", xv, ",", yv, ") =", g(xv, yv)
print

print "float arguments: real(f(", xv, ",", yv, ")) =", real(f(xv, yv))
print "float arguments: real(g(", xv, ",", yv, ")) =", real(g(xv, yv))
print

print "time required to calculate g:"
timeit('g(xv, yv)')
print

and its output:

(x, y) |--> 100*sqrt(10000*(49*x^7/((24010000*x^12/(400*x^4 + 400*x^2*y^2 + 40*x^2*y - 799*x^2 + 400)^2 + 2401000*x^10*y/(160000*x^8 + 320000*x^6*y^2 + 160000*x^4*y^4 + [... output truncated ...]


(x, y) |--> 200*(5000*(49*x^7/((24010000*x^12/(400*x^4 + 400*x^2*y^2 + 40*x^2*y - 799*x^2 + 400)^2 + 2401000*x^10*y/(160000*x^8 + 320000*x^6*y^2 + 160000*x^4*y^4 + [... output truncated ...]

rational arguments: f( 137/100 , 7/25 ) = 2.57021481299952
rational arguments: g( 137/100 , 7/25 ) = -8.24860099120441

float arguments: f( 1.37000000000000 , 0.280000000000000 ) = 2.57021481299952
float arguments: g( 1.37000000000000 , 0.280000000000000 ) = -8.24860099120455

float arguments: real(f( 1.37000000000000 , 0.280000000000000 )) = 2.57021481299952
float arguments: real(g( 1.37000000000000 , 0.280000000000000 )) = -8.24860099120455

time required to calculate g:
5 loops, best of 3: 43.5 ms per loop

However, this work-around unfortunately yields a substantial performance loss (the calculation of g using the built-in abs function takes about 20 ms). Since I have to calculate this function—and several even more complex ones—many times, this performance decrease by 50% does have a sever impact.

An alternative work-around that has been suggested elsewhere in this forum is to make use of the lambda construct, as in region_plot(lambda x, y: g(x, y) < 0, (x, 0.7, 1.7), (y, 0, 1)), where g is the based on the built-in abs function.

However, this latter work-around is much worse than the above mentioned work-around: the region_plot takes much longer than doing a region_plot without the lambda construct (but using the my_abs function); about 210 seconds versus 5 seconds on my machine (2012 iMac)! Moreover, the resulting plot is very coarse and grainy, rather than nicely smooth.

Here is the code to create the plots:

var('x, y')
assume(x, 'real')
assume(y, 'real')
assume(x > 0)
assume(y > 0)

f(x, y) = 100*abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

g(x, y) = diff(f, x)

# g based on the built-in abs function:
P = region_plot(lambda x, y: g(x, y) < 0, (x, 0.7, 1.7), (y, 0, 1), plot_points=100)
P.show()


my_abs(z) = sqrt(real(z)^2 + imag(z)^2)

f(x, y) = 100*my_abs(x/(245*x^4/(20*x^2 - I*x*(20*y + 1) - 20) - 100*x^2 + I*x + 100))

g(x, y) = diff(f, x)

# g based on the my_abs function
P = region_plot(g(x, y) < 0, (x, 0.7, 1.7), (y, 0, 1), plot_points=100)
P.show()

Anyone having suggestions for a better solution?

2017-05-01 12:07:21 -0500 commented answer Sage-7.6.app on macOS 10.12 Sierra not running

Yes, I am certainly willing to help development. Can I run it alongside my current 10.12.3 installation, or do I have to remove that one first? Anything special you'd like me to report on?

BTW: I have manually created the ~/Documents/Sage folder, logged out and backing my account, waited a couple of days :-), fired up the app, clicked start Jupyter, and guess what? After a few seconds a browser tab opens showing Jupyter up and running. Hooray!

2017-04-29 13:17:12 -0500 commented answer Sage-7.6.app on macOS 10.12 Sierra not running

One step further on the iMac. After disabling the anti-virus software and removing anaconda from the path, the 10.12.3 dmg installs fine. The app runs as expected and fires up the old notebook interface. However, the Jupyter interface won't start. There is not even a sign in the sage.log file that it is trying to start Jupyter (unlike on the MBP). Puzzling...

2017-04-25 15:48:38 -0500 commented answer Sage-7.6.app on macOS 10.12 Sierra not running

Yes, I am running anaconda as well, both on the MBP and on the iMac. I don't have acces the iMac right now (travelling), but will check it this weekend to see what's different from the MBP. Trying the 10.11.6 dmg may not yield much if the above issue is an adverse interaction with another Python.

The anti-virus thing caught me unawares. I should have thought of that much earlier...

2017-04-25 08:23:28 -0500 received badge  Self-Learner (source)
2017-04-25 08:23:28 -0500 received badge  Teacher (source)
2017-04-25 08:12:14 -0500 answered a question Sage-7.6.app on macOS 10.12 Sierra not running

It's running on the MBP now. Apparently the F-Secure anti-virus software running on the machine doesn't like Sage and blocks it's execution (even though it doesn't say so in its logs). Removing the previous 10.12.3 installation and reinstalling if from scratch with F-Secure disabled solved the issue. Anyway, the next thing to resolve is how to automatically start the jupyter interface rather than the old notebook, but I guess that's another thread...

BTW, the iMac had the same issue. It starts the app now, but unfortunately doesn't like the 10.12.3 dmg. When starting the app, it opens two terminal windows, one of which shows the error messages copied below. I'll try the 10.11.6 dmg later.

10.12.3 dmg error message on a late 2012 iMac:

iMac-of-Tony:~ tony$ '/Applications/SageMath-7.6.app/Contents/Resources/sage/sage' --notebook=sagenb
Fatal Python error: Py_Initialize: unable to load the file system codec
  File "/Applications/SageMath-7.6.app/Contents/Resources/sage/local/lib/python/encodings/__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax

Current thread 0x00007ffff04043c0 (most recent call first):
/Applications/SageMath-7.6.app/Contents/Resources/sage/sage: line 130: 11912 Abort trap: 6           "$SAGE_ROOT/relocate-once.py"
Traceback (most recent call last):
  File "/Applications/SageMath-7.6.app/Contents/Resources/sage/src/bin/sage-notebook", line 7, in <module>
    import argparse
  File "/Applications/SageMath-7.6.app/Contents/Resources/sage/local/lib/python/argparse.py", line 85, in <module>
    import collections as _collections
  File "/Applications/SageMath-7.6.app/Contents/Resources/sage/local/lib/python/collections.py", line 21, in <module>
    from operator import itemgetter as _itemgetter, eq as _eq
ImportError: dlopen(/Applications/SageMath-7.6.app/Contents/Resources/sage/local/lib/python2.7/lib-dynload/operator.so, 2): Symbol not found: __PyUnicodeUCS4_AsDefaultEncodedString
  Referenced from: /Applications/SageMath-7.6.app/Contents/Resources/sage/local/lib/python2.7/lib-dynload/operator.so
  Expected in: flat namespace
 in /Applications/SageMath-7.6.app/Contents/Resources/sage/local/lib/python2.7/lib-dynload/operator.so
iMac-of-Tony:~ tony$
2017-04-24 10:07:03 -0500 commented question Sage-7.6.app on macOS 10.12 Sierra not running

Yes, I did move it from the dmg. When I open a terminal session and run /Applications/Sage-7.6.app/sage, eventually the sage: prompt appears and the browser-based notebook interface can be started by means of the notebook() command. It's ugly, but it works. The iMac is late 2012 and the MBP is early 2015, so not that old I would say...

2017-04-22 20:00:52 -0500 asked a question Sage-7.6.app on macOS 10.12 Sierra not running

Does the native app version of Sage need any changes to the system settings on macOS 10.12.3 to run?

After installing from sage-7.6-OSX_10.12.3-x86_64.app.dmg and launching the app from the launchpad, if first just sits there checking 'Sagemath-7.6' for tens of minutes. Then it complains about permissions (unknown publisher). After giving confirmation that it is OK to run the app, nothing happens anymore. The app get 0.0% CPU cycles.

It's probably something obvious, I haven't been able to figure it out yet.

(BTW: Both an iMac running 10.12.4 and an MBP running 10.12.3 show the same behaviour)