473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

False Position Method

11
This is the program i made for calculating a root for false position method using initial guesses. But i can't seem to may it work and i cant find the error on it...
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<iomanip>
  4. #include<cmath>
  5. #include<string>
  6. using namespace std;
  7.  
  8.  
  9.  
  10.  
  11. void falsi(double& fd, double& fu, double& fr, double d, double u, double r)
  12. {
  13. fd=sin(d)+cos(1+d*d)-1;
  14. fu=sin(u)+cos(1+u*u)-1;
  15. r=((u*fd - d*fu) / (fd - fu));
  16. fr=sin(r)+cos(1+r*r)-1;
  17. }
  18.  
  19. void eq(double x, double y)
  20. {
  21. int i;
  22. double fd,fu,fr,u,d,r;
  23. x*=1;
  24. y*=1;
  25. cout<<"The value of Xd=1 and Xu=2\n";
  26. for (i=4;i<5;i++)
  27. {
  28. falsi(fd,fu,fr,d,u,r);
  29. if (fr > 0 && fd > 0)
  30. {
  31. r = d;
  32. }
  33. else
  34. {
  35. r = u;
  36. }
  37.  
  38. int main()
  39. {
  40.  
  41. char z;
  42. cout<<"choose letter a, b, or c";
  43. cin>>z;
  44. if (z=='a')
  45. {
  46. eq(1,2);
  47. }
  48. else if (z=='b')
  49. {
  50. eq(1,2.5);
  51. }
  52. else
  53. {
  54. eq(1,1.5);
  55. }
Aug 16 '07 #1
0 2069

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Tom | last post by:
Hi, In the following code I have reproduced a problem in IE that is extremely annoying for my application. <html> <head> <script type="text/javascript">
3
by: Aamir Ghanchi | last post by:
How can I set the DefaultValue property of DataColumn to false in C# this.objdsMyDataSet.tblMyTable.MyBooleanColumn.DefaultValue = false; I have also tried setting it to...
2
by: Senthil | last post by:
Hi, The need is to read each line in a text file and based on the read data decision has to be taken whether to reposition the file pointer. The StreamReader.Position does not give current...
0
by: Martin Colmenares | last post by:
After I set my <%@ page ValidateRequest="false" %> , I still get the error illustrated below. The msdn mentioned something about filtering using the HTMLEncode. This is a snippet of the code that...
0
by: mehul | last post by:
CheckBox template always evaluate to False even if checked in a DataGrid hosted inside a TabStrip in ASP.NET Hi, I am trying to develop an ASP.NET application. I am using TabStrip (which is...
5
by: Diego Mijelshon | last post by:
I've been debugging an issue we have in an asp.net 2.0 application for several days. The initial report of the bug was that, after waiting for some minutes with an open page, entering a number...
4
by: BrianKE | last post by:
I am attempting to create an app that will run "on top" of another app. My app will create a transparent window over the other app for the purpose of displaying information. I am able to create...
2
by: teo | last post by:
I have a Listbox, if I set EnableViewStarte = False the AutopostaBack fired by SelectedIndexChanged doesn't work. The 'SelectedIndexChanged' event should call
3
by: mismis | last post by:
hi..tnx guys 4 helping me out wrte my program regarding the bisection mthod.. but, ds time can i hav anothr favor?..plss...how to write a progrm using the false position method?..the program asks...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.