From a5c53c4013312eab086d9a62e4923303ae654350 Mon Sep 17 00:00:00 2001 From: leios Date: Wed, 10 Oct 2018 06:44:33 +0900 Subject: [PATCH] smallscale changes to javascript tree traversal, jarvis julia, and euler text. --- contents/forward_euler_method/forward_euler_method.md | 3 ++- contents/jarvis_march/code/julia/jarvis.jl | 3 +-- contents/tree_traversal/tree_traversal.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contents/forward_euler_method/forward_euler_method.md b/contents/forward_euler_method/forward_euler_method.md index af6da3184..0a95c0b60 100644 --- a/contents/forward_euler_method/forward_euler_method.md +++ b/contents/forward_euler_method/forward_euler_method.md @@ -95,7 +95,8 @@ That said, variations of this method *are* certainly used (for example Crank-Nic Like in the case of [Verlet Integration](../verlet_integration/verlet_integration.md), the easiest way to test to see if this method works is to test it against a simple test-case. Here, the most obvious test-case would be dropping a ball from 5 meters, which is my favorite example, but proved itself to be slightly less enlightening than I would have thought. -So, this time, let's remove ourselves from any physics and instead solve the following ODE: $$y' = 5y$$. Note that in this case, the velocity is directly given by the ODE and the acceleration is not part of the model. +So, this time, let's remove ourselves from any physics and instead solve the following ODE: $$y(t)' = -3t$$ with the initial condition that $$y(0) = 1$$. +Note that in this case, the velocity is directly given by the ODE and the acceleration is not part of the model. {% method %} {% sample lang="jl" %} diff --git a/contents/jarvis_march/code/julia/jarvis.jl b/contents/jarvis_march/code/julia/jarvis.jl index cb4290cd0..fac153128 100644 --- a/contents/jarvis_march/code/julia/jarvis.jl +++ b/contents/jarvis_march/code/julia/jarvis.jl @@ -22,8 +22,7 @@ function jarvis_march(points::Vector{Pos}) # Find cross product between points curr_product = jarvis_cross(Pos(0,0), hull[1], curr_point) - #while (curr_point != hull[1]) - while (length(hull) < 4) + while (curr_point != hull[1]) for point in points product = 0.0 if (i == 1) diff --git a/contents/tree_traversal/tree_traversal.md b/contents/tree_traversal/tree_traversal.md index 6ecbee658..2cc090779 100644 --- a/contents/tree_traversal/tree_traversal.md +++ b/contents/tree_traversal/tree_traversal.md @@ -14,8 +14,8 @@ Trees are naturally recursive data structures, and because of this, we cannot ac {% sample lang="java" %} [import:110-126, lang:"java"](code/java/Tree.java) {% sample lang="js" %} -This has not been implemented in your chosen language, so here is the Julia code -[import:3-7, lang:"julia"](code/julia/Tree.jl) +[import:1-10, lang:"javascript"](code/javascript/tree.js) +As a note, a `node` struct is not necessary in javascript, so this is an example of how a tree might be constructed. {% sample lang="py" %} [import:1-4, lang:"python"](code/python/Tree_example.py) {% sample lang="scratch" %}