Google Answers Logo
View Question
Q: 3D Polynomial Fit, PART 2 (for Tox) ( Answered 5 out of 5 stars,   0 Comments )
Subject: 3D Polynomial Fit, PART 2 (for Tox)
Category: Science > Math
Asked by: larman-ga
List Price: $35.00
Posted: 14 Jun 2004 12:41 PDT
Expires: 14 Jul 2004 12:41 PDT
Question ID: 360976
As this is a "part 2" question, I would prefer that Tox answer it. If
it is still unanswered in 48 hours, someone else may answer.

This is another piece that goes with the quartic fit algorithm. I have
two cords represented as Java double, like this:

double c1 = 10;
double c2 = 20;

I would like a simple method that interpolates 29 cords between c1 and
c2. Then, I would like those cords returned as an array of Java
double, including the first and second cord. This should result in a
double array of length 31, containing evenly spaced cords. Like this:

results[0]= the value of c1
results[1] = interpolated val 1
results[2] = interpolated val 2
results[3] = ... you get the idea ..
results[29] = interpolated val 29
results[30] = the value of c2

Satisfactory results would be sample Java code, or an easily implementable formula.

As usual, a generous tip will be included :)



Request for Question Clarification by tox-ga on 14 Jun 2004 13:26 PDT
Hi larman,

Thank you very much for the honor of requesting me as your researcher.
 I'd be glad to answer this question for you.  I have the code for you
but I am not at home, where I would be able to upload it to a seperate
site.  Unless you specify otherwise, I will assume that you would
prefer the source uploaded to my own host and linked from this answer
page so that I could take it down once you have it.  I will be home in
about 6 hours (7-8 PM PST) so I will be able to give you the answer
then at the very latest.  If, however, you would like the code before
then, and don't mind the source being publicly available, I can answer
your question now.


Clarification of Question by larman-ga on 14 Jun 2004 13:51 PDT
Great, I knew this one would be a piece of cake compared to the laste
problem. Plz go ahead and post the url on your private host. I'll
Download and respond on the site so you can remove it.

Thanks again, and cheers!

Subject: Re: 3D Polynomial Fit, PART 2 (for Tox)
Answered By: tox-ga on 14 Jun 2004 19:43 PDT
Rated:5 out of 5 stars
Hi LarMan!

Thank you again for requesting me as your researcher.

Here is your program:

In addition to the method you asked for:
  public static double[] interpolate(double pointA, double pointB)
I have also included a main function which will allow you to easily
test the function from the command-line by compiling and entering
java Interpolator c1 c2

I have made an effort to comment the code to make it very easily
understandable but if there is anything you would like clarification
on, or any changes made to the program, please feel free to ask.

Just post a clarification once you've grabbed the source and I'll take it down.


Request for Answer Clarification by larman-ga on 14 Jun 2004 21:10 PDT
Got it, thanks again Tox. Great work.

Clarification of Answer by tox-ga on 14 Jun 2004 22:55 PDT
Alright, I've taken it down.  Thank you very much for the generous tip
and rating.  It is much appreciated!

larman-ga rated this answer:5 out of 5 stars and gave an additional tip of: $15.00
Tox comes through again.. Solved in minutes. The guy is a pro.

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy