2020-11-19 19:38:38 +0200 | received badge | ● Famous Question (source) |

2017-07-06 05:06:47 +0200 | received badge | ● Notable Question (source) |

2017-02-11 04:10:04 +0200 | received badge | ● Famous Question (source) |

2016-06-03 09:10:22 +0200 | received badge | ● Popular Question (source) |

2016-02-06 04:46:45 +0200 | received badge | ● Notable Question (source) |

2016-02-02 10:31:31 +0200 | received badge | ● Nice Question (source) |

2015-06-08 21:15:36 +0200 | received badge | ● Notable Question (source) |

2015-01-11 14:41:38 +0200 | received badge | ● Popular Question (source) |

2014-06-29 06:56:37 +0200 | received badge | ● Notable Question (source) |

2014-06-29 06:56:37 +0200 | received badge | ● Popular Question (source) |

2014-06-29 06:56:37 +0200 | received badge | ● Famous Question (source) |

2013-11-09 14:50:54 +0200 | received badge | ● Popular Question (source) |

2013-03-24 00:08:40 +0200 | received badge | ● Taxonomist |

2012-09-07 01:29:13 +0200 | marked best answer | Extract terms from a sum Look at the |

2012-09-05 00:05:14 +0200 | asked a question | Extract terms from a sum Is there some way to programmatically extract the first, second, third, and so on terms from a sum of symbolic terms (or equivalently, turn such a sum into the list of its summands)? For example, after Is there some method you can call on F to extract A*B (or C)? This would be useful especially for displaying sage in LaTeX via sageTeX when a formula that is the sum of 4 terms (say) runs over the margin and has to be split up somehow. I would also be interested in a workaround in sageTeX that would allow you to flexibly insert a linebreak in a formula under the circumstances that the formula generated by Sage got too long for a line. |

2012-09-04 23:53:27 +0200 | commented answer | Some equations fail to solve even with to_poly_solve thanks, that works. |

2012-09-04 23:53:15 +0200 | marked best answer | Some equations fail to solve even with to_poly_solve Maybe sympy can be helpful? |

2012-09-03 01:02:34 +0200 | asked a question | Some equations fail to solve even with to_poly_solve In the following, I would expect to obtain But Sage doesn't want to solve the equation for z. Perhaps, in view of the fact that it solves the equation when 3 is in place of z, it doesn't realize that y is supposed to represent a real number. I tried Does anyone know a workaround? |

2012-06-16 20:21:32 +0200 | marked best answer | Substitution using Dictionary with Matrix as Value Symbolic expressions do not support working with Sage matrices. There are different approaches to do "linear algebra" in this context though. Indexed expressions This is GiNaC's solution. Our symbolics library pynac is based on GiNaC, so we just inherit this functionality. Although it hasn't been wrapped for easy use from Python. There is an experimental patch at #11576, but the GiNaC tutorial is the best reference. SymbolicMatrixAlgebra as Nicolas Thiery implemented in this thread.
Any help to get these things in a polished state so they can be included in Sage is welcome. |

2012-06-16 07:33:45 +0200 | received badge | ● Student (source) |

2012-06-15 01:15:33 +0200 | received badge | ● Supporter (source) |

2012-06-14 17:58:48 +0200 | asked a question | Substitution using Dictionary with Matrix as Value As a newcomer to SAGE, trying to use it to do symbolic linear algebra, I am wondering why substitution of a variable using a dictionary doesn't work in this case: but: Functionality to substitute matrices for variables seems to be indispensable to doing symbolic linear algebra, so I am sure there is a proper way to do this. |

2012-06-14 01:35:10 +0200 | commented answer | Variable assignment in list Thanks, DSM, I think the point you are making, if I may try to rephrase it, is that in SAGE, if you want to implement something close to (or the same as(?)) mathematical equality of a variable "A" with a more complicated expression "f(x)", you had better do it through a dictionary (which is the same as hashtable, right?). If you make the definition of "A" as "f(x)" with "=" instead of a dictionary, this just binds the local name "A" to "f(x)" and this this definition of "A" won't pass through to other expressions defined in terms of "A", such as the "expr" in your example. Anyway, I will try to work with dictionaries instead of "="'s for assignment and post other questions as they arise. |

2012-06-14 01:29:18 +0200 | marked best answer | Variable assignment in list Unlike many languages, Python doesn't really have variables: only objects and names. (And namespaces, I guess.) For example, doesn't declare a variable a and set it to the list [1,2]. We sometimes talk like this, because it's often close enough for government work, but it's not really accurate. What happens is that a list object is created and the name So in the case of a loop like this: a doesn't change because If you want to affect Note that you and so on. UPDATE: Here's an example of how we would handle things like this in Python via a dictionary, without dynamically creating local variables: Regarding the comments:
When the variables (or names) are kept in a dictionary I can do all sorts of nice things to them as a collection. Not so much if I rebind the local names to something else ... (more) |

2012-06-14 01:29:18 +0200 | received badge | ● Scholar (source) |

2012-06-13 00:38:15 +0200 | commented answer | Variable assignment in list If the program/function has n (the length of the list) as an integer parameter, so that there are n variables o have values assigned to them, and the expressions you want to assign also depend on n (so a previous part of the program produces both the list of assignee variables and assignment expressions), you can't hard code in the assignment. I'm afraid I don't understand what is meant by 'manually referring to variable names'. As opposed to what other methods of referring to them? Not trying to be tendentious, I am just too new to SAGE to understand what you mean here. A dictionary might work as a substitute for assignment, but I still prefer the variable to be assigned the values. |

2012-06-13 00:27:25 +0200 | commented answer | Variable assignment in list Thanks for your very clear and detailed answer. But I realized I wasn't unambiguous about what I wanted to do. I actually wanted to assign the value 'B' to every variable in the list, not change the contents of the list, which I am just using as a vehicle for doing the assignment. I have added a clarification in the original question above. |

2012-06-12 22:24:16 +0200 | edited question | Variable assignment in list This is a very basic question because I am a new user of SAGE with a background mostly in Java and C++. But in the following session: I am not sure why the value of the item in the list is printed as 'A' instead of 'B'. During the previous loop it seems like it assigned the value 'B' and printed out that the item was 'B. This may be an issue of the line 'item = B' returning a transient copy of the item, instead of a reference to the item. Can someone explain what is going on in programming language terms and tell me how to fix this so that the last line would print 'B'? EDIT: I should explain that what I want to do is not just change the items in the list, so I don't want to just make alist conatin the variable 'B'. I actually want to assign the value 'B' to the variable 'A', so that when I type 'A' into SAGE, the output is 'B'. This can be accomplished in this example with the one command: but the point is that if I have two lists - listVariables, e.g. [Y_1,...Y_n]
- listExpressions, e.g. [X^2, X^3, Z^4, ..., XZ]
of unknown length and contents, except that the two lists have the same number of elements, I want to assign the value contained in listExpressions[i] to the variable in listVariables[i] by looping over the lists. |

2012-06-12 22:24:16 +0200 | received badge | ● Editor (source) |

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.