Re-entrant SOLVE and INTEG
|
12-15-2021, 06:39 PM
Post: #1
|
|||
|
|||
Re-entrant SOLVE and INTEG
I'm working on re-entrant versions of SOLVE and INTEG for Plus42. Initial tests on RINTEG look OK, but I don't really have any good test cases for RSOLVE. Could someone help me out with an example or two, that you'd actually want to use solve-within-solve for?
|
|||
12-16-2021, 07:14 AM
(This post was last modified: 12-18-2021 04:42 AM by Paul Dale.)
Post: #2
|
|||
|
|||
RE: Re-entrant SOLVE and INTEG
Any two dimensional problem would benefit from nested solve.
For the sake of argument: solve ?(x) = sin(y), where y <> x. Pauli |
|||
12-17-2021, 11:01 PM
Post: #3
|
|||
|
|||
RE: Re-entrant SOLVE and INTEG
I don't see it. With f(x, y) = 0, you typically have a set of zeroes. You pick an x and solve for y, or vice versa. If there's a unique (x, y) for which f = 0, a univariate solver isn't going to find it, even if you can run two instances at the same time...
|
|||
12-18-2021, 12:16 AM
(This post was last modified: 12-18-2021 12:39 AM by Albert Chan.)
Post: #4
|
|||
|
|||
RE: Re-entrant SOLVE and INTEG
(12-17-2021 11:01 PM)Thomas Okken Wrote: I don't see it. With f(x, y) = 0, you typically have a set of zeroes. You pick an x and solve for y, or vice versa. If there's a unique (x, y) for which f = 0, a univariate solver isn't going to find it, even if you can run two instances at the same time... With 2 guess x1, x2, we solved for y, minimizing |f(x,y)| Now, we have 2 points, (x1, f1), (x2, f2). Get the root of the secant line, we have (x3, f3) Rinse, and repeat. Hopefully, final |f(x,y)| converged close to 0.0 --- Example, HP17B code, to predict Matt's Catenoid soap bubble radius. (A = radius, B=half height, both with unit of meter) 10 R1=.508 @ R2=.56 @ L=.5 @ B0=L/2 @ B=B0 20 DEF FNF(A,B)=ABS((A*COSH(B/A)-R1,A*COSH((L-B)/A)-R2)) 30 DEF FNB(A) 40 B=FNROOT(B0,B,FNF(A,FVAR)) 50 B0=FGUESS @ FNB=FVALUE @ DISP A,B,FVALUE 60 END DEF 70 A=FNROOT(R1,R2,FNB(FVAR)) 80 DISP A,B,"FINAL" >RUN Code: .508 .211662534193 5.50327323373E-2 |
|||
12-19-2021, 05:25 PM
Post: #5
|
|||
|
|||
RE: Re-entrant SOLVE and INTEG
That's not finding a root of a function defined using a root; that's finding a minimum of a function defined using a minimum.
The Free42 solver wasn't really designed for finding minima. It will report them if it gets stuck on them, but there's no guarantee of finding minima like there is of finding zeroes, given good starting guesses. |
|||
12-19-2021, 06:57 PM
Post: #6
|
|||
|
|||
RE: Re-entrant SOLVE and INTEG
Hi, Thomas Okken
Is this what you are looking for ? This is code for getting jacobian matrix numerically. https://github.com/fredrik-johansson/mpm...on.py#L579 |
|||
12-20-2021, 01:10 PM
(This post was last modified: 12-20-2021 07:19 PM by Albert Chan.)
Post: #7
|
|||
|
|||
RE: Re-entrant SOLVE and INTEG
(12-19-2021 05:25 PM)Thomas Okken Wrote: That's not finding a root of a function defined using a root; that's finding a minimum of a function defined using a minimum. If we can ensure "inner" solver always find a root, we can avoid minimum search. With R2 ≥ R1 ≥ A, and COSH(X) ≥ 1, FNB(A) always find a root. 10 R1=.508 @ R2=.56 @ L=.5 @ B=0 20 DEF FNB(A) @ B=FNROOT(B,L,COSH((L-FVAR)/A)-R2/A) @ FNB=B 30 DISP A,B,FVALUE @ END DEF 40 A=FNROOT(R1,R2,COSH(FNB(FVAR)/FVAR)-R1/FVAR) 50 DISP A,B,FVALUE >RUN Code: .508 .272064726623 0 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)