2021-03-28 07:32:33 +0200 | received badge | ● Famous Question (source) |
2018-08-13 19:13:01 +0200 | received badge | ● Good Answer (source) |
2018-08-13 19:13:01 +0200 | received badge | ● Enlightened (source) |
2018-08-09 14:08:34 +0200 | received badge | ● Nice Answer (source) |
2018-08-08 19:29:14 +0200 | answered a question | arrange an expression in powers of a variable Alternatively, you can use collect(): To get the coefficient of ep^2 you can do: To get all the coefficients at once: If you define you can access the coefficient of |
2018-02-01 15:58:06 +0200 | received badge | ● Notable Question (source) |
2017-04-05 17:48:36 +0200 | received badge | ● Civic Duty (source) |
2017-04-05 15:57:51 +0200 | commented question | Defining a generic symbolic function with symmetric arguments @mforets: Thank you for pointing that out! Now it works in general, see updated question. I can now also define an |
2017-04-05 12:38:25 +0200 | commented question | Defining a generic symbolic function with symmetric arguments @mforets: Thank you very much for suggesting a general Python audience, I will try that later. Regarding the recursion, you have to know when to stop sorting the arguments. I updated the question with one attempt that is not general wrt the number of arguments just as an idea to try. |
2017-04-03 21:00:56 +0200 | received badge | ● Popular Question (source) |
2017-03-29 00:25:38 +0200 | received badge | ● Commentator |
2017-03-29 00:25:38 +0200 | commented question | use multiple precision by default ? @tmonteil: I believe that he is doing something like QQ = RealField(1000) to have numbers with 1000 bits of precision and he does not want to keep on writing everything inside QQ(). It would be nice to have a 'default' precision command that one sets up in the beginning and forget about it |
2017-03-29 00:21:57 +0200 | commented answer | Arbitrary precision with power function Is there a way to choose a default precision such that one does not need to keep typing RealField(1000)? |
2016-11-05 02:37:05 +0200 | commented question | Speeding up power_mod @Wojowu Despite the different environments, ~45s to ~18s is a huge difference. I tested |
2016-11-05 01:26:29 +0200 | commented question | Speeding up power_mod @Wojowu I'd expect GMP's .powermod to have a similar performance as Julia since Julia uses GMP too. But you cannot really compare the methods unless you compare them running in the same computer under the same load. So using JuliaBox and SageMathCloud makes all the difference to the point that you cannot really make any definitive statement of Julia vs Sage. |
2016-11-03 21:20:46 +0200 | commented answer | Defining a generic symbolic function with symmetric arguments Right, s(1,1) makes sense but it is zero. So in general one can restrict the labels to be distinct. Furthermore, s(i,j) is commutative. In Mathematica terms I am looking for the equivalent of using something like SetAttributes[s, Orderless] and nothing more. |
2016-11-03 09:42:36 +0200 | received badge | ● Good Question (source) |
2016-11-02 15:38:41 +0200 | received badge | ● Enthusiast |
2016-11-01 19:03:39 +0200 | commented answer | Defining a generic symbolic function with symmetric arguments So ideally one would have the choice of defining a symmetric function via an argument to the |
2016-11-01 19:00:30 +0200 | commented answer | Defining a generic symbolic function with symmetric arguments Thank you for your answer, but this is not really what I am looking for. The name of the function in the input must be the same as the output; ie I want to type |
2016-10-30 14:27:50 +0200 | commented question | Speeding up power_mod |
2016-10-30 13:50:20 +0200 | commented question | Speeding up power_mod Julia uses the gmp library (see line 440 of [https://github.com/JuliaLang/julia/bl...]), whereas Sage uses a hand-made power_mod() function in python (see [https://github.com/sagemath/sage/blob...]). So one way to speed up Sage's power_mod() function is to implement it in pynac. Have you compared to Python's built-in pow(a,b,c) function, where c is the modulus? see here [https://docs.python.org/3/library/fun...] |
2016-10-22 02:44:35 +0200 | answered a question | How to find a polynomial identity to evaluate sum of fifth powers? You can also solve it a bit more directly without explicitly invoking the Groebner basis (this happens under the hood). (I came up with this solution after reading the solution to Exercise 37 from the book "Calcul Mathematique avec Sage", given on page 423) |
2016-10-06 07:04:02 +0200 | received badge | ● Teacher (source) |
2016-10-03 16:17:11 +0200 | answered a question | leading coefficient polynomial For example, you can extract its coefficients as follows: to get So the last sublist contains the answer, in this case 2 is the coefficient of x^4. To extract this automatically you can define a function that takes a polynomial as argument: And use it like this: to get 2 as the answer. Hope this helps you get going! |
2016-09-30 13:17:21 +0200 | commented question | Is there a command like Mathematica's Dynamic[] in Sage? There is a "profiling" section in the tutorial http://doc.sagemath.org/pdf/en/tutori... which could be helpful. |
2016-09-25 19:20:05 +0200 | received badge | ● Scholar (source) |
2016-09-25 16:26:17 +0200 | received badge | ● Nice Question (source) |
2016-09-24 23:55:43 +0200 | asked a question | solve((x^3 - 4*x) > 0,x) does not enforce condition assume(x > 0) I actually have two (related) questions. First question, am I misunderstanding the following code? The solution given by sagemath-7.3 is but I would expect only the solution [x > 2] under the condition x > 0. Is this a bug or am I doing something wrong? Second question. How can I enforce the condition x > 0 myself and "solve" the resulting conditions of: How can I solve this type of question efficiently? I believe that discarding the negative solutions in the above system will imply that 2 < D < 1/9(116 - sqrt(1081)), for example. However, I'd like to do this for many other cases as well. Any help will be appreciated! |
2016-09-22 18:50:48 +0200 | received badge | ● Nice Question (source) |
2016-09-22 18:41:52 +0200 | received badge | ● Editor (source) |
2016-09-19 22:51:05 +0200 | received badge | ● Supporter (source) |
2016-09-19 21:43:23 +0200 | received badge | ● Student (source) |
2016-09-18 23:05:36 +0200 | asked a question | Defining a generic symbolic function with symmetric arguments Updated question: I would like to define a generic symbolic function called s whose arguments are totally symmetric. So if I type s(3,2) the output must be s(2,3), and similarly and in general some arbitrary product Is it possible to have such a definition? It would be nice if there was an argument to the built-in Solution from Apr/2017: Upon reading Sage's source code I noticed the 'eval_func' option when defining functions. So if I define (following a suggestion of mforets, thanks!): and define the (Mandelstam invariant) everything works. For example So I consider this question closed! |