On Thu, Jan 27, 2022 at 8:18 AM <bigfixfo...@gmail.com> wrote:

> Hi, i am new to numpy. This is first time i am using numpy.
>
> https://github.com/mspieg/dynamical-systems/blob/master/Bifurcations.ipynb
>
> This code i found to create bifurcation graph. There is section of code
> which i am not able to understand
>
> vr[stable], vx[stable]
>
> vr and vx is array of 150 elements.
> unstable and stable array also has 150 elements
>
> But vr[stable], vx[stable] becomes 75 elements in the array. Which i am
> not able to umderstand how 150 elements in array drops to 75
>

`stable` is a boolean array which is True where `f_x(vr, vx) < 0` and False
otherwise. When a boolean array is used as an index, the resulting array
only has the elements where the boolean value in the index array is True
and dropping all of the elements where it is False. That is why the number
of elements changes.

https://numpy.org/doc/stable/user/basics.indexing.html#boolean-array-indexing

-- 
Robert Kern
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to