|
import gradio as gr |
|
|
|
def generate_data(subject, input_field, difficulty): |
|
|
|
print("Sujet:", subject) |
|
print("Input:", input_field) |
|
print("Difficulté:", difficulty) |
|
|
|
q = """ **a)** |
|
Soit \(O\) l'origine du repère et \(x\) la coordonnée du centre du cube sur l'axe \(Ox\). |
|
Au point de départ, l'énergie potentielle est : |
|
$$E_{p_1}=mgl(h_1+L\sin\alpha)$$ |
|
Au point d'arrivée, l'énergie potentielle est nulle. |
|
Le travail de la force de frottement est : |
|
$$W_f=-\mu_c Nl\cos\alpha$$ |
|
Le théorème de l'énergie cinétique nous donne : |
|
$$E_{p_1}+W_f=E_{c_2}$$ |
|
D'où : |
|
$$\begin{split}mgl(h_1+L\sin\alpha)-\mu_c Nl\cos\alpha &= \frac{1}{2}mv^2 \\\ \iff v &= \sqrt{2gl(h_1+L\sin\alpha)-2\mu_c Nl\cos\alpha} \end{split}$$ |
|
Avec \(N=mg\cos\alpha\), on obtient : |
|
$$\begin{split}v &= \sqrt{2gl(h_1+L\sin\alpha)-2\mu_c mgl\cos^2\alpha} \\\ &= \sqrt{2gL\left(h_1+L\sin\alpha- \mu_c l\cos^2\alpha\right)} \end{split}$$ |
|
b) |
|
Lorsque le cube est au point \(B_2\), son énergie mécanique est : |
|
$$\begin{split}E_2 &= E_{c_2}+E_{p_2} \\\ &= \frac{1}{2}mv^2 \\\ &= mgL\left(h_1+L\sin\alpha- \mu_c l\cos^2\alpha\right) \end{split}$$ |
|
c) |
|
Lorsque le cube s'arrête, son énergie cinétique est nulle. |
|
Son énergie potentielle est : |
|
$$E_{p_3}=mgl(h_2+L\sin\alpha)$$ |
|
Le théorème de l'énergie cinétique nous donne : |
|
$$E_2=E_{p_3}$$ |
|
D'où : |
|
$$\begin{split}mgL\left(h_1+L\sin\alpha- \mu_c l\cos^2\alpha\right) &= mgL(h_2+L\sin\alpha) \\\ \iff h_2 &= h_1-\mu_c l\cos^2\alpha \end{split}$$ |
|
d) |
|
Lorsque le cube revient en \(B_1\), son énergie cinétique est nulle. |
|
Son énergie potentielle est : |
|
$$E_{p_4}=mgl(h_1+L\sin\alpha)$$ |
|
Le théorème de l'énergie cinétique nous donne : |
|
$$E_3=E_{p_4}$$ |
|
D'où : |
|
$$\begin{split}E_3 &= mgL\left(h_2+L\sin\alpha- \mu_c l\cos^2\alpha\right) \\\ &= mgL\left(h_1+L\sin\alpha-\mu_c l\cos^2\alpha-\mu_c l\cos^2\alpha\right) \\\ &= mgL\left(h_1+L\sin\alpha-2\mu_c l\cos^2\alpha\right) \end{split}$$ """ |
|
|
|
|
|
return q |
|
|
|
|
|
|
|
|
|
|
|
interface = gr.Interface( |
|
fn=generate_data, |
|
inputs=[gr.Textbox(), gr.Textbox(), gr.Textbox()] , |
|
outputs=gr.Textbox(), |
|
title="Génération de données", |
|
theme="light" |
|
) |
|
|
|
|
|
interface.launch() |
|
|