Skip to content

Commit b2122ba

Browse files
committed
post TR2
1 parent 7fae3a3 commit b2122ba

File tree

6 files changed

+73
-76
lines changed

6 files changed

+73
-76
lines changed

marimo-notebook/break_even_analysis_UI_elements.py

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,31 @@
44
app = marimo.App(width="medium")
55

66

7-
app._unparsable_cell(
8-
r"""
9-
oimport marimo as mo
10-
""",
11-
name="_",
12-
)
13-
14-
157
@app.cell
16-
def _(
17-
ui_color_costs,
18-
ui_fixed_cost,
19-
ui_quantity,
20-
ui_selling_price,
21-
ui_unit_cost,
22-
):
8+
def _():
239
import matplotlib.pyplot as plt
10+
import marimo as mo
11+
return mo, plt
12+
2413

14+
@app.cell
15+
def _(ui_fixed_cost, ui_quantity, ui_selling_price, ui_unit_cost):
2516
fixed_cost = int(ui_fixed_cost.value)
2617
unit_cost = ui_unit_cost.value
2718
selling_price = float(ui_selling_price.value)
2819
upper_production_quantity = ui_quantity.value
20+
return fixed_cost, selling_price, unit_cost, upper_production_quantity
21+
2922

23+
@app.cell
24+
def _(
25+
fixed_cost,
26+
plt,
27+
selling_price,
28+
ui_color_costs,
29+
unit_cost,
30+
upper_production_quantity,
31+
):
3032
break_even_quantity = fixed_cost / (selling_price - unit_cost)
3133
break_even_income = break_even_quantity * selling_price
3234

@@ -58,28 +60,22 @@ def _(
5860
return (
5961
break_even_income,
6062
break_even_quantity,
61-
fixed_cost,
62-
plt,
6363
sales_income,
64-
selling_price,
65-
unit_cost,
6664
unit_costs,
6765
units,
68-
upper_production_quantity,
6966
)
7067

7168

7269
@app.cell
7370
def _(mo):
74-
options = ["40000", "50000"]
75-
ui_fixed_cost = mo.ui.radio(options=options, value="50000")
71+
ui_fixed_cost = mo.ui.radio(options=["40000", "50000"], value="50000")
7672

7773
ui_unit_cost = mo.ui.slider(start=2, stop=5, step=1)
7874

7975
ui_selling_price = mo.ui.text(value="10")
8076

8177
ui_quantity = mo.ui.dropdown(
82-
options={"10000": 10000, "12000": 12000, "15000": 15000}, value="10000"
78+
options={"10000": 10000, "12000": 12000, "15000": 15000}, value="10000",
8379
)
8480

8581
ui_disply_break_even = mo.ui.switch()
@@ -90,17 +86,16 @@ def _(mo):
9086

9187
mo.md(
9288
f"""
93-
Select Fixed Costs: {ui_fixed_cost}
89+
Fixed Costs: {ui_fixed_cost}
9490
95-
Select Unit Cost Price: {ui_unit_cost}
91+
Unit Cost Price: {ui_unit_cost}
9692
97-
Enter Selling Price: {ui_selling_price}
93+
Selling Price: {ui_selling_price}
9894
99-
Select a Maximum Production Quantity: {ui_quantity}
95+
Maximum Production Quantity: {ui_quantity}
10096
"""
10197
)
10298
return (
103-
options,
10499
ui_color_costs,
105100
ui_disply_break_even,
106101
ui_fixed_cost,

marimo-notebook/break_even_analysis_chart_code.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
import marimo
22

3-
__generated_with = "0.10.14"
3+
__generated_with = "0.11.0"
44
app = marimo.App(width="medium")
55

66

77
@app.cell
88
def _():
99
import matplotlib.pyplot as plt
10+
import marimo as mo
11+
return mo, plt
1012

13+
14+
@app.cell
15+
def _():
1116
fixed_cost = 50000
1217
unit_cost = 2
1318
selling_price = 10
1419
upper_production_quantity = 10000
20+
return fixed_cost, selling_price, unit_cost, upper_production_quantity
1521

22+
23+
@app.cell
24+
def _(
25+
fixed_cost,
26+
plt,
27+
selling_price,
28+
unit_cost,
29+
upper_production_quantity,
30+
):
1631
break_even_quantity = fixed_cost / (selling_price - unit_cost)
1732
break_even_income = fixed_cost + break_even_quantity * unit_cost
1833

@@ -44,13 +59,8 @@ def _():
4459
return (
4560
break_even_income,
4661
break_even_quantity,
47-
fixed_cost,
48-
plt,
4962
sales_income,
50-
selling_price,
51-
unit_cost,
5263
unit_costs,
53-
upper_production_quantity,
5464
units,
5565
)
5666

marimo-notebook/break_even_analysis_solution.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,30 @@
66

77
@app.cell
88
def _():
9+
import matplotlib.pyplot as plt
910
import marimo as mo
10-
11-
return (mo,)
11+
return mo, plt
1212

1313

1414
@app.cell
15-
def _(
16-
ui_break_even,
17-
ui_fixed_cost,
18-
ui_plot_color,
19-
ui_quantity,
20-
ui_selling_price,
21-
ui_unit_cost,
22-
):
23-
import matplotlib.pyplot as plt
24-
15+
def _(ui_fixed_cost, ui_quantity, ui_selling_price, ui_unit_cost):
2516
fixed_cost = int(ui_fixed_cost.value)
2617
unit_cost = ui_unit_cost.value
2718
selling_price = float(ui_selling_price.value)
2819
upper_production_quantity = ui_quantity.value
20+
return fixed_cost, selling_price, unit_cost, upper_production_quantity
21+
2922

23+
@app.cell
24+
def _(
25+
fixed_cost,
26+
plt,
27+
selling_price,
28+
ui_break_even,
29+
ui_plot_color,
30+
unit_cost,
31+
upper_production_quantity,
32+
):
3033
break_even_quantity = fixed_cost / (selling_price - unit_cost)
3134
break_even_income = break_even_quantity * selling_price
3235

@@ -61,21 +64,15 @@ def _(
6164
return (
6265
break_even_income,
6366
break_even_quantity,
64-
fixed_cost,
65-
plt,
6667
sales_income,
67-
selling_price,
6868
total_costs,
69-
unit_cost,
7069
units,
71-
upper_production_quantity,
7270
)
7371

7472

7573
@app.cell
7674
def _(mo):
77-
options = ["40000", "50000"]
78-
ui_fixed_cost = mo.ui.radio(options=options, value="50000")
75+
ui_fixed_cost = mo.ui.radio(options=["40000", "50000"], value="50000")
7976

8077
ui_unit_cost = mo.ui.slider(start=2, stop=5, step=1)
8178

@@ -93,21 +90,20 @@ def _(mo):
9390

9491
mo.md(
9592
f"""
96-
Select Fixed Costs: {ui_fixed_cost}
93+
Fixed Costs: {ui_fixed_cost}
9794
98-
Select Unit Cost Price: {ui_unit_cost}
95+
Unit Cost Price: {ui_unit_cost}
9996
100-
Enter Selling Price: {ui_selling_price}
97+
Selling Price: {ui_selling_price}
10198
102-
Select a Maximum Quantity: {ui_quantity}
99+
Maximum Quantity: {ui_quantity}
103100
104101
Display Break-Even Data: {ui_break_even}
105102
106-
Select Total Costs Plot Color: {ui_plot_color}
103+
Total Costs Plot Color: {ui_plot_color}
107104
"""
108105
)
109106
return (
110-
options,
111107
ui_break_even,
112108
ui_fixed_cost,
113109
ui_plot_color,

marimo-notebook/equation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
__generated_with = "0.11.0"
23

34
# %%
@@ -35,4 +36,4 @@
3536
x2 = (-b - math.sqrt(b**2 - 4 * a * c)) / (2 * a)
3637

3738
# %%
38-
print(f"x = {x1} and {x2}.")
39+
print(f"x = {x1} and {x2}.")

marimo-notebook/quadratic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
@app.cell
88
def _():
99
import marimo as mo
10-
1110
return (mo,)
1211

1312

@@ -48,7 +47,6 @@ def _():
4847
@app.cell
4948
def _():
5049
import math
51-
5250
return (math,)
5351

5452

marimo-notebook/simultaneous_equations_ui.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@
77
@app.cell
88
def _():
99
import marimo as mo
10-
1110
return (mo,)
1211

1312

1413
@app.cell
1514
def _(mo):
16-
equation_1_x = mo.ui.text()
17-
equation_1_y = mo.ui.text()
18-
equation_2_x = mo.ui.text()
19-
equation_2_y = mo.ui.text()
20-
equation_1_result = mo.ui.text()
21-
equation_2_result = mo.ui.text()
15+
equation_1_x = mo.ui.text(value="-3.5")
16+
equation_1_y = mo.ui.text(value="7")
17+
equation_2_x = mo.ui.text(value="7")
18+
equation_2_y = mo.ui.text(value="-10")
19+
equation_1_result = mo.ui.text(value="0")
20+
equation_2_result = mo.ui.text(value="4")
2221

2322
mo.md(
2423
f"""
2524
Enter your equation's coefficients below:
2625
2726
{equation_1_x}$x$ + {equation_1_y}$y$ = {equation_1_result}
28-
27+
2928
{equation_2_x}$x$ + {equation_2_y}$y$ = {equation_2_result}
3029
"""
3130
)
32-
3331
return (
3432
equation_1_result,
3533
equation_1_x,
@@ -61,7 +59,6 @@ def _(
6159
[float(equation_1_result.value), float(equation_2_result.value)]
6260
)
6361
solution = np.linalg.solve(coefficients, results)
64-
6562
return coefficients, np, results, solution
6663

6764

@@ -81,13 +78,13 @@ def _(
8178
The solution to the simultaneous equations:
8279
8380
**{float(equation_1_x.value):.2f}$x${float(equation_1_y.value):+.2f}$y$ = {equation_1_result.value}**
84-
81+
8582
**{float(equation_2_x.value):.2f}$x${float(equation_2_y.value):.2f}$y$ = {equation_2_result.value}**
8683
8784
is
88-
89-
**x = {solution[0]}**
90-
**y = {solution[1]}**
85+
86+
**$x$ = {solution[0]}**
87+
**$y$ = {solution[1]}**
9188
"""
9289
)
9390
return

0 commit comments

Comments
 (0)