<jupyter_start><jupyter_text>Buckling Plate Demo (User Need: Big Picture)<jupyter_code>## Initialize the package
import grama as gr<jupyter_output><empty_output><jupyter_text>Buckling Plate![Plate](./plate_free_sides.png)(Peery, 1950)  Implement Governing Equation$$g_{\text{buckle}} = \frac{\pi^2 E}{12 (1 - \mu^2)}\left(\frac{t}{h}\right)^2 - \frac{L}{wt}$$<jupyter_code>## Implement governing equation
pi = 3.14159

def g_buckle(x):
    t, w, h, E, mu, L = x
    
    return pi**2 * E / 12. / (1 - mu**2) * (t / h) ** 2 - L / (w * t)

var_list = ["t", "w", "h", "E", "mu", "L"]<jupyter_output><empty_output><jupyter_text>Study Data<jupyter_code>## Import data for the model
from grama.data import df_stang
## Import plotting tools
import seaborn as sns
## Plot the data
sns.pairplot(df_stang[["E", "mu"]]) # Elasticity and poisson ratio<jupyter_output><empty_output><jupyter_text>Build Model<jupyter_code>## Build the model
md_plate = \
    gr.Model("Plate under buckling load") >> \
    gr.cp_function(
        fun=g_buckle,    # (above)
        var=var_list,    # (above)
        out=["g_buckle"] # Output name
    ) >> \
    gr.cp_bounds( # Deterministic variables
        t=(0.03, 0.12),    # Thickness
        w=(6, 18),         # Width
        h=(6, 18),         # Height
        L=(2.5e-1, 4.0e-1) # Load
    ) >> \
    gr.cp_marginals( # Random variables
        E=gr.marg_named(df_stang.E, "norm"),
        mu=gr.marg_named(df_stang.mu, "beta")
    ) >> \
    gr.cp_copula_gaussian(df_data=df_stang) # Dependence
    
md_plate.printpretty()<jupyter_output>model: Plate under buckling load

  inputs:
    var_det:
      h: [6, 18]
      L: [0.25, 0.4]
      t: [0.03, 0.12]
      w: [6, 18]
    var_rand:
      E: (+0) norm, {'loc': 10344.736842105263, 'scale': 258.7392188662194}
      mu: (+0) beta, {'a': 1.0039017654316746, 'b': 0.8622680473775106, 'loc': 0.3094053248270583, 'scale': 0.021594675172941728}
    copula:
        Gaussian copula with correlations:
  var1 var2      corr
0   mu    E  0.371244
  functions:
    g_buckle: ['t', 'w', 'h', 'E', 'mu', 'L'] -> ['g_buckle']<jupyter_text>Analyze Model: Deterministic approach<jupyter_code>df_conservative = \
    md_plate >> \
    gr.ev_conservative(df_det="nom")
df_conservative[["g_buckle"]]<jupyter_output>eval_conservative() using quantile default 0.01;
provide `quantiles` keyword for non-default behavior.<jupyter_text>Limit state `g_buckle > 0` implies safe structure.  Analyze Model Uncertainty<jupyter_code>## Analyze the model
md_plate >> \
    gr.ev_monte_carlo(n=1e3, df_det="nom") >> \
    gr.pt_auto()<jupyter_output>eval_monte_carlo() is rounding n...
{'fraction_non_alphanumeric': 0.16116799393249906, 'fraction_numerical': 0.06750094804702313, 'mean_word_length': 3.5094017094017094, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '309998', 'license': 'MIT', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1047, 'n_words': 218, 'path': 'examples/demo/example_pipeline.ipynb', 'repo_name': 'QingmuDeng/py_grama', 'size': '2637'}