.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/basic/example_hello_world.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_basic_example_hello_world.py: ================ Hello BAM Engine ================ This is the simplest possible BAM Engine example. It shows how to initialize a simulation, run it for a few periods, and display basic results. If you're new to BAM Engine, start here! .. GENERATED FROM PYTHON SOURCE LINES 13-17 Initialize and Run ------------------ Create a simulation with default parameters and run it for 50 periods. .. GENERATED FROM PYTHON SOURCE LINES 17-28 .. code-block:: Python import bamengine as bam # Initialize simulation with 100 firms and 500 households sim = bam.Simulation.init() # Run for 50 periods sim.run(n_periods=50) print(f"Simulation completed! Ran {sim.t} periods.") .. rst-class:: sphx-glr-script-out .. code-block:: none Simulation completed! Ran 50 periods. .. GENERATED FROM PYTHON SOURCE LINES 29-33 Visualize Unemployment ---------------------- Plot the average market price over time. .. GENERATED FROM PYTHON SOURCE LINES 33-44 .. code-block:: Python import matplotlib.pyplot as plt plt.figure(figsize=(10, 6)) plt.plot(sim.ec.avg_mkt_price_history, linewidth=2) plt.xlabel("Period") plt.ylabel("Average Market Price") plt.title("Average Market Price Over Time") plt.grid(True, alpha=0.3) plt.tight_layout() plt.show() .. image-sg:: /auto_examples/basic/images/sphx_glr_example_hello_world_001.png :alt: Average Market Price Over Time :srcset: /auto_examples/basic/images/sphx_glr_example_hello_world_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.400 seconds) .. _sphx_glr_download_auto_examples_basic_example_hello_world.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_hello_world.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_hello_world.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_hello_world.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_