user@users-iMac GIT % conda activate testControl
(testControl) user@users-iMac GIT % conda list
# packages in environment at /usr/local/Caskroom/miniforge/base/envs/testControl:
#
# Name                    Version                   Build  Channel
(testControl) user@users-iMac GIT % conda install control
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /usr/local/Caskroom/miniforge/base/envs/testControl

  added / updated specs:
    - control


The following NEW packages will be INSTALLED:

  brotli             conda-forge/osx-64::brotli-1.1.0-h0dc2134_0 
  brotli-bin         conda-forge/osx-64::brotli-bin-1.1.0-h0dc2134_0 
  brotli-python      conda-forge/osx-64::brotli-python-1.1.0-py311hdf8f085_0 
  bzip2              conda-forge/osx-64::bzip2-1.0.8-h0d85af4_4 
  ca-certificates    conda-forge/osx-64::ca-certificates-2023.7.22-h8857fd0_0 
  certifi            conda-forge/noarch::certifi-2023.7.22-pyhd8ed1ab_0 
  charset-normalizer conda-forge/noarch::charset-normalizer-3.2.0-pyhd8ed1ab_0 
  contourpy          conda-forge/osx-64::contourpy-1.1.0-py311h5fe6e05_0 
  control            conda-forge/noarch::control-0.9.4-pyhd8ed1ab_0 
  cycler             conda-forge/noarch::cycler-0.11.0-pyhd8ed1ab_0 
  fonttools          conda-forge/osx-64::fonttools-4.42.1-py311h2725bcf_0 
  freetype           conda-forge/osx-64::freetype-2.12.1-h3f81eb7_1 
  idna               conda-forge/noarch::idna-3.4-pyhd8ed1ab_0 
  kiwisolver         conda-forge/osx-64::kiwisolver-1.4.5-py311h5fe6e05_0 
  lcms2              conda-forge/osx-64::lcms2-2.15-h2dcdeff_1 
  lerc               conda-forge/osx-64::lerc-4.0.0-hb486fe8_0 
  libblas            conda-forge/osx-64::libblas-3.9.0-18_osx64_openblas 
  libbrotlicommon    conda-forge/osx-64::libbrotlicommon-1.1.0-h0dc2134_0 
  libbrotlidec       conda-forge/osx-64::libbrotlidec-1.1.0-h0dc2134_0 
  libbrotlienc       conda-forge/osx-64::libbrotlienc-1.1.0-h0dc2134_0 
  libcblas           conda-forge/osx-64::libcblas-3.9.0-18_osx64_openblas 
  libcxx             conda-forge/osx-64::libcxx-16.0.6-hd57cbcb_0 
  libdeflate         conda-forge/osx-64::libdeflate-1.18-hac1461d_0 
  libexpat           conda-forge/osx-64::libexpat-2.5.0-hf0c8a7f_1 
  libffi             conda-forge/osx-64::libffi-3.4.2-h0d85af4_5 
  libgfortran        conda-forge/osx-64::libgfortran-5.0.0-12_3_0_h97931a8_1 
  libgfortran5       conda-forge/osx-64::libgfortran5-12.3.0-hbd3c1fe_1 
  libjpeg-turbo      conda-forge/osx-64::libjpeg-turbo-2.1.5.1-hb7f2c08_0 
  liblapack          conda-forge/osx-64::liblapack-3.9.0-18_osx64_openblas 
  libopenblas        conda-forge/osx-64::libopenblas-0.3.24-openmp_h48a4ad5_0 
  libpng             conda-forge/osx-64::libpng-1.6.39-ha978bb4_0 
  libsqlite          conda-forge/osx-64::libsqlite-3.43.0-h58db7d2_0 
  libtiff            conda-forge/osx-64::libtiff-4.5.1-hf955e92_1 
  libwebp-base       conda-forge/osx-64::libwebp-base-1.3.1-h0dc2134_0 
  libxcb             conda-forge/osx-64::libxcb-1.15-hb7f2c08_0 
  libzlib            conda-forge/osx-64::libzlib-1.2.13-h8a1eda9_5 
  llvm-openmp        conda-forge/osx-64::llvm-openmp-16.0.6-hff08bdf_0 
  matplotlib-base    conda-forge/osx-64::matplotlib-base-3.7.1-py311h2bf763f_0 
  munkres            conda-forge/noarch::munkres-1.1.4-pyh9f0ad1d_0 
  ncurses            conda-forge/osx-64::ncurses-6.4-hf0c8a7f_0 
  numpy              conda-forge/osx-64::numpy-1.25.2-py311hc44ba51_0 
  openjpeg           conda-forge/osx-64::openjpeg-2.5.0-h13ac156_2 
  openssl            conda-forge/osx-64::openssl-3.1.2-h8a1eda9_0 
  packaging          conda-forge/noarch::packaging-23.1-pyhd8ed1ab_0 
  pillow             conda-forge/osx-64::pillow-10.0.0-py311h7cb0e2d_0 
  pip                conda-forge/noarch::pip-23.2.1-pyhd8ed1ab_0 
  platformdirs       conda-forge/noarch::platformdirs-3.10.0-pyhd8ed1ab_0 
  pooch              conda-forge/noarch::pooch-1.7.0-pyha770c72_3 
  pthread-stubs      conda-forge/osx-64::pthread-stubs-0.4-hc929b4f_1001 
  pyparsing          conda-forge/noarch::pyparsing-3.1.1-pyhd8ed1ab_0 
  pysocks            conda-forge/noarch::pysocks-1.7.1-pyha2e5f31_6 
  python             conda-forge/osx-64::python-3.11.5-h30d4d87_0_cpython 
  python-dateutil    conda-forge/noarch::python-dateutil-2.8.2-pyhd8ed1ab_0 
  python_abi         conda-forge/osx-64::python_abi-3.11-3_cp311 
  readline           conda-forge/osx-64::readline-8.2-h9e318b2_1 
  requests           conda-forge/noarch::requests-2.31.0-pyhd8ed1ab_0 
  scipy              conda-forge/osx-64::scipy-1.11.2-py311h16c3c4d_0 
  setuptools         conda-forge/noarch::setuptools-68.1.2-pyhd8ed1ab_0 
  six                conda-forge/noarch::six-1.16.0-pyh6c4a22f_0 
  slycot             conda-forge/osx-64::slycot-0.5.4-py311h1f8906c_0 
  tk                 conda-forge/osx-64::tk-8.6.12-h5dbffcc_0 
  typing-extensions  conda-forge/noarch::typing-extensions-4.7.1-hd8ed1ab_0 
  typing_extensions  conda-forge/noarch::typing_extensions-4.7.1-pyha770c72_0 
  tzdata             conda-forge/noarch::tzdata-2023c-h71feb2d_0 
  urllib3            conda-forge/noarch::urllib3-2.0.4-pyhd8ed1ab_0 
  wheel              conda-forge/noarch::wheel-0.41.2-pyhd8ed1ab_0 
  xorg-libxau        conda-forge/osx-64::xorg-libxau-1.0.11-h0dc2134_0 
  xorg-libxdmcp      conda-forge/osx-64::xorg-libxdmcp-1.1.3-h35c211d_0 
  xz                 conda-forge/osx-64::xz-5.2.6-h775f41a_0 
  zstd               conda-forge/osx-64::zstd-1.5.5-h829000d_0 


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(testControl) user@users-iMac GIT % conda list
# packages in environment at /usr/local/Caskroom/miniforge/base/envs/testControl:
#
# Name                    Version                   Build  Channel
brotli                    1.1.0                h0dc2134_0    conda-forge
brotli-bin                1.1.0                h0dc2134_0    conda-forge
brotli-python             1.1.0           py311hdf8f085_0    conda-forge
bzip2                     1.0.8                h0d85af4_4    conda-forge
ca-certificates           2023.7.22            h8857fd0_0    conda-forge
certifi                   2023.7.22          pyhd8ed1ab_0    conda-forge
charset-normalizer        3.2.0              pyhd8ed1ab_0    conda-forge
contourpy                 1.1.0           py311h5fe6e05_0    conda-forge
control                   0.9.4              pyhd8ed1ab_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
fonttools                 4.42.1          py311h2725bcf_0    conda-forge
freetype                  2.12.1               h3f81eb7_1    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.5           py311h5fe6e05_0    conda-forge
lcms2                     2.15                 h2dcdeff_1    conda-forge
lerc                      4.0.0                hb486fe8_0    conda-forge
libblas                   3.9.0           18_osx64_openblas    conda-forge
libbrotlicommon           1.1.0                h0dc2134_0    conda-forge
libbrotlidec              1.1.0                h0dc2134_0    conda-forge
libbrotlienc              1.1.0                h0dc2134_0    conda-forge
libcblas                  3.9.0           18_osx64_openblas    conda-forge
libcxx                    16.0.6               hd57cbcb_0    conda-forge
libdeflate                1.18                 hac1461d_0    conda-forge
libexpat                  2.5.0                hf0c8a7f_1    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libgfortran               5.0.0           12_3_0_h97931a8_1    conda-forge
libgfortran5              12.3.0               hbd3c1fe_1    conda-forge
libjpeg-turbo             2.1.5.1              hb7f2c08_0    conda-forge
liblapack                 3.9.0           18_osx64_openblas    conda-forge
libopenblas               0.3.24          openmp_h48a4ad5_0    conda-forge
libpng                    1.6.39               ha978bb4_0    conda-forge
libsqlite                 3.43.0               h58db7d2_0    conda-forge
libtiff                   4.5.1                hf955e92_1    conda-forge
libwebp-base              1.3.1                h0dc2134_0    conda-forge
libxcb                    1.15                 hb7f2c08_0    conda-forge
libzlib                   1.2.13               h8a1eda9_5    conda-forge
llvm-openmp               16.0.6               hff08bdf_0    conda-forge
matplotlib-base           3.7.1           py311h2bf763f_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
ncurses                   6.4                  hf0c8a7f_0    conda-forge
numpy                     1.25.2          py311hc44ba51_0    conda-forge
openjpeg                  2.5.0                h13ac156_2    conda-forge
openssl                   3.1.2                h8a1eda9_0    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
pillow                    10.0.0          py311h7cb0e2d_0    conda-forge
pip                       23.2.1             pyhd8ed1ab_0    conda-forge
platformdirs              3.10.0             pyhd8ed1ab_0    conda-forge
pooch                     1.7.0              pyha770c72_3    conda-forge
pthread-stubs             0.4               hc929b4f_1001    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.5          h30d4d87_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    3_cp311    conda-forge
readline                  8.2                  h9e318b2_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
scipy                     1.11.2          py311h16c3c4d_0    conda-forge
setuptools                68.1.2             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
slycot                    0.5.4           py311h1f8906c_0    conda-forge
tk                        8.6.12               h5dbffcc_0    conda-forge
typing-extensions         4.7.1                hd8ed1ab_0    conda-forge
typing_extensions         4.7.1              pyha770c72_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
urllib3                   2.0.4              pyhd8ed1ab_0    conda-forge
wheel                     0.41.2             pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.11               h0dc2134_0    conda-forge
xorg-libxdmcp             1.1.3                h35c211d_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
zstd                      1.5.5                h829000d_0    conda-forge
(testControl) user@users-iMac GIT % cd RL_Teaching 
(testControl) user@users-iMac RL_Teaching % python controlsTest_plain.py 

Platform Info: ('Darwin', '22.6.0', 'Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64')
Platform Info: macOS-13.5.1-x86_64-i386-64bit
Python Version: 3.11.5
Numpy Version: 1.25.2
Scipy Version: 1.11.2
Control Version: 0.9.4
Summary statistics:
* Cost function calls: 105
* Constraint calls: 126
* System simulations: 215
* Final cost: 568.2949584277821
 message: Optimization terminated successfully
 success: True
  status: 0
     fun: 568.2949584277821
       x: [ 8.085e-01  1.464e-02  4.912e-01  7.621e-01  5.672e-01
            5.080e-01  4.151e-01  2.398e-01  0.000e+00  0.000e+00]
     nit: 9
     jac: [-3.049e+00 -4.285e+00 -1.991e+00 -2.014e-03 -9.003e-04
            1.045e-03 -8.392e-04  1.541e-03  0.000e+00  0.000e+00]
    nfev: 105
    njev: 9
 problem: <control.optimal.OptimalControlProblem object at 0x183037e50>
    cost: 568.2949584277821
    time: [ 0.000e+00  1.000e-01  2.000e-01  3.000e-01  4.000e-01
            5.000e-01  6.000e-01  7.000e-01  8.000e-01  9.000e-01]
  inputs: [ 8.085e-01  1.464e-02  4.912e-01  7.621e-01  5.672e-01
            5.080e-01  4.151e-01  2.398e-01  0.000e+00  0.000e+00]
  states: [[ 2.000e+00  2.010e+00 ...  2.216e+00  2.261e+00]
           [ 0.000e+00  1.856e-01 ...  4.615e-01  4.397e-01]
           [ 0.000e+00 -4.624e-02 ... -1.408e-02  1.761e-02]
           [ 0.000e+00 -8.497e-01 ...  2.412e-01  3.458e-01]]
/usr/local/Caskroom/miniforge/base/envs/testControl/lib/python3.11/site-packages/control/optimal.py:928: UserWarning: unable to solve optimal control problem
scipy.optimize.minimize returned Positive directional derivative for linesearch
  warnings.warn(
Computation time = 126.913 seconds