Too few arguments error around lines 29 and 32 - #include <stdio.h>
-
#include <stdlib.h>
-
#include <math.h>
-
double f(double a, double b, double c, double x)
-
{
-
return pow(x,3)+a*pow(x,2)+b*x+c;
-
}
-
double fp(double a, double b, double c, double x)
-
{
-
return 3*pow(x,2)+(2*a*x)+b+0*c;
-
}
-
double newton(double a, double b, double c, double x)
-
{
-
return x - (f(a,b,c,x)/fp(a,b,c,x));
-
}
-
int main()
-
{
-
double a,b,c,x1,x2;
-
int i;
-
char *input = getenv("QUERY_STRING");
-
sscanf(input, "coeff1=%lf &coeff2=%lf &coeff3=%lf &x=%lf", &a, &b, &c, &x1);
-
if (fp(x1)==0.0)
-
{
-
printf("No convergence.\n");
-
return 0;
-
}
-
for (i=0;i<100;i++)
-
{
-
x2=newton(x1);
-
if (fabs(x1-x2)<= pow(10,-10)) break;
-
x1=x2;
-
}
-
printf("iteration = %d\n", i);
-
printf("x= %lf\n", x1);
-
return 0;
-
}
0 938 Sign in to post your reply or Sign up for a free account.
Similar topics
by: vegetax |
last post by:
if i have a dictionary:
d = {'a':2,'b':3 }
l = (1,2)
how can i pass it to a generic function that takes variable keywords as
arguments? same thing with variable arguments, i need to pass a list...
|
by: Alex Vinokur |
last post by:
Is there any tool to count C-program lines except comments?
Thanks,
=====================================
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html...
|
by: slogging_away |
last post by:
Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) on win32, and have a script that makes numerous checks
on text files, (configuration files), so discrepancies can be reported.
The script...
|
by: horizon5 |
last post by:
Hi,
my collegues and I recently held a coding style review.
All of the code we produced is used in house on a commerical project.
One of the minor issues I raised was the common idiom of...
|
by: dtshedd |
last post by:
I am having trouble with arguments in a javascript routine. What I am
trying to do is to limit the size of numbers to ten digits but make use
of the significant places if the number is less than...
|
by: VK |
last post by:
I was getting this effect N times but each time I was in rush to just
make it work, and later I coudn't recall anymore what was the original
state I was working around. This time I nailed the...
|
by: Pavan |
last post by:
Hi, I want to know if there is any software for measuring lines of
code of my c++ application.
I found out a tool, sloccount, but it gives only physical lines of
code.
I found out one more...
|
by: DrVitoti |
last post by:
On that program the compiler says "parse error" on line 8, 10, 12 and 21, it also says "too many arguments" on lines 10, 12 and finally it says "at this port in" on lines 13, 14, 20 . How could I...
|
by: vivek |
last post by:
Hi
i have used some debug macro and called several times(hundreds) in
the code.
The purpose of the macro was to print the values at that time to the
screen
Now that i have finished...
|
by: pauldepstein |
last post by:
Let double NR( double x, double(*)(const double&) f ) be the
signature of a Newton-Raphson function NR.
Here, f is a function which returns a double and accepts a const
double&. The aim of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |