{"page":"<link rel=\"stylesheet\" href=\"https://lessonplanet.com/assets/packs/css/resources-572d6a42.css\" />\n<link rel=\"stylesheet\" href=\"https://lessonplanet.com/assets/packs/css/lp_boclips_stylesheets-f4d0de30.css\" media=\"all\" />\n<div data-title='Optimal Path Around Quicksand - Math Puzzle (HARD)' data-url='/boclips/videos/628c91f3d043bc37da2a991c' data-video-url='/boclips/videos/628c91f3d043bc37da2a991c' id='bo_player_modal'>\n<div class='boclips-resource-page modal-dialog panel-container'>\n<div class='react-notifications-root'></div>\n<div class='rp-header'>\n<div class='rp-type'>\n<i aria-hidden='true' class='fai fa-regular fa-circle-play'></i>\nVideo\n</div>\n<h1 class='rp-title' id='video-title'>\nOptimal Path Around Quicksand - Math Puzzle (HARD)\n</h1>\n<div class='rp-actions'>\n<div class='mr-1'>\n<a class=\"btn btn-success\" data-posthog-event=\"Signup: LP Signup Activity\" data-posthog-location=\"body_link_boclips\" data-remote=\"true\" href=\"/subscription/new\"><span><span>Get Free Access</span><span class=\"\"> for 10 Days</span><span>!</span></span></a>\n</div>\n</div>\n</div>\n<div class='rp-body'>\n<div class='rp-info'>\n<div aria-label='Hide resource details' class='rp-hide-info' role='button' tabindex='0'>&times;</div>\n<i aria-label='Expand resource details' class='rp-expand-info fai fa-solid fa-up-right-and-down-left-from-center' role='button' tabindex='0'></i>\n<i aria-label='Compress resource details' class='rp-compress-info fai fa-solid fa-down-left-and-up-right-to-center' role='button' tabindex='0'></i>\n<div class='rp-rating'>\n<span class='resource-pool'>\n<span class='pool-label'>Publisher:</span>\n<span class='pool-name'>\n<span class='text'><a data-publisher-id=\"30360345\" href=\"/search?publisher_ids%5B%5D=30360345\">Virtually Passed</a></span>\n</span>\n</span>\n</div>\n<div class='rp-description'>\n<span class='short-description'>What is the optimal path to travel from start to finish in the least time?  Your speed is = the distance you are from the pit. Here I show one optimal path! #SoME1Timestamps:0:00 - Introduction &amp; Question0:52 - Total Time: Cartesian...</span>\n<span class='full-description hide'>What is the optimal path to travel from start to finish in the least time?  Your speed is = the distance you are from the pit. <br/><br/>Here I show one optimal path! #SoME1<br/><br/>Timestamps:<br/>0:00 - Introduction & Question<br/>0:52 - Total Time: Cartesian Coordinates<br/>1:23 - Total Time: Polar Coordinates<br/>3:07 - Euler Lagrange / Beltrami Identity<br/>3:41 - Solve for r<br/>5:15 - Graph r<br/>6:05 - MATLAB optimization confirmation<br/><br/>MATLAB code below:<br/>clc; clear all; close all;<br/><br/>%% Calculations<br/><br/>%create empty history file<br/>history= struct('x',[],'fval',[]); % create the structure with empty fields<br/>history(1)= []; % create the empty structure array with the specified fields<br/>save('history.mat');<br/><br/>%enter in start and end positions<br/>start_radii = 1;<br/>end_radii = 3;<br/><br/>%enter number of points<br/>n = 30;<br/>d_theta = pi/(n-1);<br/><br/>objective = @(x) sum(sqrt( diff(x).^2 + x(1:end-1).^2 .* d_theta^2 ) ./ x(1:end-1));<br/>x0 = [start_radii 0.2*ones(1,n-2) end_radii];<br/>A = [];<br/>b = [];<br/>Aeq = [];<br/>beq = [];<br/>lb = [start_radii zeros(1,n-2) end_radii];<br/>ub = [start_radii Inf(1,n-2) end_radii];<br/>nonlcon = [];<br/>options = optimoptions(@fmincon,'OutputFcn',@outfun2);<br/><br/>[x,fval,~,output] = fmincon(objective,x0,A,b,Aeq,beq,lb,ub,nonlcon,options);<br/>rho = x;<br/>theta = linspace(0,pi,n);<br/>[x,y] = pol2cart(theta,rho);<br/><br/>set(gcf, 'Position',  [100, 100, 1600, 900], 'color', 'w')<br/>plot(x,y,'-o') %plot of optimal path<br/><br/><br/>%% Video<br/><br/>load('history.mat');<br/>[m, num_iterations] = size(history);<br/>figure()<br/>set(gcf,'renderer','painters')<br/>for i = 1:num_iterations<br/>rho = history(i).x; %each iteration of rho<br/>theta = linspace(0,pi,n);<br/>[x,y] = pol2cart(theta,rho);<br/><br/>    set(gcf, 'Position',  [100, 100, 1600, 900], 'color', 'w')<br/>    plot(x,y,'-o')<br/>    grid on<br/>    xlabel('x')<br/>    ylabel('y')<br/>%     title('Beam Animation')<br/>    xlim([-end_radii-1 start_radii+1])<br/>    ylim([0 2*max(start_radii,end_radii)]);<br/><br/>    movieVector(i) = getframe(gcf);<br/>end<br/><br/>myWriter = VideoWriter('Math_puzzle_optimal_path_video');<br/>myWriter.FrameRate = 5;<br/>open(myWriter);<br/>writeVideo(myWriter, movieVector)<br/>close(myWriter)<br/><br/>%% Functions<br/><br/>%For movie: saves iterates in separate history file<br/>function stop = outfun2(x,optimValues,state)<br/>    stop = false;<br/>    load('history.mat','history');<br/>    history(end+1)= struct('x',x,'fval',optimValues.fval);<br/>    save('history.mat');<br/>end<br/>  <br/>  <br/>  <br/>    <br/>      Chapters<br/>      <br/>    <br/>  <br/>  <br/>  <br/>  <br/>  <br/>  <br/>  View all<br/><br/><br/>  <br/>  <br/><br/><br/>  <br/>    <br/>       <br/>    <br/>    <br/>  <br/>  <br/>    <br/>  <br/>  <br/>      <br/>  <br/>  <br/>    Introduction & Question<br/>    0:00<br/>  <br/><br/><br/><br/><br/>  <br/>  <br/>      <br/>  <br/>  <br/>    Total Time: Cartesian Coordinates<br/>    0:52<br/>  <br/><br/><br/><br/><br/>  <br/>  <br/>      <br/>  <br/>  <br/>    Total Time: Polar Coordinates<br/>    1:23<br/>  <br/><br/><br/><br/><br/>  <br/>  <br/>      <br/>  <br/>  <br/>    Euler Lagrange / Beltrami Identity<br/>    3:07<br/>  <br/><br/><br/><br/><br/>  <br/>  <br/>      <br/>  <br/>  <br/>    Solve for r<br/>    3:41<br/>  <br/><br/><br/><br/><br/>  <br/>  <br/>      <br/>  <br/>  <br/>    Graph r<br/>    5:15</span>\n</div>\n<div class='action-container flex justify-between'>\n<button aria-expanded='false' aria-label='Read more description' class='rp-full-description' type='button'>\n<i class='fai fa-solid fa-align-left'></i>\n<span id='read_more'>Read More</span>\n</button>\n<div class='rp-report'>\n</div>\n</div>\n<div aria-labelledby='resource-details-heading' class='rp-info-section'>\n<h2 class='title' id='resource-details-heading'>Resource Details</h2>\n<div class='rp-resource-details clearfix'>\n<div class='detail'>\n<dl>\n<dt>Curator Rating</dt>\n<dd><span class=\"star-rating\" aria-label=\"4.0 out of 5 stars\" role=\"img\"><i class=\"fa-solid fa-star text-action\" aria-hidden=\"true\"></i><i class=\"fa-solid fa-star text-action\" aria-hidden=\"true\"></i><i class=\"fa-solid fa-star text-action\" aria-hidden=\"true\"></i><i class=\"fa-solid fa-star text-action\" aria-hidden=\"true\"></i><i class=\"fa-regular fa-star text-action\" aria-hidden=\"true\"></i></span></dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt class=\"educator-rating-title\">Educator Rating</dt><dd><div class=\"educator-rating-details\" data-path=\"/educator_ratings/rrp_data?resourceable_id=202483&amp;resourceable_type=Boclips%3A%3AVideoMetadata\"><span class=\"not-yet-rated\">Not yet Rated</span></div></dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Media Length</dt>\n<dd>6:35</dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Grade</dt><dd title=\"Grade\">Higher Ed</dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Subjects</dt><dd><span><a href=\"/search?keywords=databases&amp;page=42&amp;search_tab_id=1&amp;subject_ids%5B%5D=365221\">Science</a></span></dd><dd class=\"text-muted\"><i class=\"fa-solid fa-lock mr5\"></i>4 more...</dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Media Type</dt><dd><span><a href=\"/search?keywords=databases&amp;page=42&amp;search_tab_id=2&amp;type_ids%5B%5D=4543647\">Instructional Videos</a></span></dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Source:</dt>\n<div class='preview-source' data-animation='true' data-boundary='.rp-info' data-container='.rp-resource-details' data-html='false' data-title='This channel is dedicated to teaching math, physics and engineering.' data-trigger='hover focus'>\n<span>Virtually Passed</span>\n<i aria-hidden='true' class='fa-solid fa-circle-info channel-tooltip-icon' id='channel-tooltip'></i>\n</div>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Date</dt>\n<dd>2021</dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<i aria-hidden='true' class='fai fa-solid fa-language'></i>\n<dt>Language</dt><dd>English</dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Audiences</dt><dd><span><a href=\"/search?audience_ids%5B%5D=371079&amp;keywords=databases&amp;page=42&amp;search_tab_id=1\">For Teacher Use</a></span></dd><dd class=\"text-muted\"><i class=\"fa-solid fa-lock mr5\"></i>2 more...</dd>\n</dl>\n</div>\n<div class='detail'>\n<dl>\n<dt>Usage Permissions</dt><dd>Fine Print: Educational Use</dd>\n</dl>\n</div>\n</div>\n</div>\n<div aria-labelledby='additional-materials-heading' class='rp-info-section'>\n<h2 class='title' id='additional-materials-heading'>Additional Materials</h2>\n<div class='additional-material'>\n<i aria-hidden='true' class='fai fa-solid fa-lock'></i>\n<a class=\"text-muted\" title=\"Video Transcript\" data-html=\"true\" data-placement=\"bottom\" data-trigger=\"click\" data-content=\"<div class=&quot;text-center py-2&quot;><a class=&quot;bold&quot; href=&quot;/auth/users/sign_in&quot;>Sign in</a> or <a class=&quot;bold text-danger&quot; data-posthog-event=&quot;Signup: LP Signup Activity&quot; data-posthog-location=&quot;body_link_boclips&quot; data-remote=&quot;true&quot; href=&quot;/subscription/new&quot;>Join Now</a></div>\" data-title=\"Get Full Access\" data-container=\"body\" rel=\"popover\" tabindex=\"0\" href=\"/subscription/new\">Video Transcript</a>\n</div>\n<div class='additional-material'>\n<i aria-hidden='true' class='fai fa-solid fa-lock'></i>\n<a class=\"text-muted\" title=\"Video Preview\" data-html=\"true\" data-placement=\"bottom\" data-trigger=\"click\" data-content=\"<div class=&quot;text-center py-2&quot;><a class=&quot;bold&quot; href=&quot;/auth/users/sign_in&quot;>Sign in</a> or <a class=&quot;bold text-danger&quot; data-posthog-event=&quot;Signup: LP Signup Activity&quot; data-posthog-location=&quot;body_link_boclips&quot; data-remote=&quot;true&quot; href=&quot;/subscription/new&quot;>Join Now</a></div>\" data-title=\"Get Full Access\" data-container=\"body\" rel=\"popover\" tabindex=\"0\" href=\"/subscription/new\">Video Preview</a>\n</div>\n</div>\n<div aria-labelledby='concepts-heading' class='rp-info-section'>\n<h2 class='title' id='concepts-heading'>Concepts</h2>\n<div class='clearfix'>\n<div class='details-list concepts' data-identifier='Boclips::VideoDecorator628c91f3d043bc37da2a991c' data-type='concepts'>speed</div>\n<div class='concepts-toggle-buttons' data-identifier='Boclips::VideoDecorator628c91f3d043bc37da2a991c'>\n<button aria-expanded='false' class='more btn-link' type='button'>\n<span>Show More</span>\n<i aria-hidden='true' class='fa-solid fa-caret-down ml5'></i>\n</button>\n<button aria-expanded='true' class='less btn-link' style='display: none;' type='button'>\n<span>Show Less</span>\n<i aria-hidden='true' class='fa-solid fa-caret-up ml5'></i>\n</button>\n</div>\n</div>\n</div>\n<div aria-labelledby='additional-tags-heading' class='rp-info-section'>\n<h2 class='title' id='additional-tags-heading'>Additional Tags</h2>\n<div class='clearfix'>\n<div class='details-list keyterms' data-identifier='Boclips::VideoDecorator628c91f3d043bc37da2a991c' data-type='keyterms'>mathematics, math puzzle, brachistochrone, optimization, pit center, starting position, finished position, hand side, square root, optimal path, path, curve, theta, expression, constant, find, start, finish, minimize, 1 meter, solve, equal, integrating, case, written, plug, call, dash, integrate, minimized, long, satisfies, result</div>\n<div class='keyterms-toggle-buttons' data-identifier='Boclips::VideoDecorator628c91f3d043bc37da2a991c'>\n<button aria-expanded='false' class='more btn-link' type='button'>\n<span>Show More</span>\n<i aria-hidden='true' class='fa-solid fa-caret-down ml5'></i>\n</button>\n<button aria-expanded='true' class='less btn-link' style='display: none;' type='button'>\n<span>Show Less</span>\n<i aria-hidden='true' class='fa-solid fa-caret-up ml5'></i>\n</button>\n</div>\n</div>\n</div>\n<div aria-labelledby='classroom-considerations-heading' class='rp-info-section'>\n<h2 class='title' id='classroom-considerations-heading'>Classroom Considerations</h2>\n<div class='classroom-considerations'><div class='fai fa-solid fa-bell'></div>Video is ad-free</div> \n</div>\n<div aria-labelledby='educator-ratings-heading' class='rp-info-section'>\n<h2 class='title sr-only' id='educator-ratings-heading'>Educator Ratings</h2>\n<div id=\"educator-ratings-root\"></div><div id=\"all-educator-ratings-root\"></div><div id=\"educator-rating-form-root\"></div>\n</div>\n</div>\n<div class='rp-resource'>\n<div aria-label='Show resource details' class='rp-show-info' role='button' tabindex='0'>\n<i class='fai fa-solid fa-align-left'></i>\nShow resource details\n</div>\n<div aria-label='Video player' class='player ie' id='player-wrapper' role='region'>\n<div class='relative container mx-auto' id='lp-boclips-visitor-thumbnail'>\n<a class=\"block\" data-html=\"true\" data-placement=\"bottom\" data-trigger=\"click\" data-content=\"<div class=&quot;text-center py-2&quot;><a class=&quot;bold&quot; href=&quot;/auth/users/sign_in&quot;>Sign in</a> or <a class=&quot;bold text-danger&quot; data-posthog-event=&quot;Signup: LP Signup Activity&quot; data-posthog-location=&quot;body_link_boclips&quot; data-remote=&quot;true&quot; href=&quot;/subscription/new&quot;>Join Now</a></div>\" data-title=\"Get Full Access\" data-container=\"body\" rel=\"popover\" tabindex=\"0\" aria-label=\"Play video: Optimal Path Around Quicksand - Math Puzzle (HARD)\" href=\"/subscription/new\"><img class=\"resource-img img-thumbnail img-responsive z-10 lp-boclips-thumbnail w-full h-full lozad\" alt=\"Optimal Path Around Quicksand - Math Puzzle (HARD)\" title=\"Optimal Path Around Quicksand - Math Puzzle (HARD)\" onError=\"handleImageNotLoadedError(this)\" data-default-image=\"https://static.lp.lexp.cloud/images/attachment_defaults/resource/large/missing.png\" data-src=\"https://cdnapisec.kaltura.com/p/1776261/thumbnail/entry_id/1_vj3nua53/width/250/vid_slices/3/vid_slice/1\" width=\"315\" height=\"220\" src=\"data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs\" />\n<span aria-hidden='true' class='flex justify-center items-center bg-white rounded-full w-16 h-16 absolute top-1/2 left-1/2 -mt-8 -ml-8 cursor-pointer z-0 border-2 border-primary drop-shadow-md lp-boclips-thumbnail-playBtn'>\n<i class='fa-solid fa-play text-primary text-3xl ml-1 drop-shadow-xl'></i>\n</span>\n</a></div>\n</div>\n</div>\n</div>\n</div>\n</div>\n"}