473,408 Members | 2,734 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,408 software developers and data experts.

Newton Raphson's Method for solving an equation

Please,I need a program in visual basic to solve the question below:
-By applying Newton Raphson method,find the root of 3x-2tanx=0 given that there is a root between pie/6 and pie/3.Thank you.
Jan 30 '08 #1
4 6768
daniel aristidou
491 256MB
Please,I need a program in visual basic to solve the question below:
-By applying Newton Raphson method,find the root of 3x-2tanx=0 given that there is a root between pie/6 and pie/3.Thank you.
What have you tried by yourself.... we dont hand out programs.... we assist.
Are you new to vb??
Jan 30 '08 #2
Killer42
8,435 Expert 8TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR
Jan 30 '08 #3
Hello. I am also trying to write a program that performs this equation: (f(X) = aX3 + bX2 + cX + d). I am so completely lost, but so far I have this:

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private Sub btncalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalc.Click
  4.         Dim A As Double
  5.         Dim B As Double
  6.         Dim C As Double
  7.         Dim D As Double
  8.         Dim X As New Double
  9.         Dim I As Integer = 0
  10.         Dim Err As Decimal
  11.         Dim intCount As Integer = 0
  12.         Dim Formula As String = ((A * X ^ 3) + (B * X ^ 2) + (C * X + D)) / ((3 * A * X ^ 2) + (2 * B * X + C))
  13.  
  14.         txtA.Text = A
  15.         txtB.Text = B
  16.         txtC.Text = C
  17.         txtD.Text = D
  18.  
  19.  
  20.  
  21.         If Formula < Err Then
  22.  
  23.         Else
  24.             Do While Formula >= Err
  25.  
  26.                 intCount += 1
  27.  
  28.             Loop
  29.             lblroot.Text = Formula
  30.         End If
  31.     End Sub
  32. End Class
  33.  
I have inputs for A,B,C,D and an error limit. I'm trying to get the program to display the root (X), and the number of times it goes through the loop (the number of iterations).

1.a, b, c, and d are four constants that define the equation as shown at the top of the screen image above;
X is the root of the equation;
E is an error limit, typically very small (e.g., 0.000001);
f(X) = aX3 + bX2 + cX + d;
f’(X) = 3aX2 + 2bX + c;

2.Call Xi the current estimate of X, Xi-1 the previous estimate, and Xi+1 the next (improved) estimate of X.

3.If the absolute value of Xi – Xi-1 is less than E you are done.

4.If the absolute value of Xi – Xi-1 is greater than or equal to E, then:
a.Xi-1 = Xi;
b.Xi+1 = Xi – f(Xi) / f’(Xi)
c.Xi = Xi+1
d.go back to step 3.
Mar 18 '08 #4
kadghar
1,295 Expert 1GB
Hello. I am also trying to write a program that performs this equation: (f(X) = aX3 + bX2 + cX + d). I am so completely lost, but so far I have this:
Creating a program that solves any NR is not easy, but this is a simple case, something like this should do:

Expand|Select|Wrap|Line Numbers
  1. dim Res1 as double, Res2 as double
  2. dim Var1 as double, Var2 as double
  3. 'First ask the initial value
  4.     var2 = inputbox("write an initial value")
  5. 'Then evaluate the function in Res1 and the 1st Der in Res2
  6. do
  7.     var1 = var2
  8.     Res1 = a*var1^3 + b*var1^2 + c*var1 + d
  9.     Res2 = 3*a*var1^2 + 2*var1 + c
  10.     var2 = var1 - res1/res2
  11. loop until abs(var1 - var2)< .0000001'or any epsilon you want
  12. msgbox var2
From here im pretty sure you can make many particular cases ^.^
Mar 19 '08 #5

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

Similar topics

2
by: moi | last post by:
Can someone please help with this problem im having. i have to use the newton-raphson technique to find the root of a function, in this case X^2 - 1. basically, the program has to read in values...
7
by: sptutx | last post by:
Write a C program that uses Newton's Method to solve an equation in one variable. Try solving x^x = ln2 the deriviative of x^x is x^x(lnx + 1). The 'ln' function in C is log(), and the...
2
by: JamesUmokoro | last post by:
Please Im writing a project on mathematics here in school. Can someone help me with the source code for solving Numerical Analysis problem with Newton Raphson using Java programming? Thank you all...
11
by: kartikegarg | last post by:
can you help me please with this problem.. i want a c program using newton raphson method for solving 18 equations... the equations are not of degree greater than 1... i need the program to input...
3
by: spranto | last post by:
Hi guys I allready oppened another thread to know if someone can help me to solve a 3 non linear equation system. I tryed this code to make the newton raphson method to work, but insted of converging...
2
by: kolnit | last post by:
Find a soln to the following eqtn by Newton-Raphson's method e^(0.05x)+x^2=132254 Let f(x)= e^(0.05x)+x^2-132254 perform iterations until abs f(x)<10^-6 I just have no idea wt to do!!...
1
by: dynamo | last post by:
Hi guys,i was wondering if anyone knows the code to solve equations using the newton raphson method in matlab.Or at least the algorithm.
2
by: thiofdelux | last post by:
I need a c++ program that uses newton raphson method to find the rooys of a function. The program would prompt to put in the degree of the ploynomial, the error bound 10^(n), and the first...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
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...
0
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
isladogs
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...

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.