Skip to content

Commit

Permalink
Add example data
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Herdieckerhoff committed Sep 29, 2023
1 parent 9f921b2 commit a27c743
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions exercises-toolbox/4-scipy/2-linregress/aufgabe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ B_error = σ_y * sqrt((Σx²) / Δ)

Nutze folgendes Gerüst:

import numpy as np

rng = np.random.default_rng(seed=42)
x = rng.random(10)
y = 1.6 * x + 0.2 * rng.uniform(-1,1, len(x))

def linregress(x, y):
return A, A_error, B, B_error

print(linregress(x,y))
5 changes: 4 additions & 1 deletion exercises-toolbox/4-scipy/2-linregress/loesung.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import numpy as np

rng = np.random.default_rng(seed=42)
x = rng.random(10)
y = 1.6 * x + 0.2 * rng.uniform(-1,1, len(x))

def linregress(x, y):
assert len(x) == len(y)
Expand All @@ -21,4 +24,4 @@ def linregress(x, y):


if __name__ == "__main__":
print(linregress([1, 2, 3, 4], [1, 2.5, 3, 3.5]))
print(linregress(x, y))

0 comments on commit a27c743

Please sign in to comment.