Re: [Numpy-discussion] Calculating tan inverse
There is arctan function in numpy, and in math (atan, atan2) Nadav. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of amit soni Sent: Wednesday, November 08, 2006 19:36 To: numpy-discussion@lists.sourceforge.net Subject: [Numpy-discussion] Calculating tan inverse how can I calculate arctan of a number in python? thanks Amit Sponsored Link Mortgage rates near 39yr lows. $420,000 Mortgage for $1,399/mo - Calculate new house payment - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] matrix multiplication (newbie question)
Make A,B,… matrices instead of arrays, so instead A = array((…..)) Write A = matrix((….)) Assuming you had From numpy import * Nadav From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of izak marais Sent: Wednesday, November 08, 2006 15:54 To: numpy-discussion@lists.sourceforge.net Subject: [Numpy-discussion] matrix multiplication (newbie question) Hi Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as does the 'multiply' ufunc. All I could find was the numeric function 'matrix_multiply, but this only takes two arguments. Thanks in advance! Izak Sponsored Link Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate - Click now to apply - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Model and experiment fitting.
1. If at least one of your data sets to be interpulated is on a grid, you can use numpy.ndimage.map function for fast interpolation for 2d (in fact for any dimensional) dataset. 2. Isn't there an analytic expression to average the expectration values of SH over all possible orientations between B and the crystal axis? My experience shows that some analytic work can save 99% of simulation time. Nadav -Original Message- From: [EMAIL PROTECTED] on behalf of Sebastian Zurek Sent: Sat 21-Oct-06 15:41 To: numpy-discussion@lists.sourceforge.net Cc: Subject:Re: [Numpy-discussion] Model and experiment fitting. Robert Kern napisal(a): > Your description is a bit vague. Possibly by my weak English... I'll try to make myself clearer now. Do you mean that you have some model function f > that maps X values to Y values? > >f(x) -> y > My model is quantum energy operator - spin hamiltonian (SH) with some additional assumption about so called 'line shape', 'line widths',etc. It describes various electron interactions, visible in electron paramagnetic resonance (EPR, ESR) experiment. The simplest SH can be written in a form: H = m B g S (1) where m is a constant (bohr magneton), B is magnetic field (my x-variable), g is so called 'zeeman matrix' and S is total spin angular momentum operator. Summing it all together: the simple model is parametrized by: - line shape, - line width, - zeeman matrix (3x3 diagonal matrix - the spatial dependence), - total spin S. After SH (1) diagonalization one can obtain so called 'resonance fields' and 'resonance intensities'. After a convolution with appropriate line shape function which is parametrized by the line width one can finally get the simulated EPR spectrum (simDat=[[X1,...,Xn],[Y1,...,Yn]]). This is a roughly, schematic description, appropriate to EPR spectra of monocrystals. In my situation the problem is more sophisticated - I have polycrystaline (powders) data, and to obtain a simulated EPR powder spectrum I need to sum up the EPR spectra of monocrystals that come from many possible spatial orientations, and the resultant spectrum is an envelope of all the monocrystals spectra. There's no simple model function that maps X -> Y. > If that is the case, is there some reason that you cannot run your simulation > using the same X points as your experimental data? > I can only demand a X range and number of X values within the range, there's no possibility to find the Y(X) for a specified X. These limitations on one hand come from the external program I'm using to simulate the EPR spectra, on the other are a result of spatial averaging of EPR data for powders, where a lot of interpolations are involved. > OTOH, is there some other independent variable (say Z) that *is* common > between > your experimental and simulated data? > >f(z) -> (x, y) > This is probably the situation I'm in. These other variables are my model parameters, namely: line shape-width, zeeman matrix... and they're commen between the experiment and the simulation. To make it clear. I've already solved the problem by a simple linear interpolation of simulated points within the narrow neighborhood of experimental data point. The simulation points are uniformly distributed along the X-range, with a density I'm able to tune. It all works quite well but I'm founding it as a 'brute-force' method and I wonder, if there's any more sophisticated and maybe already incorporated into any Python module method? Anyway, it looks like it's impossible to compare two discrete 2D data sets without any interpolations included... :] A. M. Archibald has proposed spline fitting, which I'll try. I'll also look at the Numerical Recipes discussion he has proposed. Sebastian - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion <>- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] tensor product
There is a "tensortdot" function in numpy1.0rc1 Nadav -Original Message- From: [EMAIL PROTECTED] on behalf of Charles R Harris Sent: Sun 08-Oct-06 06:54 To: numpy-discussion@lists.sourceforge.net Cc: Subject:[Numpy-discussion] tensor product Hmmm, I notice that there is no longer a tensor product. As it was the only one of the outer, kron bunch that I really wanted, l miss it. In fact, I always thought outer should act like the tensor product for the other binary operators too. Anyway, mind if I put it back? Chuck <>- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] tensor dot ?
I once wrote a function "tensormultiply" which is a part of numarray (undocumented). You can borrow it from there. Nadav -Original Message- From: [EMAIL PROTECTED] on behalf of Simon Burton Sent: Fri 25-Aug-06 14:42 To: numpy-discussion@lists.sourceforge.net Cc: Subject:[Numpy-discussion] tensor dot ? >>> numpy.dot.__doc__ matrixproduct(a,b) Returns the dot product of a and b for arrays of floating point types. Like the generic numpy equivalent the product sum is over the last dimension of a and the second-to-last dimension of b. NB: The first argument is not conjugated. Does numpy support summing over arbitrary dimensions, as in tensor calculus ? I could cook up something that uses transpose and dot, but it's reasonably tricky i think :) Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Converting a list
Do you mean: >> map(shape, data) -Original Message- From: [EMAIL PROTECTED] on behalf of Nils Wagner Sent: Mon 10-Jul-06 12:26 To: numpy-discussion@lists.sourceforge.net Cc: Subject:[Numpy-discussion] Converting a list Hi all, I have a list consisting of arrays of different size data = [array([-1.+0.j, -1.+0.j, -1.6667+0.j]), array([-2.+0.j, -2.-0.6667j, -2.-1.j]), array([-2.-2.j, -1.-2.j, -0.6667-2.j]), array([ 0.-2.j, 0.-1.6667j, 0.-1.j]), array([ 6.12323400e-17-1.j, -2.58819045e-01-0.96592583j, -5.e-01-0.8660254j , -7.07106781e-01-0.70710678j, -8.66025404e-01-0.5j , -9.65925826e-01-0.25881905j])] type(data) = shape(data) results in shape(data) = Traceback (most recent call last): File "sinai.py", line 107, in ? p = polygon(P) File "sinai.py", line 67, in polygon print 'shape(data) = ',shape(data) File "/usr/lib64/python2.4/site-packages/numpy/core/fromnumeric.py", line 258, in shape result = asarray(a).shape File "/usr/lib64/python2.4/site-packages/numpy/core/numeric.py", line 119, in asarray return array(a, dtype, copy=False, order=order) TypeError: a float is required Is this a bug ? Nils - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] Fortran 95 compiler (from gcc 4.1.1) is not recognized by scipy
I recently upgraded to gcc4.1.1. When I tried to compile scipy from today's svn repository it halts with the following message: Traceback (most recent call last): File "setup.py", line 50, in ? setup_package() File "setup.py", line 42, in setup_package configuration=configuration ) File "/usr/lib/python2.4/site-packages/numpy/distutils/core.py", line 170, in setup return old_setup(**new_attr) File "/usr/lib/python2.4/distutils/core.py", line 149, in setup dist.run_commands() File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands self.run_command(cmd) File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command cmd_obj.run() File "/usr/lib/python2.4/distutils/command/build.py", line 112, in run self.run_command(cmd_name) File "/usr/lib/python2.4/distutils/cmd.py", line 333, in run_command self.distribution.run_command(command) File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command cmd_obj.run() File "/usr/lib/python2.4/site-packages/numpy/distutils/command/build_ext.py", line 109, in run self.build_extensions() File "/usr/lib/python2.4/distutils/command/build_ext.py", line 405, in build_e xtensions self.build_extension(ext) File "/usr/lib/python2.4/site-packages/numpy/distutils/command/build_ext.py", line 301, in build_extension link = self.fcompiler.link_shared_object AttributeError: 'NoneType' object has no attribute 'link_shared_object' The output of gfortran --version: GNU Fortran 95 (GCC) 4.1.1 (Gentoo 4.1.1) Copyright (C) 2006 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING I have also the old g77 compiler installed (g77-3.4.6). Is there a way to force numpy/scipy to use it? Nadav --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion