The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Solve nonlinear equation using NAG function

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
aplotnikov Posted - 07/11/2022 : 11:25:42 AM
Hello,

I would like to solve a nonlinear equation like
x=asin(1/(a+b*x))
for different sets of parameters (a,b). I can do it easily in R - the solution exists always for all the reasonable combinations of parameters, but I need a solution in Origin implemented as OriginC function without any connection to R.

There are several NAG functions suited for this purpose, but I didn't find any example of a call with user-defined coefficients, etc.

I guess, I need to use
NAG_comm
structure for this purpose. An illustrative example I would appreciate.

PS. I haven't succeed to solve this equation using EquationSolver.opx. Is it possible at all?

Thanks in advance.
7   L A T E S T    R E P L I E S    (Newest First)
aplotnikov Posted - 07/14/2022 : 11:18:17 AM
There is a difference between an example and a relevant example. I am trying to understand, how exactly I can transfer coefficients (not the x-values!) into the function fcn(). There is noting on this topic in the description you are referring to.
Castiel Posted - 07/14/2022 : 10:48:34 AM
quote:
Originally posted by aplotnikov

Hi Castiel,

Thanks for reply!

I read this description already - I always try to RTFM first. :) unfortunately this description contains neither the answer on my question nor any relevant example.

Regards,

Alexei



It does have an example. See 10.1 from that very webpage.


10.1
Program Text
Program Text (c05qbce.c)

10.2
Program Data
None.
10.3
Program Results
Program Results (c05qbce.r)


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
YimingChen Posted - 07/14/2022 : 10:31:35 AM
Here is a simplified version of the Equation Solver app using the same nag function. To check the source code, you can go to the Code Builder window (press Alt + 4 in Origin workspace). In the Workspace panel on the left, right-click on the Apps folder and choose Add Existing Folder.... Then add the NonlinearSolver folder. Then you should be able to check the source code. Hope it helps.

https://my.originlab.com/ftp/forum_and_kbase/Images/NonlinearSolver.zip

James
aplotnikov Posted - 07/14/2022 : 08:08:18 AM
Hi Castiel,

Thanks for reply!

I read this description already - I always try to RTFM first. :) unfortunately this description contains neither the answer on my question nor any relevant example.

Regards,

Alexei
Castiel Posted - 07/13/2022 : 10:30:22 AM
quote:
Originally posted by aplotnikov

Hello,

I would like to solve a nonlinear equation like
x=asin(1/(a+b*x))
for different sets of parameters (a,b). I can do it easily in R - the solution exists always for all the reasonable combinations of parameters, but I need a solution in Origin implemented as OriginC function without any connection to R.

There are several NAG functions suited for this purpose, but I didn't find any example of a call with user-defined coefficients, etc.

I guess, I need to use
NAG_comm
structure for this purpose. An illustrative example I would appreciate.

PS. I haven't succeed to solve this equation using EquationSolver.opx. Is it possible at all?

Thanks in advance.



https://www.nag.com/numeric/cl/nagdoc_cl26/html/c05/c05qbc.html
You can find an example from the above link.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
aplotnikov Posted - 07/13/2022 : 04:18:49 AM
Hi Echo,

Thanks for a helpful hint! However I need to solve the equation for hundreds points. Thus, a more convenient solution using NAG function is still necessary. The C-code of the EquationSolver.opx may be very illustrative.

Regards,

Alexei
Echo_Chu Posted - 07/13/2022 : 01:34:47 AM
It looks there is no problem to solve your equation with Equation Solver . Please look at the image below as an example. In the example I set a = 1 and b=2. You can set a and b to any other set of value as you needs.



Echo
OriginLab Technical Support

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000