2024-07-01 13:11:56 +0100 | received badge | ● Famous Question (source) |
2023-12-06 00:11:03 +0100 | received badge | ● Famous Question (source) |
2022-10-31 13:37:50 +0100 | received badge | ● Popular Question (source) |
2022-10-31 13:37:50 +0100 | received badge | ● Notable Question (source) |
2021-07-23 20:15:45 +0100 | received badge | ● Notable Question (source) |
2021-03-25 07:37:16 +0100 | received badge | ● Popular Question (source) |
2020-12-23 18:12:58 +0100 | received badge | ● Notable Question (source) |
2020-07-21 10:19:20 +0100 | received badge | ● Popular Question (source) |
2019-12-12 17:46:24 +0100 | received badge | ● Popular Question (source) |
2019-08-26 15:36:13 +0100 | received badge | ● Famous Question (source) |
2019-08-26 15:36:13 +0100 | received badge | ● Notable Question (source) |
2019-01-18 00:09:31 +0100 | received badge | ● Popular Question (source) |
2018-10-11 08:31:21 +0100 | commented answer | Numerical calculation speed: Sagemath vs. C vs. Matlab Thanks. I think that is meant for very short code (which is a good thing for some situations). |
2018-10-10 21:31:52 +0100 | commented answer | Numerical calculation speed: Sagemath vs. C vs. Matlab Thank you for the answer. I will look up some Numpy benchmarks. I might even write the numerical part in plain python without Sagemath, but I will probably run into problems with regard to lack of linear algebra packages there. But my aim is to distribute the resulting software in a small program. Relying on Sagemath will need the 2-Gig installation. |
2018-10-10 21:26:53 +0100 | received badge | ● Commentator |
2018-10-10 21:26:53 +0100 | commented answer | Numerical calculation speed: Sagemath vs. C vs. Matlab Thank you for the very detailed response. I am trying write a research paper and I want to use free software for doing it, and I think Python based Sagemath Jupyter is gaining traction within the scientific community (did you hear that the economy nobel price winner of this year uses it?). It would benefit me to streamline all parts (both the symbolic computations and the numerical part) in one sheet. Thank you answering the question I was too shy to ask: how to force Sagemath to stop treating numbers as symbolic and just do regular double-precision calculations. I will post the feedback if I did end up writing it in Sagemath instead of taking numerics to a separate C program. Thanks again. |
2018-10-10 09:23:47 +0100 | asked a question | Speed of numerical calculation: Sagemath vs. C vs. Matlab I mostly use Sagemath for performing symbolic operations on trigonometric polynomials. But I was wondering if it is also a good tool in numerical methods. This includes matrix operations and iterative solution of PDEs with finite difference methods. Usually I take the Sagemath outputs to another program more suited to numerical work. But I was wondering if Sagemath itself is a viable choice in this resepct. Can you tell me about its numerical performance and speed compared to other programs such as C, Matlab, Julia, Mathematica etc.? Thanks |
2018-10-10 09:22:46 +0100 | asked a question | Numerical calculation speed: Sagemath vs. C vs. Matlab I mostly use Sagemath for performing symbolic operations on trigonometric polynomials. But I was wondering if it is also a good tool in numerical methods. This includes matrix operations and iterative solution of PDEs with finite difference methods. Usually I take the Sagemath outputs in another program more suited to numerical work. But I was wondering if Sagemath itself is a viable choice in this resepct. Can you tell me about its numerical performance and speed compared to other programs such as C, Matlab, Julia, Mathematica etc.? Thanks |
2018-10-06 11:14:19 +0100 | marked best answer | How to get coefficients of a multivariate trigonometric polynomial? I have a trigonometric polynomial which is something like this: A = (b1+2) * sin(x) + (b2+q) * sin(x)^2cos(x) + (b3/b1+6) * sin(x)cos(x) + b4 * cos(x)^4 + b5 I want to get the coefficients of the multivariate polynomial with respect to sin(x1) and cos(x1). Please note that all other variables should be treated as coefficients, including b1, b2, b3, b4, b5 and q. I would rather do this with coefficient() command, but my only problem is that coefficient command works for univariate polynomial. I can write: A.coefficients(sin(x)) But I can't write A.coefficients({sin(x),cos(x)}) because it given an error. What can I do? The answer should produce something like this: coefficient,(exponent of sin(x),exponent of cos(x)); b1+1,(1,0); b2+q,(2,1); b3/b1+6,(1,1); b4,(0,1); b5,(0,0). |
2018-10-06 11:14:16 +0100 | marked best answer | get the coefficients of polynomial of several variables? Consider that I have a polynomial with n variables x1,x2,...,xn and want to get the coefficient of that polynomial. For example I can have: x1+2x1x5^2+3x1^2x4-5x2x5^2+1/2x2x3+x6^2x7x8+9x3x9^3 I would like to ask Sage to give coefficient for the polynomial with variables x1..x9 and the result should be something like this: coefficient,(exponent of x1..x9); 1,(1,0,0,0,0,0,0,0,0); 2,(1,0,0,0,2,0,0,0,0); 3,(2,0,0,1,0,0,0,0,0); -5,(0,1,0,0,2,0,0,0,0); 1/2,(0,1,1,0,0,0,0,0,0); 1,(0,0,0,0,0,2,1,1); 9,(0,0,1,0,0,0,0,0,3) How can I achieve this? |
2018-10-06 11:14:11 +0100 | marked best answer | Should I always use .expand() before using .coefficient()? I used the following code in SageMath (Windows binary, version 8.1): Obtaining the coefficients of polynomial with respect to eps: but using Clearly the second one is correct. Does this mean that I should always use |
2018-10-06 11:14:04 +0100 | marked best answer | Function of symbolic array elements I want to create a function like this: However, the thing that the function is supposed to return is calculated in an earlier part of the program. Since Sagemath has a problem with symbolic indices, I have previously defined A and B as follows: The thing that the function should return is calculated in another part of the program. Suppose that it is something like this (evaluated from a separate subroutine): So my question is: how do I turn this |
2018-10-06 11:06:05 +0100 | commented answer | Print symbolic variables like a_1 in A[1] style Yes, I noticed your answer edit. Thanks alot. I was trying to substitute but I had to use a new name, but your approach eliminates the need for declaring new names. Thank you. Also thanks about the sympy advice for automatic C code conversion. Are there options for MATLAB and BASIC languages too? |
2018-10-06 10:55:26 +0100 | received badge | ● Scholar (source) |
2018-10-06 10:55:08 +0100 | commented answer | Print symbolic variables like a_1 in A[1] style Thank you very much! Yes your solution actually works! I will make the substitution at the very end before interfacing to C. Incidentally, since you have been so helpful, would it be possible to give me a hint about what I can do about the conversion of |
2018-10-06 10:43:00 +0100 | commented answer | Print symbolic variables like a_1 in A[1] style Thank you for the answer. However, the solution you said is causing problems for me. When I try to apply the |
2018-10-06 10:37:35 +0100 | received badge | ● Supporter (source) |
2018-10-06 10:25:13 +0100 | received badge | ● Student (source) |
2018-10-06 05:30:25 +0100 | asked a question | Print symbolic variables like a_1 in A[1] style Because of Sagemath's problem with symbolic arrays, I have defined my vectors like this: I have some symbolic variables stored in another variable. Lets say I have a subroutine that works with |
2018-09-17 12:19:32 +0100 | commented answer | Function of symbolic array elements Thank you. Your solution works! With this new method of writing if I have |