Jump to content

need an algrithm


tmcgee94

Recommended Posts

Need an algorithm to approximate the traveling time for a trip. For a shorter trip, under 120 miles time is based on miles, more than 120 miles it is adjusted by 10%

 

define "adjusted by 10%", is it that 10% is an error ?

Link to comment
Share on other sites

the algorithm is simple then,

 

IF [math]DISTANCE < 120[/math] THEN [math]TIME = \frac{DISTANCE}{SPEED}[/math]

 

ELSE [math]TIME = [ \frac{DISTANCE}{SPEED} - \epsilon \; , \; \frac{DISTANCE}{SPEED} + \epsilon ][/math] END

 

.. where [math]\epsilon \; = \; 0.1 \times \frac{DISTANCE}{SPEED}[/math],

Edited by khaled
Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.