2019-11-25 06:38:56 -0600 | received badge | ● Nice Answer (source) |
2019-11-24 19:30:17 -0600 | commented answer | Sagemath and TI-83 giving different answers Hmmm. I searched this site and found this. It sounds like nth_root() might be something to remember as long as you keep the base from looking like an integer. That is: but not which gives an error. |
2019-11-22 19:41:11 -0600 | answered a question | Sagemath and TI-83 giving different answers I don't have knowledge of the coding decisions in SAGE but I've got some math background that helps me to understand why the SAGE answer could be considered "better" than the real answer you expected. In math terms it has to do with the fact that the nth roots of unity form a group and some of the answers are generators for the group (primitive elements). That is, knowing a generator gets you all the answers. Okay, that's a bit technical, so look at this simpler problem x^4=1. There 4 answers: 1, -1, i, -i. The root i is primitive because: i, i^2, i^3, i^4 gives i, -1, -i, 1 which is all the roots of the answer. This doesn't work with 1 since 1, 1^2, 1^3, 1^4 is always 1 and it doesn't work with -1 since -1, (-1)^2, (-1)^3, (-1)^4 gives -1,1,-1,1. SAGE has given you the primitive element needed to create all the answers. Your answer -cuberoot(3) won't generate the other 2 answers as real number times real number is always a real number. The answer SAGE has given is a primitive root that will create the other roots. It's a little bit more complicated for your example as the modulus of your number is not 1 and your number is negative but same idea is in play. Some of it is covered in precalculus when you get to DeMoivre's Theorem. There is a post at math stack exchange here relevant to your problem if you want a little more math. EDIT: Based on Sebastien's comment below, I dusted off a book on complex number theory to find that, for nth root of a complex number the unique nth root is defined to be when k=0 in the formula for the nth roots and is called the principal nth root. So for z^3=3, r=cuberoot(3) and theta = 0 (the angle used in polar form representation of 1) so the formula for the roots is cuberoot(3)cis((0+2kpi)3) = cuberoot(3) cis(0), cuberoot(3) cis(2pi/3), cuberoot(3)cis(4pi/3). For z^3=-3, r=cuberoot(3), but now theta = pi so the formula for the roots is cuberoot(3)cis((pi+2kpi)/3)= cuberoot(3)cis(pi/3), cuberoot(3)cis(pi), cuberoot(3)cis(5pi/3). So perhaps SAGE is giving the princpal root which is then used to get the rest via the formula? |
2019-11-18 19:57:12 -0600 | received badge | ● Popular Question (source) |
2019-10-09 10:15:14 -0600 | commented question | How to draw the following graph in sagemath? It looks like you've asked the same question on LaTeX Stack Exchange here. LaTeX, through the tkz-berge package, is probably the best way to specify the position to create a diagram. |
2019-09-07 21:34:01 -0600 | commented question | solving simultaneous equations with solve() I don't know what's going wrong here. I'll leave that to the experts. I did find that not specifying the algorithm gives many solutions, including the solution you list. I tried assume(x>0,y>0) but that didn't work. |
2019-09-02 11:03:15 -0600 | commented question | how do I enter 2sin|1−3√2|cos|1+ 2√3| The problem you've written makes no sense. Please clarify: What is the argument for sin? Should sin * be sin( ? If so where should the closing parenthesis be? Same could asked for cos. Assuming you mean 2 * sin(abs(1-3 * sqrt(2)))*cos(abs(1+2 * sqrt(3))) then I have Sage running without a problem, with an answer of about 0.049579. |
2019-08-05 09:52:55 -0600 | commented answer | Code to find separating set in SageMath of a given Graph I don't see anything in the documentation that would provide all minimal separating sets of a graph. Given that circulants would have a lot of vertex separating sets, I don't see any way around brute force checking whether the removal of k vertices (where k is the vertex connectivity) over all subsets of k vertices results in a disconnected graph. If so add to the list. |
2019-08-04 10:27:23 -0600 | answered a question | Code to find separating set in SageMath of a given Graph Try this code: The result, running in a SageCell Server is Which says the vertex connectivity is 3 and the vertices 1,2,3 are such a set. The documentation for vertex_connectivity() is here. |
2019-07-28 18:36:01 -0600 | answered a question | How to compute a perfect matching in a general graph? You should download the PDF documentation which is available here. On page 222 there are 3 listed:
Clicking on each method will bring you to more instructions and examples. |
2019-06-22 19:13:29 -0600 | commented answer | find all matchings in a graph That makes sense; then just needs a loop from 0 to vertices/2. |
2019-06-21 19:08:11 -0600 | commented question | find all matchings in a graph The documentation has matching_polynomial here; it's coefficients, ignoring the sign, tell you the number of matchings as the the number of edges increases. The matching polynomial for the Petersen graph is x^10 - 15x^8 + 75x^6 - 145x^4 + 90x^2 - 6 which would be interpreted as 1 matching with 0 edges, 15 matchings with 1 edge, 75 matchings with 2 edges, 145 matchings with 3 edges, 90 matchings with 4 edges, and 6 matchings with 5 edges. It doesn't list the matchings but the documentation mentions an algorithm used to get the polynomial. |
2019-05-24 11:06:33 -0600 | 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 -0600 | received badge | ● Nice Answer (source) |
2019-03-31 21:51:57 -0600 | 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 -0600 | 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 -0600 | 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 -0600 | 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 -0600 | 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 -0600 | commented answer | How to change sqrt(5) to decimal? |
2019-02-19 12:08:10 -0600 | 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 -0600 | 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. |