Reentrant SOLVE and INTEG

12152021, 06:39 PM
Post: #1




Reentrant SOLVE and INTEG
I'm working on reentrant 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 solvewithinsolve for?


12162021, 07:14 AM
(This post was last modified: 12182021 04:42 AM by Paul Dale.)
Post: #2




RE: Reentrant 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 

12172021, 11:01 PM
Post: #3




RE: Reentrant 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...


12182021, 12:16 AM
(This post was last modified: 12182021 12:39 AM by Albert Chan.)
Post: #4




RE: Reentrant SOLVE and INTEG
(12172021 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((LB)/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.50327323373E2 

12192021, 05:25 PM
Post: #5




RE: Reentrant 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. 

12192021, 06:57 PM
Post: #6




RE: Reentrant SOLVE and INTEG
Hi, Thomas Okken
Is this what you are looking for ? This is code for getting jacobian matrix numerically. https://github.com/fredrikjohansson/mpm...on.py#L579 

12202021, 01:10 PM
(This post was last modified: 12202021 07:19 PM by Albert Chan.)
Post: #7




RE: Reentrant SOLVE and INTEG
(12192021 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((LFVAR)/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)