From charlesr.harris at gmail.com Sun Nov 4 12:31:05 2018 From: charlesr.harris at gmail.com (Charles R Harris) Date: Sun, 4 Nov 2018 10:31:05 -0700 Subject: [SciPy-User] NumPy 1.15.4 release Message-ID: Hi All, On behalf of the NumPy team, I am pleased to announce the release of NumPy 1.15.4. This is a bugfix release for bugs and regressions reported following the 1.15.3 release. The most noticeable fix is probably having a boolean type fill value for masked arrays after the use of `==` and `!=`. The Python versions supported by this release are 2.7, 3.4-3.7. Wheels for this release can be downloaded from PyPI , source archives are available from Github . Compatibility Note ================== The NumPy 1.15.x OS X wheels released on PyPI no longer contain 32-bit binaries. That will also be the case in future releases. See `#11625 < https://github.com/numpy/numpy/issues/11625>`__ for the related discussion. Those needing 32-bit support should look elsewhere or build from source. Contributors ============ A total of 4 people contributed to this release. People with a "+" by their names contributed a patch for the first time. - Charles Harris - Matti Picus - Sebastian Berg - bbbbbbbbba + Pull requests merged ==================== A total of 4 pull requests were merged for this release. - `#12296 `__: BUG: Dealloc cached buffer info - `#12297 `__: BUG: Fix fill value in masked array '==' and '!=' ops. - `#12307 `__: DOC: Correct the default value of `optimize` in `numpy.einsum` - `#12320 `__: REL: Prepare for the NumPy 1.15.4 release Cheers, Charles Harris -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephen at missouri.edu Mon Nov 26 15:40:33 2018 From: stephen at missouri.edu (Montgomery-Smith, Stephen) Date: Mon, 26 Nov 2018 20:40:33 +0000 Subject: [SciPy-User] Problem using linprog Message-ID: I am trying to solve a linear programming problem.? The constraint is of the form A.x <= 0.? But linprog gives an answer that doesn't satisfy the constraint. The attached program gives A.x as [-2.32109228? 2.32017594? 4.71436317? 3.6433767? -4.26629574? 2.32384597 ?-1.96166184 -4.96206197] which definitely doesn't satisfy the constraint.? Is this a bug, or some subtle floating point error? Program follows (also as attachment): from scipy.optimize import linprog import numpy as np A = [[0.5919650431077654, -0.5271408402306996, 0.6096719792636803, 1.2379670854947114, 0.2656040423387233, -0.972363043155988], [-0.5914974900295467, -0.5266568950860249, 0.6105433925177587, 1.258297461476007, -0.285688537323182, 0.9726089241528251], [-0.593015674004932, 0.5280764198909397, 0.6078385518701857, -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], [0.5935986604093653, 0.5285277328950352, 0.6068764832493029, -1.1752312553140132, 0.19916734259906424, 0.976063912714949], [0.593015674004932, -0.5280764198909397, -0.6078385518701857, -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], [-0.5935986604093653, -0.5285277328950352, -0.6068764832493029, -1.1752312553140132, 0.19916734259906424, 0.976063912714949], [-0.5919650431077654, 0.5271408402306996, -0.6096719792636803, 1.2379670854947114, 0.2656040423387233, -0.972363043155988], [0.5914974900295467, 0.5266568950860249, -0.6105433925177587, 1.258297461476007, -0.285688537323182, 0.9726089241528251]] e = [0, 0, 0, 0, 0, -1] bounds = [(None, None), (None, None), (None, None), (None, None), (None, None), (0, 1)] b = [0]*len(A) result = linprog(e, A_ub = A, b_ub = b, bounds = bounds) print np.matmul(A, result.x) -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: text/x-python Size: 1274 bytes Desc: test.py URL: From chris.waigl at gmail.com Mon Nov 26 18:40:23 2018 From: chris.waigl at gmail.com (Chris F Waigl) Date: Mon, 26 Nov 2018 14:40:23 -0900 Subject: [SciPy-User] Problem using linprog In-Reply-To: References: Message-ID: Hi Stephen, The problem appears to be singular around the solution. A very quick exploration shows me that if you replace your upper bound b by a very small epsilon > 0, you get a stable result. For example: b = np.zeros(8) + 0.001 fun: -0.11764011575264395 message: 'Optimization terminated successfully.' nit: 6 slack: array([0. , 0. , 0.40742577, 0. , 0.40742577, 0. , 0. , 0. , 0.88235988]) status: 0 success: True x: array([0. , 0. , 0. , 0.0834722 , 0.41811509, 0.11764012]) And for print(np.dot(A, result.x)) I get [ 0.001 0.001 -0.00307426 0.001 -0.00307426 0.001 0.001 0.001 ] In the objective function, y_2 = y_4 = -3.0742577 * epsilon, and the other 6 values also converge towards zero when epsilon -> 0 . If I read your problem correctly, your objective function is simply (-1) times x_5, the last element of x. The approach above would converge towards the trivial solution, x = 0, but your solution above minimizes f(x) by maximizing x_5 at 1. If we pick out an x_5, then the problem collapses to a new problems to find [x_0 ... x_4] so that A[:, 0:7] * [x_0 ... x_4]' < b, where b is (-1) * the last column of your A. But the objective function is now indeterminate, so there is nothing to optimize. HTH, Chris On Mon, Nov 26, 2018 at 11:43 AM Montgomery-Smith, Stephen < stephen at missouri.edu> wrote: > I am trying to solve a linear programming problem. The constraint is of > the form A.x <= 0. But linprog gives an answer that doesn't satisfy the > constraint. > > The attached program gives A.x as > > [-2.32109228 2.32017594 4.71436317 3.6433767 -4.26629574 2.32384597 > -1.96166184 -4.96206197] > > which definitely doesn't satisfy the constraint. Is this a bug, or some > subtle floating point error? > > Program follows (also as attachment): > > from scipy.optimize import linprog > import numpy as np > > A = [[0.5919650431077654, -0.5271408402306996, 0.6096719792636803, > 1.2379670854947114, 0.2656040423387233, -0.972363043155988], > [-0.5914974900295467, -0.5266568950860249, 0.6105433925177587, > 1.258297461476007, -0.285688537323182, 0.9726089241528251], > [-0.593015674004932, 0.5280764198909397, 0.6078385518701857, > -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], > [0.5935986604093653, 0.5285277328950352, 0.6068764832493029, > -1.1752312553140132, 0.19916734259906424, 0.976063912714949], > [0.593015674004932, -0.5280764198909397, -0.6078385518701857, > -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], > [-0.5935986604093653, -0.5285277328950352, -0.6068764832493029, > -1.1752312553140132, 0.19916734259906424, 0.976063912714949], > [-0.5919650431077654, 0.5271408402306996, -0.6096719792636803, > 1.2379670854947114, 0.2656040423387233, -0.972363043155988], > [0.5914974900295467, 0.5266568950860249, -0.6105433925177587, > 1.258297461476007, -0.285688537323182, 0.9726089241528251]] > e = [0, 0, 0, 0, 0, -1] > bounds = [(None, None), (None, None), (None, None), (None, None), (None, > None), (0, 1)] > b = [0]*len(A) > result = linprog(e, A_ub = A, b_ub = b, bounds = bounds) > print np.matmul(A, result.x) > > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > -- Chris Waigl . chris.waigl at gmail.com . chris at lascribe.net http://eggcorns.lascribe.net . http://chryss.eu -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephen at missouri.edu Mon Nov 26 22:34:10 2018 From: stephen at missouri.edu (Montgomery-Smith, Stephen) Date: Tue, 27 Nov 2018 03:34:10 +0000 Subject: [SciPy-User] Problem using linprog In-Reply-To: References: Message-ID: Thank you. That helps a little. What is the definition of singular in this context? You definitely understood my problem. The correct answer should have been 0, as you correctly surmised. I am trying to find a test to see if a union of half planes captures all of Euclidean n-space. On 11/26/18 5:40 PM, Chris F Waigl wrote: > Hi Stephen, > > The problem appears to be singular around the solution. A very quick > exploration shows me that if you replace your upper bound b by a very > small epsilon > 0, you get a stable result.? > > For example:? > b = np.zeros(8) + 0.001 > > fun: -0.11764011575264395 > message: 'Optimization terminated successfully.' > nit: 6 > slack: array([0. , 0. , 0.40742577, 0. , 0.40742577, 0. , 0. , 0. , 0.88235988]) > status: 0 > success: True > x: array([0. , 0. , 0. , 0.0834722 , 0.41811509, 0.11764012]) > > And for print(np.dot(A, result.x)) I get [ 0.001 0.001 -0.00307426 0.001 > -0.00307426 0.001 0.001 0.001 ] > > In the objective function, y_2 = y_4 = -3.0742577 * epsilon, and the > other 6 values also converge towards zero when epsilon -> 0 .? > > If I read your problem correctly, your objective function is simply (-1) > times x_5, the last element of x. The approach above would converge > towards the trivial solution, x = 0, but your solution above minimizes > f(x) by maximizing x_5 at 1. If we pick out an x_5, then the problem > collapses to a new problems to find [x_0 ... x_4] so that A[:, 0:7] * > [x_0 ... x_4]' < b, where b is (-1) * the last column of your A. But the > objective function is now indeterminate, so there is nothing to optimize.?? > > HTH, > > Chris > > On Mon, Nov 26, 2018 at 11:43 AM Montgomery-Smith, Stephen > > wrote: > > I am trying to solve a linear programming problem.? The constraint is of > the form A.x <= 0.? But linprog gives an answer that doesn't satisfy the > constraint. > > The attached program gives A.x as > > [-2.32109228? 2.32017594? 4.71436317? 3.6433767? -4.26629574? 2.32384597 > ?-1.96166184 -4.96206197] > > which definitely doesn't satisfy the constraint.? Is this a bug, or some > subtle floating point error? > > Program follows (also as attachment): > > from scipy.optimize import linprog > import numpy as np > > A = [[0.5919650431077654, -0.5271408402306996, 0.6096719792636803, > 1.2379670854947114, 0.2656040423387233, -0.972363043155988], > [-0.5914974900295467, -0.5266568950860249, 0.6105433925177587, > 1.258297461476007, -0.285688537323182, 0.9726089241528251], > [-0.593015674004932, 0.5280764198909397, 0.6078385518701857, > -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], > [0.5935986604093653, 0.5285277328950352, 0.6068764832493029, > -1.1752312553140132, 0.19916734259906424, 0.976063912714949], > [0.593015674004932, -0.5280764198909397, -0.6078385518701857, > -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], > [-0.5935986604093653, -0.5285277328950352, -0.6068764832493029, > -1.1752312553140132, 0.19916734259906424, 0.976063912714949], > [-0.5919650431077654, 0.5271408402306996, -0.6096719792636803, > 1.2379670854947114, 0.2656040423387233, -0.972363043155988], > [0.5914974900295467, 0.5266568950860249, -0.6105433925177587, > 1.258297461476007, -0.285688537323182, 0.9726089241528251]] > e = [0, 0, 0, 0, 0, -1] > bounds = [(None, None), (None, None), (None, None), (None, None), (None, > None), (0, 1)] > b = [0]*len(A) > result = linprog(e, A_ub = A, b_ub = b, bounds = bounds) > print np.matmul(A, result.x) > > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > > > > -- > Chris Waigl . chris.waigl at gmail.com . > chris at lascribe.net > http://eggcorns.lascribe.net . http://chryss.eu > > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > From chris.waigl at gmail.com Wed Nov 28 15:48:47 2018 From: chris.waigl at gmail.com (Chris F Waigl) Date: Wed, 28 Nov 2018 11:48:47 -0900 Subject: [SciPy-User] Problem using linprog In-Reply-To: References: Message-ID: Hi Stephen, Sorry, I'm merely a user of numerical mathematics, and last time I studied the simplex algorithm was 25 years ago. What I do see is that your objective function depends only on x_5, the last element of the x vector, and that you are trying to maximise x_5, but constrain it to the interval [0, 1] where a) the expected maximum is the lower bound of your interval and b) something weird is going on around x_5 = 1, where I guess the simplex algorithm breaks down. If you relax the bound, say from -0.5 to 1.5, the algorithm finds your expected result easily. Chris On Mon, Nov 26, 2018 at 6:36 PM Montgomery-Smith, Stephen < stephen at missouri.edu> wrote: > Thank you. That helps a little. What is the definition of singular in > this context? > > You definitely understood my problem. The correct answer should have > been 0, as you correctly surmised. > > I am trying to find a test to see if a union of half planes captures all > of Euclidean n-space. > > On 11/26/18 5:40 PM, Chris F Waigl wrote: > > Hi Stephen, > > > > The problem appears to be singular around the solution. A very quick > > exploration shows me that if you replace your upper bound b by a very > > small epsilon > 0, you get a stable result. > > > > For example: > > b = np.zeros(8) + 0.001 > > > > fun: -0.11764011575264395 > > message: 'Optimization terminated successfully.' > > nit: 6 > > slack: array([0. , 0. , 0.40742577, 0. , > 0.40742577, 0. , 0. , 0. , 0.88235988]) > > status: 0 > > success: True > > x: array([0. , 0. , 0. , 0.0834722 , 0.41811509, > 0.11764012]) > > > > And for print(np.dot(A, result.x)) I get [ 0.001 0.001 -0.00307426 0.001 > > -0.00307426 0.001 0.001 0.001 ] > > > > In the objective function, y_2 = y_4 = -3.0742577 * epsilon, and the > > other 6 values also converge towards zero when epsilon -> 0 . > > > > If I read your problem correctly, your objective function is simply (-1) > > times x_5, the last element of x. The approach above would converge > > towards the trivial solution, x = 0, but your solution above minimizes > > f(x) by maximizing x_5 at 1. If we pick out an x_5, then the problem > > collapses to a new problems to find [x_0 ... x_4] so that A[:, 0:7] * > > [x_0 ... x_4]' < b, where b is (-1) * the last column of your A. But the > > objective function is now indeterminate, so there is nothing to > optimize. > > > > HTH, > > > > Chris > > > > On Mon, Nov 26, 2018 at 11:43 AM Montgomery-Smith, Stephen > > > wrote: > > > > I am trying to solve a linear programming problem. The constraint > is of > > the form A.x <= 0. But linprog gives an answer that doesn't satisfy > the > > constraint. > > > > The attached program gives A.x as > > > > [-2.32109228 2.32017594 4.71436317 3.6433767 -4.26629574 > 2.32384597 > > -1.96166184 -4.96206197] > > > > which definitely doesn't satisfy the constraint. Is this a bug, or > some > > subtle floating point error? > > > > Program follows (also as attachment): > > > > from scipy.optimize import linprog > > import numpy as np > > > > A = [[0.5919650431077654, -0.5271408402306996, 0.6096719792636803, > > 1.2379670854947114, 0.2656040423387233, -0.972363043155988], > > [-0.5914974900295467, -0.5266568950860249, 0.6105433925177587, > > 1.258297461476007, -0.285688537323182, 0.9726089241528251], > > [-0.593015674004932, 0.5280764198909397, 0.6078385518701857, > > -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], > > [0.5935986604093653, 0.5285277328950352, 0.6068764832493029, > > -1.1752312553140132, 0.19916734259906424, 0.976063912714949], > > [0.593015674004932, -0.5280764198909397, -0.6078385518701857, > > -1.1964319796886902, -0.2223431679788034, -0.9740888117098865], > > [-0.5935986604093653, -0.5285277328950352, -0.6068764832493029, > > -1.1752312553140132, 0.19916734259906424, 0.976063912714949], > > [-0.5919650431077654, 0.5271408402306996, -0.6096719792636803, > > 1.2379670854947114, 0.2656040423387233, -0.972363043155988], > > [0.5914974900295467, 0.5266568950860249, -0.6105433925177587, > > 1.258297461476007, -0.285688537323182, 0.9726089241528251]] > > e = [0, 0, 0, 0, 0, -1] > > bounds = [(None, None), (None, None), (None, None), (None, None), > (None, > > None), (0, 1)] > > b = [0]*len(A) > > result = linprog(e, A_ub = A, b_ub = b, bounds = bounds) > > print np.matmul(A, result.x) > > > > _______________________________________________ > > SciPy-User mailing list > > SciPy-User at python.org > > https://mail.python.org/mailman/listinfo/scipy-user > > > > > > > > -- > > Chris Waigl . chris.waigl at gmail.com . > > chris at lascribe.net > > http://eggcorns.lascribe.net . http://chryss.eu > > > > _______________________________________________ > > SciPy-User mailing list > > SciPy-User at python.org > > https://mail.python.org/mailman/listinfo/scipy-user > > > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > -- Chris Waigl . chris.waigl at gmail.com . chris at lascribe.net http://eggcorns.lascribe.net . http://chryss.eu -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralf.gommers at gmail.com Thu Nov 29 23:42:05 2018 From: ralf.gommers at gmail.com (Ralf Gommers) Date: Thu, 29 Nov 2018 20:42:05 -0800 Subject: [SciPy-User] webinar and roadmap discussion Message-ID: Hi all, Here's two things that may be of interest. SciPy will be featured on an upcoming episode of Open Source Directions hosted by Quansight on Friday November 30th (tomorrow) at 9am Pacific time / noon Eastern time. See [1] for registration link. We're updating the SciPy roadmap in https://github.com/scipy/scipy/pull/9537. A first version of a "roadmap brochure" is now available at [2] - it's mainly aimed at people who want to contribute to SciPy (either financially or with development resources); contents match what is in gh-9537. An up to date version will be maintained at [3]. Cheers, Ralf [1] https://app.livestorm.co/quansight/ [2] https://docs.wixstatic.com/ugd/cccccf_0061fb73823343048c01a4a8f2c34dfd.pdf [3] https://www.quansight.com/projects -------------- next part -------------- An HTML attachment was scrubbed... URL: From bk_boukraa at esi.dz Fri Nov 30 03:24:42 2018 From: bk_boukraa at esi.dz (BOUKRAA, Kacem) Date: Fri, 30 Nov 2018 09:24:42 +0100 Subject: [SciPy-User] Is there an equivalant for Griddata in Obj-c or Java? Message-ID: Hello pals! I really need your help! So i have a set of data for example: X Y Z 1 3 7 2 5 8 1 4 9 3 6 10 I would like to interpolate Z for X=2.5 and Y=3.5. I know i can use interp2.griddata from Scipy in Python or ScatteredInterpolant in Matlab like this: z = griddata( [1 2 1 3], [3 5 4 6], [7 8 9 10], 2.5, 3.5, 'nearest' ) or S = scatteredInterpolant(x,y,z,d); My question Is if there is a way i could use in Swift/Objective-c or Android Java or any other compatible language to be able to do the same thing on iOS or Android platforms? Thanks in advance. -- [image: Image] *Kacem BOUKRAA**Computer Science Engineer (ESI Ex ini)* -------------- next part -------------- An HTML attachment was scrubbed... URL: From joanqc at gmail.com Fri Nov 30 04:16:31 2018 From: joanqc at gmail.com (Joan Quintana) Date: Fri, 30 Nov 2018 10:16:31 +0100 Subject: [SciPy-User] Need some advice on integration Message-ID: I'm new on scipy (and new with numerical methods), so excuse me if you found trivial my question, but I spent time searching for an answer. Well, the problem: I want to integrate this equation: dv = [K/(m-dm)] dm where where d means differential (of course). dm is in the numerator and denominator. -Is there chance to solve this integral analytically? -how can I use scipy to integrate this equation (knowh the initial values)? TIA -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Fri Nov 30 09:44:32 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Fri, 30 Nov 2018 08:44:32 -0600 Subject: [SciPy-User] Need some advice on integration In-Reply-To: References: Message-ID: This is better suited for sympy than scipy: https://docs.sympy.org/latest/modules/integrals/integrals.html On Fri, Nov 30, 2018 at 3:17 AM Joan Quintana wrote: > I'm new on scipy (and new with numerical methods), so excuse me if you > found trivial my question, but I spent time searching for an answer. Well, > the problem: > > I want to integrate this equation: > > dv = [K/(m-dm)] dm > > where where d means differential (of course). dm is in the numerator and > denominator. > > -Is there chance to solve this integral analytically? > -how can I use scipy to integrate this equation (knowh the initial values)? > > TIA > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From guziy.sasha at gmail.com Fri Nov 30 10:39:16 2018 From: guziy.sasha at gmail.com (Oleksandr Huziy) Date: Fri, 30 Nov 2018 15:39:16 +0000 Subject: [SciPy-User] Need some advice on integration In-Reply-To: References: Message-ID: That does not look like a valid integral expression... dm should never be in a denominator.... Cheers Le ven. 30 nov. 2018 ? 14:44, Denis Akhiyarov a ?crit : > This is better suited for sympy than scipy: > > https://docs.sympy.org/latest/modules/integrals/integrals.html > > On Fri, Nov 30, 2018 at 3:17 AM Joan Quintana wrote: > >> I'm new on scipy (and new with numerical methods), so excuse me if you >> found trivial my question, but I spent time searching for an answer. Well, >> the problem: >> >> I want to integrate this equation: >> >> dv = [K/(m-dm)] dm >> >> where where d means differential (of course). dm is in the numerator and >> denominator. >> >> -Is there chance to solve this integral analytically? >> -how can I use scipy to integrate this equation (knowh the initial >> values)? >> >> TIA >> _______________________________________________ >> SciPy-User mailing list >> SciPy-User at python.org >> https://mail.python.org/mailman/listinfo/scipy-user >> > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > -- Sasha -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephen at missouri.edu Fri Nov 30 13:12:43 2018 From: stephen at missouri.edu (Montgomery-Smith, Stephen) Date: Fri, 30 Nov 2018 18:12:43 +0000 Subject: [SciPy-User] Need some advice on integration In-Reply-To: References: , Message-ID: <0f932c53147a4a63b7ca05b07bc77541@missouri.edu> I don't understand what your equation means. You can't have an expression like m - dm, that is, you can't additively combine scalars with differentials. They exist in different spaces. Maybe you mean: dv = [K/(m - (dm/dv))] dm ? Then rewrite it as (dv/dm) [m - (dm/dv)] = K m(dv/dm) - 1 = K dv/dm = (K+1)/m v = -(K+1)/(m**2) + constant But I am guessing your intentions, and I might be missing something. ________________________________________ On Fri, Nov 30, 2018 at 3:17 AM Joan Quintana > wrote: I'm new on scipy (and new with numerical methods), so excuse me if you found trivial my question, but I spent time searching for an answer. Well, the problem: I want to integrate this equation: dv = [K/(m-dm)] dm where where d means differential (of course). dm is in the numerator and denominator. -Is there chance to solve this integral analytically? -how can I use scipy to integrate this equation (knowh the initial values)? TIA _______________________________________________ SciPy-User mailing list SciPy-User at python.org https://mail.python.org/mailman/listinfo/scipy-user