comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Solving a non-linear equation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Solving a non-linear equation [message #88243 is a reply to message #88242] Wed, 02 April 2014 10:45 Go to previous message
Reetsspacey is currently offline  Reetsspacey
Messages: 3
Registered: June 2009
Junior Member
On Wednesday, 2 April 2014 11:36:15 UTC-4, Craig Markwardt wrote:
> On Wednesday, April 2, 2014 10:33:43 AM UTC-4, Reetsspacey wrote:
>
>> Hi,
>
>>
>
>>
>
>>
>
>> My problem is this: I have a non-linear equation, of the form y = exp(x)+x. I have a large matrix of Y values, and for each cell (Y-value) I would like to calculate a best-fit X. How can I do this???
>
>
>
> The easiest way is to use Newton's method.
>
>
>
> If you're trying to find the root of f(x), given a trial solution of x0, the next best solution is,
>
> x = x0 - f(x0) / f'(x0)
>
> where f'(x0) is the derivative of the function. Now you have a new x0 and can try again for multiple iterations.
>
>
>
> For you, this would be, in IDL language,
>
> for i = 0, n_iter-1 do begin
>
> x = x0 - (x + exp(x) - y)/(1 + exp(x))
>
> x0 = x
>
> endfor
>
>
>
> Your function is very well behaved (no extrema) so you should be able to pick x0=0 as your starting point and then keep iterating until you achieve the desired precision.
>
>
>
> Craig

Brilliant, that makes sense! Thank you!
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: services provided by Al madinah international university for students
Next Topic: transfer the specific data in array A to array B

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 04:27:44 PDT 2025

Total time taken to generate the page: 0.64338 seconds