Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:16:30+00:00 2026-05-13T06:16:30+00:00

I am writing a program in C. I want to find a solution by

  • 0

I am writing a program in C. I want to find a solution by minimizing expression

D1+D2+......+Dn

where Di’s are distances calculated by distance formula between 2 points. The above expression is in x & y variables

Now I will differentiate this expression and find the solution. My doubt is:

since in the above expression, all Di’s will occur as square roots which will be difficult to solve. So instead we can solve for this expression:

D1^2 + D2^2 + ......+ Dn^2

Will the answer produced by the above expression will be same as that would have been produced by solving the original one?

I have checked for simple test cases such as n=2. It produces the correct answer. Is it true in general?

If not, how this problem can be solved?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:16:31+00:00Added an answer on May 13, 2026 at 6:16 am

    Even for 2d distances, it is not in general true that the minimum of a^2 + b^2 is at the same location as the minimum of a + b. It may be true for some very specific limited set of problems, of course. If you’re trying to find a counterexample, note that the squares overpenalize long distances; if you construct an example with a minimum containing at least one long distance, you’ve a good chance that the sum of squares has a different minimum.

    What is the problem you are trying to solve? It’s quite possible that for your problem the distinction doesn’t matter, of course; or that the minimum of the sum of squares is a cheaper problem and an easier first approximation to a final solution.

    It may be obvious, but if the various distances are unrelated, then for each individual distance the square is minimal when the distance is and thus the sum of unrelated distances is minimal where the sum of the squares is.

    Edit Post update: You’re trying to find a centroid with the limitation that it lies on a particular line. In general outlines then: you’ve only one degree of freedom, and you can do plain differentiation. However, the result will have a sum of fractions with sqrt in the denominator; solving that algebraically in the general case isn’t possible (AFAIK). I’m not 100% positive, but I think you’re in luck in that your distance-sum has no local minimum except the global one; in that case newton’s method will converge reliably and fast.

    So, if you can verify the assumption that there is only one local minimum, you’re home free, and even if you can, you can achieve a pretty good result fairly reliably and detect when it goes wrong simply by comparing your newton-method computed minimum with a few reality check points (say, the orthogonal projection of each point onto the line).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm writing a program to enumerate through processes, and I want to find out
I'm writing a program and I want the user to be able to specify
I'm writing a program that sends an email out at a client's specific local
I am writing a program which has two panes (via CSplitter ), however I
If you are writing a program that is executable from the command line, you
I'm writing a program (for Mac OS X, using Objective-C) and I need to
I'm writing a program to read from a POP3 mailbox and upload the email
I'm writing a program that uses SetWindowRgn to make transparent holes in a window
I am writing a program in Python that will act as a server and
I'm writing a program that contains a generational garbage collector. There are just two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.