Solving Newton interpolation with c

Click For Summary

Discussion Overview

The discussion revolves around implementing Newton interpolation in C programming. Participants share their experiences and challenges in translating a manual solution into code, with specific input formats and expected outputs related to evaluating the sine function.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses confusion about starting their program for Newton interpolation after solving it manually, providing specific input and output requirements.
  • Another participant clarifies the meaning of e1, e2, and em as the evaluation points from the input.
  • Several participants discuss the availability and licensing issues of the "Numerical Recipes" book, noting that the code is not freely available and has restrictive terms regarding its use.
  • Concerns are raised about the licensing terms that prevent sharing or modifying the code from the book, with some participants sharing anecdotes about past controversies surrounding it.
  • There is mention of alternative resources, such as the GNU Scientific Library (GSL), which is suggested as a free option for similar algorithms.
  • One participant comments on the quality of explanations in "Numerical Recipes," despite the issues with code availability, suggesting it can still be a useful reference for understanding algorithms.

Areas of Agreement / Disagreement

Participants generally agree on the challenges related to the licensing of "Numerical Recipes" and the availability of its code. However, there is no consensus on the best approach to take for implementing Newton interpolation in C, as the original poster is still seeking help with their specific programming issue.

Contextual Notes

Participants highlight limitations regarding the availability of code and the restrictive licensing terms of "Numerical Recipes," which may affect their ability to implement the algorithms discussed. There are also references to the historical context of C compilers and array indexing that may influence coding practices.

Who May Find This Useful

This discussion may be useful for students or programmers interested in numerical methods, particularly those looking to implement interpolation techniques in C, as well as those exploring resources for scientific computing.

dabillionaire
Messages
2
Reaction score
0
Hi,

i have no idea how to start up my program on Newton interpolation. i have solved it manually but I am clueless on how 2 start my program. below represnts the input which i want 2 solve. every 4 lines represnts one problem. the 1st line- n,m where n is no of data points and m is no of evaluation pts. 2nd and 3rd line represent x and y of n pts. 4th line is m @ which it is to be evaluated. the function is sinx. can anyone help me out??


3 2
0.1 0.4 0.5
3.1 3.2 4.1
1.5 1.6
3 5
1.0 2.0 3.0
1.7 1.8 1.1
1.1 1.2 1.4 1.3 1.8
15 5
0.1 0.4 0.5 1.2 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.95
3.1 3.2 4.1 2.7 1.9 1.7 1.8 1.1 1.7 1.8 1.1 1.7 1.8 1.1 2.3
1.0 1.2 1.6 2.0 2.5

ma output is supposed to be in d form

e1 fN(e1)
e2 fN(e2)
.
.
em fN(em)
 
Technology news on Phys.org
e1, e2 and em represent the fourth line of each problem
 
Numerical recipes ( http://www.nr.com/ ) is the classic book on doing this sort of thing.
The code is available online for free. The book is sometimes available depending on what they feel like that day.

You can usually pick up the older editions of the Fortran/Pascal or C versions cheaply.
 
mgb_phys said:
Numerical recipes ( http://www.nr.com/ ) is the classic book on doing this sort of thing.
The code is available online for free.
Is it?? They have the most restrictive terms for its code one can find for a book. Is the code for the old version now free (in whatever sense)? I can't find it on their website, only links to buy its code cd-rom.

The book is sometimes available depending on what they feel like that day.
LMAO. How true, how true. :smile:
 
It's not there anymore, sometimes you can read the whole book online, sometimes you can download the code - they are an amazing bunch.

The license for the code used to say something like -
"you can't copy this code from the disk, you can type it out of the book but you can't change anything. We own the copyright on the algorithms - you can't use the algorithms and change the code."

There was a bunch of lecturers who boycotted the book and lobbyed CUP to stop publishing it. It would be a bit embarrasing when CUP would have to sue the Cambridge University Library.
 
Yeah. It was noted in an http://www.accu.org/" review of the 2nd edition C version that one can't even typed the code into one's own computer if you didn't own the book. i.e. you got it out of the library / workplace etc.

The 2nd edition C version said:
* You can type the programs from this book directly into your computer. In this case, the only kind of license available to you is the free "immediate license" (see below). You are not authorized to transfer or distribute a machine-readable copy to any other person, nor to have any other person type the programs into a computer on your behalf. ...
* ["Immediate License"] If you are the individual owner of a copy of this book and you type one or more of its routines into your computer, we authorize you to use them on that compuerter for your own personal and noncommercial purposes. You are not authorized to transfer or distribute machine-readable copies to any other person, or to use the routines on more than one machine, or to distribute executable programs containing our routines. This is the only free license.

So you have to own the book, you're not allowed to have another person type the code in for you. It's only available for personal use, and only on 1 computer each time you type the code in, specifically the one you typed the code in on. If you want to use the code (for personal use) on more than one computer, you have to type it in each time.
 
Last edited by a moderator:
And worst of all they have the C arrays start from 1 (or they do in my 1988 'C' edition)
 
There were some weird C compilers back in early DOS days that used something called an option-base setting, defined in a header file: 0 = normal C; 1= arrays start at 1 like BASIC. I don't know why.

Since everything in Numerical Recipes is available thru the GNU Scientific library, just pitch the damn thing. GSL is free.
 
I think my 'C' edition was a too close copy of the Fortran one.

The explanations of the algorithms are still quite good. Even if you are going to use NAG or GSL it's a good first place to look for which algorithm you should use and what the problems might be.
 

Similar threads

  • · Replies 41 ·
2
Replies
41
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • Poll Poll
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
Replies
4
Views
4K
  • Poll Poll
  • · Replies 5 ·
Replies
5
Views
13K