Re: numpy (matrix solver) - python vs. matlab

2012-05-04 Thread someone
On 05/04/2012 05:52 AM, Steven D'Aprano wrote: On Thu, 03 May 2012 19:30:35 +0200, someone wrote: So how do you explain that the natural frequencies from FEM (with condition number ~1e6) generally correlates really good with real measurements (within approx. 5%), at least for the first 3-4

Re: numpy (matrix solver) - python vs. matlab

2012-05-04 Thread someone
On 05/04/2012 06:15 AM, Russ P. wrote: On May 3, 4:59 pm, someonenewsbo...@gmail.com wrote: On 05/04/2012 12:58 AM, Russ P. wrote: Ok, but I just don't understand what's in the empirical category, sorry... I didn't look it up, but as far as I know, empirical just means based on experiment,

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread someone
On 05/02/2012 11:45 PM, Russ P. wrote: On May 2, 1:29 pm, someonenewsbo...@gmail.com wrote: If your data starts off with only 1 or 2 digits of accuracy, as in your example, then the result is meaningless -- the accuracy will be 2-2 digits, or 0 -- *no* digits in the answer can be trusted to

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread Russ P.
On May 3, 10:30 am, someone newsbo...@gmail.com wrote: On 05/02/2012 11:45 PM, Russ P. wrote: On May 2, 1:29 pm, someonenewsbo...@gmail.com  wrote: If your data starts off with only 1 or 2 digits of accuracy, as in your example, then the result is meaningless -- the accuracy will be 2-2

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread someone
On 05/03/2012 07:55 PM, Russ P. wrote: On May 3, 10:30 am, someonenewsbo...@gmail.com wrote: On 05/02/2012 11:45 PM, Russ P. wrote: For any practical engineering or scientific work, I'd say that a condition number of 1e6 is very likely to be completely unacceptable. So how do you explain

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread Russ P.
Yeah, I realized that I should rephrase my previous statement to something like this: For any *empirical* engineering or scientific work, I'd say that a condition number of 1e6 is likely to be unacceptable. I'd put finite elements into the category of theoretical and numerical rather than

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread someone
On 05/04/2012 12:58 AM, Russ P. wrote: Yeah, I realized that I should rephrase my previous statement to something like this: For any *empirical* engineering or scientific work, I'd say that a condition number of 1e6 is likely to be unacceptable. Still, I don't understand it. Do you have an

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread Steven D'Aprano
On Thu, 03 May 2012 19:30:35 +0200, someone wrote: On 05/02/2012 11:45 PM, Russ P. wrote: On May 2, 1:29 pm, someonenewsbo...@gmail.com wrote: If your data starts off with only 1 or 2 digits of accuracy, as in your example, then the result is meaningless -- the accuracy will be 2-2 digits,

Re: numpy (matrix solver) - python vs. matlab

2012-05-03 Thread Russ P.
On May 3, 4:59 pm, someone newsbo...@gmail.com wrote: On 05/04/2012 12:58 AM, Russ P. wrote: Yeah, I realized that I should rephrase my previous statement to something like this: For any *empirical* engineering or scientific work, I'd say that a condition number of 1e6 is likely to be

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread someone
On 05/02/2012 01:05 AM, Paul Rubin wrote: someonenewsbo...@gmail.com writes: Actually I know some... I just didn't think so much about, before writing the question this as I should, I know theres also something like singular value decomposition that I think can help solve otherwise illposed

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread someone
On 05/02/2012 01:38 AM, Russ P. wrote: On May 1, 4:05 pm, Paul Rubinno.em...@nospam.invalid wrote: someonenewsbo...@gmail.com writes: Actually I know some... I just didn't think so much about, before writing the question this as I should, I know theres also something like singular value

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Russ P.
On May 1, 11:03 pm, someone newsbo...@gmail.com wrote: On 05/02/2012 01:38 AM, Russ P. wrote: On May 1, 4:05 pm, Paul Rubinno.em...@nospam.invalid  wrote: someonenewsbo...@gmail.com  writes: Actually I know some... I just didn't think so much about, before writing the question

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Jussi Piitulainen
someone writes: except it would be nice to learn some things for future use (for instance understanding SVD more - perhaps someone geometrically can explain SVD, that'll be really nice, I hope)... The Wikipedia article looks promising to me:

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Paul Rubin
Russ P. russ.paie...@gmail.com writes: The SVD can be thought of as factoring any linear transformation into a rotation, then a scaling, followed by another rotation. Ah yes, my description was backwards, sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Paul Rubin
someone newsbo...@gmail.com writes: You will probably get better advice if you are able to describe what problem (ill-posed or otherwise) you are actually trying to solve. SVD I don't understand what else I should write. I gave the singular matrix and that's it. Nothing more is to say about

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Kiuhnm
On 5/2/2012 8:00, someone wrote: Still, I dont think I completely understand SVD. SVD (at least in Matlab) returns 3 matrices, one is a diagonal matrix I think. I think I would better understand it with geometric examples, if one would be so kind to maybe write something about that... I can plot

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Steven D'Aprano
On Wed, 02 May 2012 08:00:44 +0200, someone wrote: On 05/02/2012 01:05 AM, Paul Rubin wrote: someonenewsbo...@gmail.com writes: Actually I know some... I just didn't think so much about, before writing the question this as I should, I know theres also something like singular value

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Steven_Lord
Russ P. russ.paie...@gmail.com wrote in message news:2275231f-405f-4ee3-966a-40c821b7c...@2g2000yqp.googlegroups.com... On May 1, 11:52 am, someone newsbo...@gmail.com wrote: On 04/30/2012 03:35 AM, Nasser M. Abbasi wrote: On 04/29/2012 07:59 PM, someone wrote: I do not use python much

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread someone
On 05/02/2012 01:03 PM, Kiuhnm wrote: On 5/2/2012 8:00, someone wrote: Still, I dont think I completely understand SVD. SVD (at least in Matlab) returns 3 matrices, one is a diagonal matrix I think. I think I would better understand it with geometric examples, if one would be so kind to maybe

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread someone
On 05/02/2012 08:36 AM, Russ P. wrote: On May 1, 11:03 pm, someonenewsbo...@gmail.com wrote: On 05/02/2012 01:38 AM, Russ P. wrote: .. On May 1, 4:05 pm, Paul Rubinno.em...@nospam.invalidwrote: It would really appreciate if anyone could maybe post a simple SVD example and tell what the

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread someone
On 05/02/2012 01:52 PM, Steven D'Aprano wrote: On Wed, 02 May 2012 08:00:44 +0200, someone wrote: On 05/02/2012 01:05 AM, Paul Rubin wrote: someonenewsbo...@gmail.com writes: Actually I know some... I just didn't think so much about, before writing the question this as I should, I know

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread someone
On 05/02/2012 04:47 PM, Steven_Lord wrote: Russ, you and the OP (and others) may be interested in one of the books that Cleve Moler has written and made freely available on the MathWorks website: http://www.mathworks.com/moler/ The chapter Linear Equations in Numerical Computing with MATLAB

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Russ P.
On May 2, 1:29 pm, someone newsbo...@gmail.com wrote: If your data starts off with only 1 or 2 digits of accuracy, as in your example, then the result is meaningless -- the accuracy will be 2-2 digits, or 0 -- *no* digits in the answer can be trusted to be accurate. I just solved a FEM

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Russ P.
On Apr 29, 5:17 pm, someone newsbo...@gmail.com wrote: On 04/30/2012 12:39 AM, Kiuhnm wrote: So Matlab at least warns about Matrix is close to singular or badly scaled, which python (and I guess most other languages) does not... A is not just close to singular: it's singular! Ok. When

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Eelco
There is linalg.pinv, which computes a pseudoinverse based on SVD that works on all matrices, regardless of the rank of the matrix. It merely approximates A*A.I = I as well as A permits though, rather than being a true inverse, which may not exist. Anyway, there are no general answers for this

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread someone
On 04/30/2012 02:57 AM, Paul Rubin wrote: someonenewsbo...@gmail.com writes: A is not just close to singular: it's singular! Ok. When do you define it to be singular, btw? Singular means the determinant is zero, i.e. the rows or columns are not linearly independent. Let's give names to the

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread someone
On 05/01/2012 08:56 AM, Russ P. wrote: On Apr 29, 5:17 pm, someonenewsbo...@gmail.com wrote: On 04/30/2012 12:39 AM, Kiuhnm wrote: You should try to avoid matrix inversion altogether if that's the case. For instance you shouldn't invert a matrix just to solve a linear system. What then?

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread someone
On 04/30/2012 03:35 AM, Nasser M. Abbasi wrote: On 04/29/2012 07:59 PM, someone wrote: I do not use python much myself, but a quick google showed that pyhton scipy has API for linalg, so use, which is from the documentation, the following code example X = scipy.linalg.solve(A, B) But you still

RE: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Prasad, Ramit
I'm making my first steps now with numpy, so there's a lot I don't know and haven't tried with numpy... An excellent reason to subscribe to the numpy mailing list and talk on there :) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Colin J. Williams
On 01/05/2012 2:43 PM, someone wrote: [snip] a = [1 2 3]; b = [11 12 13]; c = [21 22 23]. Then notice that c = 2*b - a. So c is linearly dependent on a and b. Geometrically this means the three vectors are in the same plane, so the matrix doesn't have an inverse. Does it not mean that there

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Russ P.
On May 1, 11:52 am, someone newsbo...@gmail.com wrote: On 04/30/2012 03:35 AM, Nasser M. Abbasi wrote: On 04/29/2012 07:59 PM, someone wrote: I do not use python much myself, but a quick google showed that pyhton scipy has API for linalg, so use, which is from the documentation, the

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread someone
On 05/01/2012 09:59 PM, Colin J. Williams wrote: On 01/05/2012 2:43 PM, someone wrote: [snip] a = [1 2 3]; b = [11 12 13]; c = [21 22 23]. Then notice that c = 2*b - a. So c is linearly dependent on a and b. Geometrically this means the three vectors are in the same plane, so the matrix

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread someone
On 05/01/2012 10:54 PM, Russ P. wrote: On May 1, 11:52 am, someonenewsbo...@gmail.com wrote: On 04/30/2012 03:35 AM, Nasser M. Abbasi wrote: What's the limit in matlab (on the condition number of the matrices), by the way, before it comes up with a warning ??? The threshold of

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Robert Kern
On 5/1/12 10:21 PM, someone wrote: On 05/01/2012 10:54 PM, Russ P. wrote: On May 1, 11:52 am, someonenewsbo...@gmail.com wrote: On 04/30/2012 03:35 AM, Nasser M. Abbasi wrote: What's the limit in matlab (on the condition number of the matrices), by the way, before it comes up with a warning

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Kiuhnm
On 5/1/2012 21:59, Colin J. Williams wrote: On 01/05/2012 2:43 PM, someone wrote: [snip] a = [1 2 3]; b = [11 12 13]; c = [21 22 23]. Then notice that c = 2*b - a. So c is linearly dependent on a and b. Geometrically this means the three vectors are in the same plane, so the matrix doesn't

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Paul Rubin
someone newsbo...@gmail.com writes: Actually I know some... I just didn't think so much about, before writing the question this as I should, I know theres also something like singular value decomposition that I think can help solve otherwise illposed problems, You will probably get better

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Russ P.
On May 1, 4:05 pm, Paul Rubin no.em...@nospam.invalid wrote: someone newsbo...@gmail.com writes: Actually I know some... I just didn't think so much about, before writing the question this as I should, I know theres also something like singular value decomposition that I think can help

Re: numpy (matrix solver) - python vs. matlab

2012-04-30 Thread Kiuhnm
On 4/30/2012 2:17, someone wrote: On 04/30/2012 12:39 AM, Kiuhnm wrote: So Matlab at least warns about Matrix is close to singular or badly scaled, which python (and I guess most other languages) does not... A is not just close to singular: it's singular! Ok. When do you define it to be

Re: numpy (matrix solver) - python vs. matlab

2012-04-30 Thread Kiuhnm
On 4/30/2012 3:35, Nasser M. Abbasi wrote: But you still need to check the cond(). If it is too large, not good. How large and all that, depends on the problem itself. But the rule of thumb, the lower the better. Less than 100 can be good in general, but I really can't give you a fixed number to

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Kiuhnm
On 4/30/2012 0:17, someone wrote: Hi, Notice cross-post, I hope you bear over with me for doing that (and I imagine that some of you also like python in the matlab-group like myself)... -- Python vs. Matlab: --

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread someone
On 04/30/2012 12:39 AM, Kiuhnm wrote: So Matlab at least warns about Matrix is close to singular or badly scaled, which python (and I guess most other languages) does not... A is not just close to singular: it's singular! Ok. When do you define it to be singular, btw? Which is the most

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Nasser M. Abbasi
On 04/29/2012 05:17 PM, someone wrote: I would also kindly ask about how to avoid this problem in the future, I mean, this maybe means that I have to check the condition number at all times before doing anything at all ? How to do that? I hope you'll check the condition number all the time.

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Paul Rubin
someone newsbo...@gmail.com writes: A is not just close to singular: it's singular! Ok. When do you define it to be singular, btw? Singular means the determinant is zero, i.e. the rows or columns are not linearly independent. Let's give names to the three rows: a = [1 2 3]; b = [11 12 13];

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread someone
On 04/30/2012 02:38 AM, Nasser M. Abbasi wrote: On 04/29/2012 05:17 PM, someone wrote: I would also kindly ask about how to avoid this problem in the future, I mean, this maybe means that I have to check the condition number at all times before doing anything at all ? How to do that? I hope

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Nasser M. Abbasi
On 04/29/2012 07:59 PM, someone wrote: Also, as was said, do not use INV(A) directly to solve equations. In Matlab I used x=A\b. good. I used inv(A) in python. Should I use some kind of pseudo-inverse or what do you suggest? I do not use python much myself, but a quick google showed

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Nasser M. Abbasi
On 04/29/2012 07:17 PM, someone wrote: Ok. When do you define it to be singular, btw? There are things you can see right away about a matrix A being singular without doing any computation. By just looking at it. For example, If you see a column (or row) being a linear combination of