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

Home » Public Forums » archive » Re: Pass variables into Newton or BROYDEN for solving non-linear equations
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Pass variables into Newton or BROYDEN for solving non-linear equations [message #77919] Tue, 18 October 2011 08:47
Zhang Bo is currently offline  Zhang Bo
Messages: 22
Registered: October 2011
Junior Member
On Oct 17, 9:20 pm, Beaker <mattjamesfran...@gmail.com> wrote:
> Yep that looks right, assuming you actually use the values A,B,C,D in
> the LCL function (are they to replace the constants you have in there,
> such as 223.1986 etc??).

yes, they replace T_s, Mmr_s etc. Thanks a lot!
Re: Pass variables into Newton or BROYDEN for solving non-linear equations [message #77926 is a reply to message #77919] Mon, 17 October 2011 18:20 Go to previous message
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
Yep that looks right, assuming you actually use the values A,B,C,D in
the LCL function (are they to replace the constants you have in there,
such as 223.1986 etc??).
Re: Pass variables into Newton or BROYDEN for solving non-linear equations [message #77928 is a reply to message #77926] Mon, 17 October 2011 18:10 Go to previous message
Zhang Bo is currently offline  Zhang Bo
Messages: 22
Registered: October 2011
Junior Member
On Oct 17, 7:13 pm, Beaker <mattjamesfran...@gmail.com> wrote:
> On Oct 18, 6:24 am, Zhang Bo <bzhang20071...@gmail.com> wrote:
>
>> I have a non-linear equations system to solve in every loop step. I
>> have 4 equations with 8 variables. 4 of the variables are known and
>> calculated in each loop. I cannot find a way to pass the known
>> variables(which are different in each loop) into a BROYDEN or NEWTON
>> function to solve the system. If I put all 8 variables as input guess,
>> it won't calculate for me because there are 8 variables and 4
>> equations. I kind of stuck here.
>
> When I encountered a similiar issue using AMOEBA, the only solution I
> could see was to cover myself with garlic and use a COMMON block. I
> set the extra variables I want to send to each call before making that
> call and have the COMMON block visible from within the user defined
> function you send to NEWTON or whatever.
>
> Does that make sense?

Like this?

common lclinput, A, B, C, D
A = ****
B = ****
C = ****
D = ****
X = [250, 20, 6.2, 750]
Result = broyden(X,'lcl')

FUNCTION LCL, X
COMMON lclinput, A, B, C, D

return, [X[0]-T_s*(X[1]/P_s)^(287/cp_s),$
X[2] - X[3]*Mmr_s/(0.622+Mmr_s),$
X[1]-26.66082+alog(X[1]),$
X[0] - (X[1]-sqrt(X[1]^2-223.1986))/0.0182758048]
END
Re: Pass variables into Newton or BROYDEN for solving non-linear equations [message #77929 is a reply to message #77928] Mon, 17 October 2011 16:13 Go to previous message
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
On Oct 18, 6:24 am, Zhang Bo <bzhang20071...@gmail.com> wrote:
> I have a non-linear equations system to solve in every loop step. I
> have 4 equations with 8 variables. 4 of the variables are known and
> calculated in each loop. I cannot find a way to pass the known
> variables(which are different in each loop) into a BROYDEN or NEWTON
> function to solve the system. If I put all 8 variables as input guess,
> it won't calculate for me because there are 8 variables and 4
> equations. I kind of stuck here.

When I encountered a similiar issue using AMOEBA, the only solution I
could see was to cover myself with garlic and use a COMMON block. I
set the extra variables I want to send to each call before making that
call and have the COMMON block visible from within the user defined
function you send to NEWTON or whatever.

Does that make sense?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: fitting many linear eqs simultaneously with outliers
Next Topic: Re: compute quartiles of a distribution

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

Current Time: Wed Oct 08 13:43:33 PDT 2025

Total time taken to generate the page: 0.00676 seconds