2019-11-25 06:48:00 -0600 received badge ● Taxonomist 2019-10-09 14:45:15 -0600 answered a question Mac OS Catalina Does Not Allow Launching Sage There should be an option in System Preferences > Security & Privacy to open any downloaded app. Follow the instructions at the very bottom of this web page. 2019-10-08 15:57:18 -0600 answered a question Hypergeometric Bug? Sage uses mpmath for numerical evaluation. The documentation for the underlying function says explicitly: If a nonpositive integer −n appears in both a_s and b_s, this parameter cannot be unambiguously removed since it creates a term 0 / 0. In this case the hypergeometric series is understood to terminate before the division by zero occurs. This convention is consistent with Mathematica. I have confirmed that Mathematica gives the same answers as Sage. Apparently Maxima chooses a different convention, so be aware of this. 2019-09-12 17:17:44 -0600 commented answer jmol stuck at "Initializing 3D display" I'd also like to know what outstanding major problems there are with the Three.js viewer. Please add them to #22408 at your convenience. 2019-07-01 04:51:31 -0600 received badge ● Nice Answer (source) 2019-06-30 20:06:30 -0600 answered a question Numerical integration and plot failing Here’s a workaround for plotting: list_plot( [[t, F(t)] for t in (1,1.1..2)], plotjoined=True ) with a live example. For integration you could likewise evaluate the function at discrete points, add all interior evaluations plus half of the values at the endpoints and multiply by the step size (i.e., a discrete integral). 2018-12-21 01:15:22 -0600 received badge ● Good Answer (source) 2018-09-24 08:54:46 -0600 received badge ● Notable Question (source) 2018-06-25 03:56:45 -0600 received badge ● Nice Answer (source) 2017-10-08 12:36:26 -0600 received badge ● Nice Question (source) 2017-10-08 12:36:21 -0600 marked best answer numerical_integral in piecewise function If I define a Python function with a numerical integral def g(x): var('u') return numerical_integral(u,0,x)[0] then it behaves as expected for example when plotting with plot(g). If it is included as part of a piecewise function like f = piecewise([[(-1,0),-x],[(0,1),g]]) plot(f) then the plot shows up just fine for Sage 6.9 (which was running on sagecell.sagemath.org), but for Sage 7.2 (which is running on the test server) one gets the error message --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () 4 5 ----> 6 f = piecewise([[(Integer(0),Integer(1)),g]]) 7 plot(f) /home/sc_serv/sage/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (/home/sc_serv/sage/src/build/cythonized/sage/misc/lazy_import.c:3628)() 384 True 385 """ --> 386 return self._get_object()(*args, **kwds) 387 388 def __repr__(self): /home/sc_serv/sage/local/lib/python2.7/site-packages/sage/functions/piecewise.py in __call__(self, function_pieces, **kwds) 149 function = function() 150 else: --> 151 function = function(var) 152 function = SR(function) 153 if var is None and len(function.variables()) > 0: in g(x) 1 def g(x): 2 var('u') ----> 3 return numerical_integral(u,Integer(0),x)[Integer(0)] 4 5 /home/sc_serv/sage/src/sage/gsl/integration.pyx in sage.gsl.integration.numerical_integral (/home/sc_serv/sage/src/build/cythonized/sage/gsl/integration.c:3387)() 329 else: 330 _a=a --> 331 _b=b 332 W = gsl_integration_workspace_alloc(n) 333 sig_on() /home/sc_serv/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.__float__ (/home/sc_serv/sage/src/build/cythonized/sage/symbolic/expression.cpp:10403)() 1384 return float(self._eval_self(float)) 1385 except TypeError: -> 1386 raise TypeError("unable to simplify to float approximation") 1387 1388 def __complex__(self): TypeError: unable to simplify to float approximation Am I missing something simple or is this a bug in Sage 7.2? There is an existing ticket that appears relevant: http://trac.sagemath.org/ticket/14801 2017-10-08 12:36:21 -0600 received badge ● Nice Answer (source) 2017-09-28 17:33:39 -0600 received badge ● Nice Answer (source) 2017-07-21 11:39:24 -0600 received badge ● Popular Question (source) 2017-03-24 19:15:18 -0600 commented answer Evaluating symbolic expression, when some variables are finally fixed Needs a minor edit of V to R... 2017-03-24 17:41:35 -0600 answered a question Substitute piecewise function variable If you check the type of h with type(h), it comes back as which is not numeric but symbolic. You can convert it to a numeric value with n(h) or h.n() and then the substitution will give zero as expected. 2017-03-24 17:27:01 -0600 answered a question label a point on a 3d graph You're looking for text3d. Documentation is here 2017-03-23 08:53:22 -0600 received badge ● Necromancer (source) 2017-03-22 18:58:49 -0600 answered a question solving a physic problem using sage Your first three equations for the balance of the components of force look fine. Your fourth equation, while accurate, is less useful than writing the tensions $S_x$ and $S_y$ as projections of the total tension $T$: $\qquad S_x = \frac{x}{\sqrt{x^2+j^2}}T \qquad S_y = \frac{j}{\sqrt{x^2+j^2}}T$ Your fifth equation is incorrect, since it says that the amount of rope on each side of the nail is always equal, which is not true for a sliding inelastic rope. If the rope is of length $L$, then the constraint you want is $\qquad y + \sqrt{x^2+j^2} = L$ If you take a second derivative of this constraint with respect to time and substitute it in the first equation, you'll have an expression for the total tension $T$ as a function of $x$ and $j$ and their derivatives. You can use that to eliminate $T$ from the second and third equations. Then you should have three coupled nonlinear differential equations for $x$, $j$ and $y$ without $T$. At that point you'll have to numerically integrate the equations as a system using for example this method. You'll need to solve for all second derivatives and then introduce intermediate variables for the first derivatives of $x$, $j$ and $y$ in order to write the system in terms of first-order equations. The problem you're trying to solve is mathematically identical to the swinging Atwood machine, but with one point of support instead of two. While it can be done in Cartesian coordinates, it will look a lot simpler in polar coordinates. Cheers! 2017-03-20 04:51:59 -0600 received badge ● Good Answer (source) 2017-03-19 15:02:53 -0600 edited answer Show Sage results in a webpage as string (not as Sagecell box) There is an existing way to use SageMathCell as a web API. It's described briefly here, but since the documentation needs improvement I'll record some information here. One way to access the API is by submitting a form to http://sagecell.sagemath.org/service (do not include a trailing slash on this URL). The documentation has a JSFiddle that I have updated for your specific example. Your command (or any other that returns a printable result) appears in a text input on the fiddle, and the output is printed below when the button is clicked. The fiddle works by URL encoding the command and posting it to the server. If you don't want to use a form, you can read the input from a text field and submit it to the server with an XMLHttpRequest. Here's some sample code that sends your URL-encoded command to the server and opens an alert window with the result: var xhr = new XMLHttpRequest(); xhr.open( 'POST', 'http://sagecell.sagemath.org/service', true ); xhr.onload = function() { var data = JSON.parse( xhr.responseText ); alert( data.stdout ); } xhr.setRequestHeader( 'content-type', 'application/x-www-form-urlencoded' ); xhr.send( 'code=P%3DPrimes()%3B+print+P.next(2016)' ); And for command line people, here's how to get the same JSON data using cURL: curl -d 'code=P%3DPrimes()%3B+print+P.next(2016)' http://sagecell.sagemath.org/service References for SageMath as a web API came from this issue on GitHub. Thanks @novoselt! 2017-03-18 19:50:01 -0600 received badge ● Nice Answer (source) 2017-03-18 17:25:06 -0600 commented answer Error while Integrating with mathematica algorithm That's peculiar, since I don't have any errors after the fix. Did you rebuild using sage -b before running? 2017-03-18 15:55:14 -0600 answered a question Error while Integrating with mathematica algorithm The name of the website page has changed from "index.jsp" to "home.jsp". I've submitted a Trac ticket to fix that. If you know how to build Sage from source you can fix it on your copy as well or wait for Sage 8.0 (next version after soon-to-be-released 7.6). 2017-03-18 10:54:10 -0600 received badge ● Necromancer (source) 2017-03-17 15:47:03 -0600 received badge ● Nice Answer (source) 2017-03-16 18:38:37 -0600 commented question Echo input in output. I didn't realize myself that derivatives will now appear typeset if entered as fully symbolic functions, so you taught me something! As a former Mathematica user, I myself still don't quite get all the different ways Sage processes functions, symbolic or merely callable, so welcome to the club. That whole process could be made clearer. P.S. if you put square brackets around the first URL in each pair and leave the parentheses around the second URL, they should the work like proper links for future readers. 2017-03-15 15:29:45 -0600 answered a question Echo input in output. Typesetting for objects like derivatives, integrals and limits is not yet fully implemented in Sage, so the icing isn't available. You can however do something manually like this, show( "f(2)=", f(2) ) show( "f'(x)=", diff(f(x),x) ) show( "∫f(x)dx=", integrate(f(x),x) ) which gives the sort of output you want. 2017-03-15 15:00:42 -0600 answered a question Sage Math future (notebook vs cloud vs jupiter)? There is a plan to replace the legacy Sage notebook with the Jupyter notebook as of Sage 8.0, which will be the release after the next one. Here is some discussion about the change. This will bring Jupyter to the desktop along with automatic conversion of legacy notebooks. 2017-03-11 15:29:40 -0600 commented answer Integrating Log(x²+y²) The answer depends only on L^2, so the sign of L won't change anything. 2017-03-10 20:57:55 -0600 answered a question Integrating Log(x²+y²) Since the arguments of the logarithm are squared, your second integral merely reverses the order of integration compared to the first. The second integral is the negative of the first: if you add them together you'll get zero. 2017-03-09 22:51:06 -0600 received badge ● Good Answer (source) 2017-03-09 15:45:29 -0600 received badge ● Nice Answer (source) 2017-03-09 15:09:05 -0600 answered a question limit of function with dirac delta To expand on the comment by @kcrisman, limits are sent to Maxima by default. Maxima can evaluate the limit of the step function: entering unit_step(x).limit(x=0,dir='right') returns 1 as expected. Maxima cannot evaluate the limit of the Dirac delta: entering dirac_delta(x).limit(x=0,dir='right') returns an unevaluated expression. Since part of your limit cannot be evaluated by Maxima, it all comes back unevaluated. The other option for limit evaluation is to set algorithm='sympy': entering dirac_delta(x).limit(x=0,algorithm='sympy') returns zero as expected. Unfortunately, entering dirac_delta(x).limit(x=0,dir='right',algorithm='sympy') gives the message sympy does not support one-sided limits Even more problematic, entering unit_step(x).limit(x=0,algorithm='sympy') gives the message SymPy function 'unit_step' doesn't exist so SymPy won't get the complete job done either. Not exactly the answer you want, but hopefully it helps you understand what's happening. 2017-03-07 15:05:22 -0600 answered a question Sage cell server dead after one request from client Some aspects of the behavior of the cell sever are designed to reduce the costs of its operation, and I would assume that applies here. If you want to know whether a change to the public server is possible, you could open an issue on https://github.com/sagemath/sagecell to get a reply from the maintainer of the server. The documentation mentioned above has moved to here. 2017-03-05 18:18:45 -0600 answered a question command line use of "?" Press q. 2017-03-01 11:18:23 -0600 received badge ● Nice Answer (source) 2017-02-27 16:14:35 -0600 commented answer Button Callbacks Answer updated 2017-02-26 15:22:27 -0600 answered a question Loaded event for sagecell There is an official callback event, but in my testing it fires long before the cell is finished processing. If you want to wait until the cell is fully displayed, you'll need to open a websocket to one of the addresses given at the beginning of this document https://github.com/sagemath/sagecell/wiki/Session and then listen for the appropriate response. The document gives sample messages for the entire process of communicating with the cell server, including interacts. 2017-02-24 16:09:45 -0600 answered a question Button Callbacks The legacy Sage notebook had JavascriptCodeButton but this was apparently not implemented in SageMathCell. The latter does have a Button element that can be used to run Python code as part of the interact: you can find an example at the beginning of this Python source file. 2017-02-24 16:06:56 -0600 answered a question Running Sage in background of site You can hide various input and output elements: see this documentation topic. You can also access the cell server as a web service and manipulate the returned JSON yourself with JavaScript. There is an extremely brief mention available, which prompted me to put together this explicit usage on my website. 2017-02-22 19:43:04 -0600 answered a question More Complex Interact Layout How about something like this (live example here): @interact(layout=[['a','b'],['t1'],['c','d'],['t2']]) def _(a=x^2, b=[1..3], c=-x ,d=[1..3], t1=text_control('Some text'), t2=text_control('Some other text') ): show(plot(a*b+c*d,0,3)) You can keep adding rows in this form of the layout. You can force the buttons closer to the input boxes by adding additional text controls after the buttons containing blank space: the automatic alignment appears to depend on the number of items in a row. 2017-02-22 19:07:40 -0600 answered a question Installation problem on Mac I'll bet you have Anaconda installed. Previous answers have indicated that removing a single line from a configuration file will allow Sage to run with Anaconda installed: Anaconda adds itself to the $PATH variable through .bashrc during installation. Removing any references to Anaconda in your$PATH should allow Sage to run. The other alternative which is known to work is to uninstall Anaconda completely.