# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Find the location of a signpost with given distances to a set of cities

Contributed by:
Sander Huisman

ResourceFunction["WorldTravellerSignpostSolve"][{{ given the locations |

The algorithm finds the location *p* for which the sum of distance errors (distance from *p* to *loc*_{i} minus *dist*_{i}) squared is minimized:
∑i=1n(||p-*loc*_{i}||-*dist*_{i})^{2}
All locations *loc*_{i} are included in the calculation. The error between the distance from *p* to *loc*_{i} and *dist*_{i} can be anything such that even crude values will give a satisfactory answer. In general the crudeness/precision of the distances given gives the precision of the found location.

Given a set of cities and their distance, what is the location of the signpost:

In[1]:= |

Out[2]= |

Numbers are interpreted as kilometers:

In[3]:= |

Out[4]= |

Given the signpost, find the location:

In[5]:= |

Out[6]= |

Find the country:

In[7]:= |

Out[7]= |

Visualize the lines and the found minimum:

In[8]:= |

Out[8]= |

Investigate the effect of the precision of the distances on the final location. Given a location, and some random cities, find the estimates for 'rounded' distances:

In[9]:= |

Out[10]= |

Plot the error in the location as a function of the rounding:

In[11]:= |

Out[11]= |

We see that the error in the location is much better than the errors introduced by rounding.

- 1.0.0 – 19 May 2023

This work is licensed under a Creative Commons Attribution 4.0 International License