Re: [sympy] Linear Inequality Simplifier

2021-02-18 Thread Oscar Gustafsson
Den tors 18 feb. 2021 kl 14:36 skrev Oscar Benjamin < oscar.j.benja...@gmail.com>: > On Thu, 18 Feb 2021 at 11:32, Oscar Gustafsson > wrote: > > > > After currently using Mathematica for similar things, I would just like > to encourage you to provide some nice method to simplify constraints of >

Re: [sympy] Re: How to randomly sample from custom probability distributions

2021-02-18 Thread Gary Bhumbra
Thanks Gagandeep, Looks like my SymPy install was indeed old - happy to confirm that the code does work fine on SymPy version 1.7.1! Kind regards, Gary. On Thursday, February 18, 2021 at 2:37:51 PM UTC czgdp1807 wrote: > Hi, > > It seems like your code is working fine on SymPy's master

Re: [sympy] Re: How to randomly sample from custom probability distributions

2021-02-18 Thread Gagandeep Singh (B17CS021)
Hi, It seems like your code is working fine on SymPy's master branch. Code from sympy.stats import ContinuousRV, sample from sympy import sqrt, exp, Symbol, Interval, oo, pi mean, prec = 1, 4 x = Symbol('x') pdf = sqrt(prec)/sqrt(2*pi) * exp(-prec*(x-mean)**2/2) Z = ContinuousRV(x, pdf,

[sympy] Re: How to randomly sample from custom probability distributions

2021-02-18 Thread Gary Bhumbra
> think you have capital and little 'z' when you want only one. See the last three lines. Thanks for the suggestion. The original code (above) results in this error: TypeError: 'Mul' object is not an iterator If I try to follow your suggestion and modify the last three lines to: Z =

[sympy] Re: How to randomly sample from custom probability distributions

2021-02-18 Thread gu...@uwosh.edu
I think you have capital and little 'z' when you want only one. See the last three lines. On Thursday, February 18, 2021 at 4:26:15 AM UTC-6 bhu...@gmail.com wrote: > I've looked in the SymPy documentation and cannot find a template for > this. I apologise if I've overlooked something and the

Re: [sympy] Linear Inequality Simplifier

2021-02-18 Thread Oscar Benjamin
On Thu, 18 Feb 2021 at 11:32, Oscar Gustafsson wrote: > > After currently using Mathematica for similar things, I would just like to > encourage you to provide some nice method to simplify constraints of > piecewise functions using your simplifier, including additional constraints > on the

Re: [sympy] Linear Inequality Simplifier

2021-02-18 Thread Oscar Gustafsson
After currently using Mathematica for similar things, I would just like to encourage you to provide some nice method to simplify constraints of piecewise functions using your simplifier, including additional constraints on the range of variables (as SymPy doesn't have a way to put ranges on

Re: [sympy] Linear Inequality Simplifier

2021-02-18 Thread אוריאל מליחי
I understand. So I would use the LP solver implemented by Lee which should work with symbolic coefficients. On Thu, 18 Feb 2021 at 00:46, Oscar Benjamin wrote: > ‪On Tue, 16 Feb 2021 at 17:01, ‫אוריאל מליחי‬‎ > wrote:‬ > > > > For your first question, I intend to create a new function that

[sympy] How to randomly sample from custom probability distributions

2021-02-18 Thread Gary Bhumbra
I've looked in the SymPy documentation and cannot find a template for this. I apologise if I've overlooked something and the answer is trivial, but all I wish to do create a sampler for custom probability distributions defined using SymPy algebra e.g.: from sympy.stats import ContinuousRV,