JuliaHEP / JuliaHEP-2023

Materials for the JuliaHEP 2023 Workshop
https://juliahep.github.io/JuliaHEP-2023/
Creative Commons Attribution 4.0 International
4 stars 4 forks source link

More Exercises #22

Closed aoanla closed 10 months ago

aoanla commented 10 months ago

We should have 2 more short exercises (one "write some not entirely trivial code in Julia" and one "do some plots or dataframes or both").

I'll have a look at this today, but if anyone has suggestions I am open to them for topics.

aoanla commented 10 months ago

I'd really like to have some multiple dispatch in here, but the exercises can't be too heavy. I'm thinking maybe:

given

nrs_\delta(x,f,f\prime) = f(x)/f\prime(x)

and some example f, f\primes (say, x^3 - 8, 3x^2 )

[that is, the delta for successive approximation with Newton-Raphson-(Simpson)]

a) work through writing the function that takes an initial value and then iterates to return an x with some \epsilon of a root [does iteration, conditionals, writing a function]

test appropriately!

b) write a new method for the same function, which takes a Vector with a single element to start at, and iterates, saving the intermediate values in the Vector (using push!). [does multiple dispatch, parametric constraints]

test appropriately

-- c) using Plots, plot: a) a line graph of the function we're finding the root of b) a scatter plot of the successive x values and their respective function values on the same axes. [does plot, plot! or scatter!, broadcasting - if we generate y values as f.(xs) ]

Thoughts? Not HEP enough?

graeme-a-stewart commented 10 months ago

I think it would be a nice exercise - we ask people to tackle a) and b) after the first teaching stint, then to do c) after the plots tutorial?

graeme-a-stewart commented 10 months ago

I am also working on an exercise based on DataFrames, should be finished today

aoanla commented 10 months ago

btw, re the guided-ness of the NRS exercises, they started out less so and then I started worrying about the time factor... so I might revise them a bit after tomorrow if we keep this around for future things.

graeme-a-stewart commented 10 months ago

btw, re the guided-ness of the NRS exercises, they started out less so and then I started worrying about the time factor... so I might revise them a bit after tomorrow if we keep this around for future things.

I do agree - I'd like also to add a little bit on ML, to further build on the data frames work