Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2019-10-12 11:17:01

Hannibal lecter
Member
Registered: 2016-02-11
Posts: 392

robot calculation

calculation to compute    the time that a robot requires to retrieve an item from rocky terrain


enter Distance to item along x-axis

enter Distance to item along y-axis

enter Length of segment
     
  enter Speed along segment 1
     
  enter Speed along segment 2
   

  segment1Time = segment1Length / segment1Speed;
  segment2Length = (xDistance)^2  + (yDistance - segment1Length)^2
  segment2Time = segment2Length / segment2Speed;

    totalTime = segment1Time + segment2Time;

how can that program devide length over speed to get time!!?
can anyone give me an explanation of this program please and what is the meaning of segment 1 or 2 ?
I provided the output of the program and I assumed arbitrary values but I don't know is the speed in km/h or the distance in mile
and I don't know the time is seconds or minutes the program is without units ... see the following photo :-

2019-10-13-021918.jpg

Last edited by Hannibal lecter (2019-10-12 11:21:20)


Wisdom is a tree which grows in the heart and fruits on the tongue

Offline

#2 2019-10-13 06:12:46

Bob
Administrator
Registered: 2010-06-20
Posts: 10,053

Re: robot calculation

Well, that was a challenge!  You have only posted part of the problem.  Luckily, with the help of my friend Mr Google, I have found where this problem comes from.  For members who want to see it here's the link:


http://bcs.wiley.com/he-bcs/Books?actio … indow=true

So, I'll answer the easy question first.  The distances are in kilometres (Km) and the times in hours h. 

Let's say that the road runs South-North and the item is off road to the East.  The robot can travel more quickly along the road but must eventually head off road to get to the item.

Is it best (1) to go along the road until we are alongside the item and then cut across with the shortest off-road distance?  Or maybe it is better to (2) leave the road at the start and just head diagonally across the rough terrain taking the straight line shortest route?  Or (3) go part by road and then cut across diagonally.

If the cross country speed is the same as the road speed then (2) is best.  If the road speed is a lot quicker than the rough terrain, then (1) is best.  Finding the optimum choice requires that we know the distances and speeds involved.

A speed is measured in kilometres per hour (Km/h) so there is a simple formula connecting distance, speed and time:

speed = distance / time

For example if the robot can travel 14 Km in 2 hours the its speed is 14/2 Km/hour = 7Km/h

If we know the speed and time then we can compute the distance with

distance = speed x time

eg.  If speed = 7 and time = 2 the distance = 14

And if we know the distance and speed we can compute the time with

time = distance / speed

eg.  if distance = 14 and speed = 7 then time = 14/7 = 2

In the problem segment 1 is the distance along the road.  If the road speed is segment1speed then the time is found by dividing the distance by the speed:

time for this = (segment1distance)/(segment1speed)

The cross country part is harder to calculate as it is along a diagonal line.

The easterly amount is just 'x' as we haven't done any travel in an easterly direction yet.

But we have already done segment1distance in a northerly direction so we can subtract this amount from 'y' .

Then use Pythagoras theorem to calculate the diagonal

Note: in your post you left out the square root!

Then dividing that by the speed (rough terrain) gives the time for that part.

Adding them gives the total time.

Once you have a program for calculating this total you can try different values for segment1distance and so find the lowest time.

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#3 2019-10-13 10:36:28

Hannibal lecter
Member
Registered: 2016-02-11
Posts: 392

Re: robot calculation

in past was 1% of knowing the problem
but I understand it now 80% because of you I have problems with Pythagoras theorem only

how did you analyse and understand this problem? what did you do?
from where did you get this experience ?  I thought you are expert in math only not in programming


Wisdom is a tree which grows in the heart and fruits on the tongue

Offline

#4 2019-10-13 19:56:14

Bob
Administrator
Registered: 2010-06-20
Posts: 10,053

Re: robot calculation

To calculate the second time you need the length of segment2.  Look at the diagram.  It is the hypotenuse of a right angled triangle so Pythag seemed obvious to me.  Even before I saw the diagram I thought Pythag would be involved because of this:

segment2Length = (xDistance)^2  + (yDistance - segment1Length)^2

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#5 2019-10-14 00:22:18

Hannibal lecter
Member
Registered: 2016-02-11
Posts: 392

Re: robot calculation

may you draw a graph for me illustrate this ?


Wisdom is a tree which grows in the heart and fruits on the tongue

Offline

#6 2019-10-14 00:37:10

Bob
Administrator
Registered: 2010-06-20
Posts: 10,053

Re: robot calculation


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

Board footer

Powered by FluxBB