m |
m (→Crash course in Julia (programming)) |
||
(6 intermediate revisions by one user not shown) | |||
Line 4: | Line 4: | ||
{{WLPVI-content}} | {{WLPVI-content}} | ||
+ | |||
+ | or do you mean | ||
+ | |||
+ | # [[WLV VI/OS|Operating Systems]] | ||
+ | # [[WLV VI/TeX|$\TeX$ and $\LaTeX$]] | ||
+ | # [[WLV VI/CP|Computer Programming]] | ||
+ | # [[WLV VI/Julia|Julia]] | ||
+ | # [[WLV VI/Plotting|Plotting]] | ||
+ | # [[WLV VI/Numbers|Numbers]] | ||
+ | # [[WLV VI/RandomNumbers|Random numbers]] | ||
+ | # [[WLV VI/Algo1|Algorithms–the idea]] | ||
+ | # [[WLV VI/Algo2|Algorithms–applications]] | ||
+ | # [[WLV VI/Complexity|Complexity]] | ||
+ | # [[WLV VI/Integrals|Integrals]] | ||
+ | # [[WLV VI/Derivatives|Derivatives]] | ||
+ | # [[WLV VI/Roots|Root finding]] | ||
+ | # [[WLV VI/ODE1|ODE: Euler]] | ||
+ | # [[WLV VI/ODE2|ODE: Heun & Runge-Kutta]] | ||
+ | # [[WLV VI/ND|Higher Dimensions]] | ||
+ | # [[WLV VI/LinearAlgebra|Linear algebra]] | ||
+ | # [[WLV VI/DFT|Fourier and DFT]] | ||
+ | # [[WLV VI/Interpolation|Interpolation]] | ||
+ | # [[WLV VI/Extrapolation|Extrapolation]] | ||
+ | # [[WLV VI/Stability|Stability and Convergence]] | ||
+ | # [[WLV VI/Chaos|Chaos and fractals]] | ||
+ | # [[WLV VI/OOP|Objects]] | ||
+ | # [[WLV VI/Lib|Librairies]] | ||
+ | # [[WLV VI/Fun|Fun problems]] | ||
+ | |||
+ | ---- | ||
+ | |||
+ | = Crash course in Julia (programming) = | ||
+ | |||
+ | When plotting pure functions, you might find that the density of points (PlotPoints in [[Mathematica]]) is not enough. This can be increased by specifying the step in the range, but in this case beware not to query your functions outside of its validity range, which would work otherwise. Compare: | ||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
+ | plot(x->sqrt((15/x^2)-1),0,4,linewidth=5,linealpha=.5,linecolor=:red,ylims=(0,3)) | ||
+ | plot!(x->sqrt((15/x^2)-1),0:.0001:3.8729,linewidth=2,linecolor=:blue,ylims=(0,3)) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <center><wz tip="High sampling-density (blue) vs automatic (red) but less trouble-making plot of a function that becomes ill-defined outside of its domain.">[[File:Screenshot_12-03-2020_184242.jpg|400px]]</wz></center> | ||
+ | |||
+ | The first version can plot over the range 0–4 but does so by not plotting the full function, while the second (with x-steps of 0.0001 allowing for the nice curvature) shows everything but would return an error if going over the limit where the argument gets negative. |
or, as officially known, The Wolverhampton Lectures on Physics: VI — Scientific Computing.
or do you mean
When plotting pure functions, you might find that the density of points (PlotPoints in Mathematica) is not enough. This can be increased by specifying the step in the range, but in this case beware not to query your functions outside of its validity range, which would work otherwise. Compare:
plot(x->sqrt((15/x^2)-1),0,4,linewidth=5,linealpha=.5,linecolor=:red,ylims=(0,3)) plot!(x->sqrt((15/x^2)-1),0:.0001:3.8729,linewidth=2,linecolor=:blue,ylims=(0,3))
The first version can plot over the range 0–4 but does so by not plotting the full function, while the second (with x-steps of 0.0001 allowing for the nice curvature) shows everything but would return an error if going over the limit where the argument gets negative.