2019-05-24 11:06:33 -0500 | answered a question | How to use sagetex? I'm not familiar with the setup you are using but to use sagetex, latex your example.tex file. This will create a .sage file. Next, use the Sage terminal to load the .sage file. The file not found error sounds like you're running Sage on the wrong directory so try cd (change directory) to the directory containing your .sage file when using the Sage terminal. Finally latex your .tex file again. You can find more detail to this answer by looking at an answer posted by DJP here. The easiest way, however, to get up and running with LaTeX, Sage, and Sagetex is with a free Cocalc account. Just create a .tex file, copy/paste example.tex into it, and then compile and you're done. |
2019-04-01 05:59:56 -0500 | received badge | ● Nice Answer (source) |
2019-03-31 21:51:57 -0500 | commented answer | Create program to find which graphs contain specific subgraph There is an extensive, almost 900 page, pdf reference doc just on graph theory which is available here. |
2019-03-31 19:32:44 -0500 | answered a question | How to save combinations of plots? Basically you want to save the picture, not show it. combining show and save is the problem. Try this: Press on the link pic.pdf to see it and download it. Note, with multiple plots you might want to color them. This can be done, for example, with b = plot(f2, (x,-1,2),color='red'). If you want to show as well insert the line pic.show() right after pic is defined. EDIT: As Juanjo comments below, you can combine the 3 plots into 1. If you stack the functions together on one line using ; you can compress the code even more: |
2019-03-30 21:57:42 -0500 | answered a question | Create program to find which graphs contain specific subgraph How about: After defining the subgraph you want, the cycle on 5 vertices, look through the graphs in g10 and figure out if it has H, not necessarily induced. It then prints out the graphs. The documentation for subgraph_search is here. EDIT: With respect to your comment below, I think that it is possible but I don't know enough of the intricacies of the graph theory commands. Consider this code. For each graph in g10 it looks for a non-induced C_5. If the graph has it then it looks for an induced K_4. When it finds it, it looks at all the vertices in it (the subgraph p which is a K_4) and looks to see if the degree of any vertex is less than 6. If so, it prints out "False", the 4 vertices inducing K_4 and the graph from g10 that they are a subgraph of. If you didn't require the graph to have H then you can easily modify the code to what you want. |
2019-03-29 10:30:33 -0500 | commented question | desolve (how can i enable numeric?) The documentation is not as user friendly as a guide; this is useful. I don't have experience with differential equations but adding contrib_ode=True, show_method=True to desolve tells you it's separable and after adding the lines c = de.variables()[0] sol = solve(de,y) ; sol as suggested in the guide (page 219) gets you closer. One of the experts here will know what to do. |
2019-03-29 08:38:51 -0500 | commented question | desolve crazy output Type (f-blob).find_root(0,10) to tell SAGE to find the root that you know is in the interval from 0 to 10 and ignore the rest. |
2019-03-08 07:58:14 -0500 | commented answer | How to change sqrt(5) to decimal? |
2019-02-19 12:08:10 -0500 | commented question | Trouble Plotting a Function You should give details that tmonteil asks for in order for the whizzes here to figure out what is wrong. |
2019-02-19 11:53:48 -0500 | commented question | Trouble Plotting a Function If you go to the Sage Cell Server here and copy/paste and run your code, it works fine. |
2019-02-03 10:06:26 -0500 | commented question | Piecewise in SageTeX Can you post your LaTeX code? I have no trouble plotting the piecewise function you used with |
2018-11-30 02:41:05 -0500 | received badge | ● Nice Answer (source) |
2018-11-29 12:09:16 -0500 | commented answer | log base 2 in sagemath Nice! I wasn't aware of that book. |
2018-11-29 11:52:50 -0500 | answered a question | log base 2 in sagemath You've done it correctly and SAGE gives you the exact answer. If you try log(8,2) you'll get 3 because that's the exact answer and no logs are required. To force a numerical answer try, for example log(1000,2).n(digits=9) to get an approximate answer of 9.96578429. You can check if that's close by typing 2^9.96578429 to get 1000.00000369996. Want a closer answer? Change to digits=12 and repeat. Same thing with other functions such as sqrt(2).n(digits=4) Alternatively, the documentation gives n(log(1000,2)) which gives you the approximation 9.96578428466209 with less key strokes. You can find the log function documentation here |
2018-11-23 14:53:33 -0500 | commented answer | Is it possible to access Sage with an android tablet? I tried but your instructions haven't working for me. I was, for example, pushed to install ConnectBot and then didn't seem to configure it correctly. So I could never get to CLI prompt. I'm stuck in ConnectBot with an error about "the authenticity of 'localhost' can't be established". |
2018-11-22 09:18:01 -0500 | commented question | Is it possible to access Sage with an android tablet? I've had problems with using the Sage app but there is a Sage Cell Server on the internet. So any tablet can access Sage. I don't find them convenient for anything but a couple of lines of code, given the lack of a real keyboard. |
2018-11-07 20:06:15 -0500 | commented question | drawing the corners for the inner parallelogram(solved) I'm having trouble understanding the question. What is a angle circle? From your code, I think you might mean arc. Your commented line is drawing the arc for an ellipse. The documentation is here and at the bottom of the page indicates you would want something like g+=arc((0,0), 1, sector=(pi/4,3*pi/4)) but I'm not sure where you want it to start and stop. What does "and add the alpha character into it" mean? |
2018-11-07 10:18:34 -0500 | commented question | finding general term of a sequence There is no "the nth term" for a sequence like you've given with ... . For example: 1,2,3,.... could be the sequence f(n)=n or it could be f(n)=n^3-6n^2+12n-6. There are actually an infinite number of formulas that could work here. |
2018-10-26 21:45:33 -0500 | commented question | Need help with plotting This sounds like homework where there's a misunderstanding as to what you're supposed to do. Try: t = var('t') parametric_plot((cos(t)+cos(2t), sin(t) + sin(3t)), (t, 0, 2*pi), color=hue(0.6)) to see the parametric curve formed by your equations above. You can't form a line without a specific value of t to get the second point. |
2018-10-26 11:41:45 -0500 | commented question | Indefinite integral is incorrect |
2018-10-21 11:23:05 -0500 | answered a question | next prime number Here is a possible implementation of what you are trying to accomplish using a Sage interact and the prime_range function that slelievre mentions in their answer: Copy and paste the code into a Sage Cell Server. Press Evaluate. To change the start value the user can go to the input cell, type, for example, 35, and press enter. The Sage Interact then updates the results. |
2018-10-19 10:52:09 -0500 | commented question | drawing the function y = |log x| Although most people learn the logarithm has domain positive reals and range all reals the logarithm, like other functions such as e^x, gets extended to the complex number system. Type: log? on the command line for Sage to see further down: "The log function works for negative numbers, complex numbers, and symbolic numbers too, picking the branch with angle between -pi and pi". Since the absolute value of a complex number is just its distance from the origin Sage has done everything correctly. |
2018-10-02 10:35:17 -0500 | commented question | Help in generating Ulam numbers This isn't a Sage related issue; it's a Python coding question. You can find working Python code for this problem on the internet with a simple internet search. |
2018-09-24 20:05:51 -0500 | answered a question | How to plot a set of points? The documentation for Sage plotting in 2 dimensions is here. From your description, I think you are talking about region_plot(). Here's an example: The region plotted consists of the points satisfying both inequalities (intersection), where x is in the interval [-2,2] and y is in the interval [-2,2]. |
2018-04-12 08:08:30 -0500 | marked best answer | Changing vertex labels on a randomly generated graph I know that if I want to create a graph on 4 vertices with vertex labels 1,2,3,4 then I can define my graph like this: G = Graph({0: [1, 3], 1: [2, 3,4], 2: [1,4], 3: [], 4: []}) and then when I print in LaTeX using sagetex the labels show up as 1,2,3,4 but when I try to create a graph randomly graphs.RandomGNM(4,5)).show(figsize=[4,4], graph_border=True) the vertex labels are 0,1,2,3. How do I change the default vertex labels of a randomly created graph? |
2018-04-12 08:08:12 -0500 | received badge | ● Famous Question (source) |