On Dec 3, 2011, at 02:50 , Chappman wrote: > Is it possible to make an entry in Q[i,j] equal to a entry in U[i,j]? > I have to have the two functions separately for each matrix though > just like my code above
Definitely. You can do it roughly as your code snippets show, or there are built-in "short-cuts" depending on what you want to do. Here are a few: Q=deepcopy(U) # This copies everything Note that 1. if you use this inside a procedure, you have to import the name: from copy import deepcopy 2. if you use copy instead of deepcopy, you don't get what you might expect. Try this: Q=matrix(ZZ,6) U=Q U[1,1]=4 Q The reason is that more complex data types are copied by "pointer" (for speed); the "deepcopy" procedure actually makes a full copy, while "copy" just copies structure pointers, while the data values are "shared" between the copies. To find out more about using Sage as a program/scripting language, check out the documentation on <http://sagemath.org> and <http://www.python.org>. Python is the language used by Sage. Also, use expressions like "matrix?" to get on-line documentation on procedure/function/variable names; "??" gets both documentation and the code implementing the call (if possible; some built-in python things may not have code viewable). Finally, the TAB after a string will try to show you known names that begin with the string. If you type the full name of a class, followed by ".", and then TAB, you will get a list of associated "method", "class variable", and "instance variable" names. You can then use the "?" to find out more. HTH Justin -- Justin C. Walker, Curmudgeon at Large Institute for the Absorption of Federal Funds ----------- My wife 'n kids 'n dogs are gone, I can't get Jesus on the phone, But Ol' Milwaukee's Best is my best friend. ----------- -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org