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 value
for ln2 is approximately .69314718055994 5 (to 15 places, about the limit of double precision).
Test for convergence using a tolerance of about 1e10 (that is, look at the absolute value of
new_x  old_x and require this to be less than 1e10 to say it has converged). Also keep a count
of the number of iterations; if this goes over 100, announce that there is no convergence. Otherwise
once you have convergence, print the solution (say to 15 places) and the number of iterations
7 17250 Banfa 9,065
Recognized Expert Moderator Expert
Have an attempt first yourself
Do you mean the Newton Method or the Newton Raphson method?
Newton method finds points on a curve which are a minimum or maximum, the Newton Raphson method finds roots of equations.
Either way you need to be able to write you equation with a 0 on 1 side before deriving it and the Newton method involves a double derrivation.
Netwon Method: next x = 1  f'(x)/f''(x)
Netwon Raphson Method: next x = 1  f(x)/f'(x)
Newton Raphson method you have to be sure that there is a root, with the Newton method you have to be sure that there is a stationary point.
There is little point printing the answer to 15 decimal places when you only have a tolerance of 10.
Once you have made an attempt then post your code an we will help you fix problems and make it work.
:: full code removed per Posting Guidelines::
IS THIS CORRECT ??????????????? ?
sicarie 4,677
Recognized Expert Moderator Specialist
Did you try running it through a compiler?
hi my friends
i am a new member in this site and i wana help as fast as possible....... ....pleaaaaaaaa aaaaaaaaas?
how to write this function in c++ by using Newtton raphson method?
*the question is:
Write a program that uses NewtonRaphson Method to approximate the root of a function
we could execute an infinite number of iterations to find a perfect representation for the root of our function. However, we will assume that the process has worked accurately when x = xk+1 xk becomes less than 0.1
To see how this works, we will perform the NewtonRaphson method on the function f(x) = x24. Below are listed the values that we need to know in order to complete the process:
f(x) = x24
f'(x) = 2x
x1 = 6
*the answer should be:
NewtonRaphson Method to approximate the root of a function
 Enter precision (1/10, 1/100, 1/1000,...): 0.1
xk f(x) derived_f(xk) xk+1 dx
6.000 32.000 12.000 3.333 2.667
3.333 7.111 6.667 2.267 1.067
2.267 1.138 4.533 2.016 0.251
2.016 0.063 4.031 2.000 0.016
 Enter your choice: (q) to quit, (c) to continue: c
 Enter precision (1/10, 1/100, 1/1000,...): 0.01
xk f(x) derived_f(xk) xk+1 dx
6.000 32.000 12.000 3.333 2.667
3.333 7.111 6.667 2.267 1.067
2.267 1.138 4.533 2.016 0.251
2.016 0.063 4.031 2.000 0.016
2.000 0.000 4.000 2.000 0.000
please dont be late?
sicarie 4,677
Recognized Expert Moderator Specialist
fahman
It's considered rude to ask your question in someone else's thread. Please look at our Posting Guidelines, read this thread (if it is applicable  I didn't check), try the methods in here, and create a new thread with your specific question and code snippet of where you're stuck fi you still need help.
hi my friend
in this q i didnot understand how to write the formula because ther are alot of varialbe
please can write it to me?
Ganon11 3,652
Recognized Expert Specialist
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 Guidlines.
Then when you are ready post a new question in your own thread.
MODERATOR
Sign in to post your reply or Sign up for a free account.
Similar topics 
by: CoreyWhite 
last post by:
It is possible to use martingale probability theory to beat some games
of chance. In a fair game of coin toss, where the odds reach an
equilibrium of 50/50 chain reactions do occur. This can be explained
using martingale probability theory, but in simpler terms it only shows
an example of how order emerges out of chaos.
Example: One player has 3 pennies, and another player has only 1 penny.
A fair coin is tossed every round to determine...

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...

by: spranto 
last post by:
Hi to you all,
This is my first post. I'm having troubles finding one suitable code line to solve a 3 non linear equation system. I'm here asking if someone allready done that and if it possible to share that with me, if not if someone can point me in the wright direction to achieve this goal.
Thank's in advance!

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 it is diverging. Can someone please help me? Thank's!
'Cálculo do Sistema para obter os cossenos directores através do método NewtonRaphson
Dim nr, aux1, aux2, aux3, lll, mmm, nnn, ff, gg, hh, ite As Double
'Condição...

by: kolnit 
last post by:
Find a soln to the following eqtn by NewtonRaphson's method
e^(0.05x)+x^2=132254
Let f(x)= e^(0.05x)+x^2132254
perform iterations until abs f(x)<10^6
I just have no idea wt to do!!
THanks a lot!!
 
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.

by: DDCane 
last post by:
i have made a code for finding a derivative and now im trying to use it to help me with a code for the newton raphson method:
def derivative (f,x,h):
import math
return float(1/(2*h)) * (f(x+h)  f(xh))
def solve (f,x0,h):
delta= f(x(n))/fp(x(n)
for x(n+1) in solve():
x(n)delta

by: newbprogrammer 
last post by:
I just started programming in c++ and i tried to explore and do programs on my own... So i wanted to do a program that would help me in my daily school work ... a program to solve quadratic equations.. I wrote the code correctly but errors are still detected and i have no idea why.. almost gave up and banged my head on the wall .. so i would really appreciate help.. This is the code so far..
#include <cmath>
#include <iostream>
using...

by: pauldepstein 
last post by:
Let double NR( double x, double(*)(const double&) f ) be the
signature of a NewtonRaphson function NR.
Here, f is a function which returns a double and accepts a const
double&. The aim of the game is to find a zero of this function f
(the point at which f crosses the xaxis). This zerooff which
solves our problem is the double which NR returns. It remains to
explain what the "double x" represents. This is the...

by: Oralloy 
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bitfields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++12 std=c++20 Wnarrowing bit_field.cpp
Here is the code in...

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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
 
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...

by: conductexam 
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...

by: TSSRALBI 
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LANtoLAN VPNs.
The last exercise I practiced was to create a LANtoLAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

by: adsilva 
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

by: 6302768590 
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

by: muto222 
last post by:
How can i add a mobile payment intergratation into php mysql website.
 
by: bsmnconsultancy 
last post by:
In today's digital era, a welldesigned website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
 