Click here to Skip to main content
15,885,737 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi how i can calculate the amount of x up to 4 digits after decimal? p , q , r , s ,t , u are the inputs of problem
( 0<=x<=1 and we know this function in 0<=x<=1 is descending)
p×e^(-x)+q×sin(x)+r×cos(x)+s×tan(x)+t×x^2+u=0

please help me.
thanks alot.
Posted
Updated 29-Mar-15 19:46pm
v2
Comments
Sergey Alexandrovich Kryukov 30-Mar-15 1:17am    
The question makes no sense. If you are asking "how to do X", you should not tell us using what? Surprised?
Now, there is no "divide and conquer approach", as a technical term. It's nonsense in the following sense: you always "divide and conquer", to certain degree; so this is the talk about nothing. Anyway, What have you tried so far?
—SA

1 solution

At first this is a mathematical issue: this function isnt linear and has other dificulties. So D&C isnt a solution but part of the problem :-O

If your are looking for a 4-digit solution, I would ran a big loop like this:
Meta code:
C++
float results[10000];
int n = 0;
for( float step = 0; i < 1; i+=0.00001 )
{
   results[n] = callProblem( i );
}
//take a look on the sample


some divide and conquer approach

C++
float x = 0;
float diff = 1;//Startvalue
while( )
{
   result = callProblem(x);

  if( result > 0 )
{
x -= diff;
diff = diff/2;
result = callProblem(x);
}
else
{
x += diff;
diff = diff/2;
result = callProblem(x);
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900