Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:41:03+00:00 2026-05-15T11:41:03+00:00

I know this isn’t exactly programming related per se, but programmers are the most

  • 0

I know this isn’t exactly programming related per se, but programmers are the most
probable of all people who will recognize this maybe.

I have the following (X and Y are arrays, both with 3 elements), and I cannot recognize (although it reminds me of a few things, but none quite!) what is being done here. Does it ring any bells for anyone else ?

I gather you can disregard the lower part; the upper should probably give it away … but I still cannot see it.

At first it reminded me of linear interpolation in 3d space …

  SUBROUTINE TRII(X,Y,XR,YR)
DIMENSION X(3),Y(3)

D=X(1)*(X(2)**2-X(3)**2)+
 >    X(2)*(X(3)**2-X(1)**2)+
 >    X(3)*(X(1)**2-X(2)**2)

D1=Y(1)*(X(2)*X(3)**2-X(3)*X(2)**2)+
 >     Y(2)*(X(3)*X(1)**2-X(1)*X(3)**2)+
 >     Y(3)*(X(1)*X(2)**2-X(2)*X(1)**2)

D2=Y(1)*(X(2)**2-X(3)**2)+
 >     Y(2)*(X(3)**2-X(1)**2)+
 >     Y(3)*(X(1)**2-X(2)**2)

D3=X(2)*(Y(3)-Y(1))+
 >     X(1)*(Y(2)-Y(3))+
 >     X(3)*(Y(1)-Y(2))

A=D1/D
B=D2/D
C=D3/D

YR=A+B*XR+C*XR**2

RETURN
END

  SUBROUTINE TRIM(X,Y,XR,YR,XM,YM)
DIMENSION X(3),Y(3)

D=X(1)*(X(2)**2-X(3)**2)+
 >    X(2)*(X(3)**2-X(1)**2)+
 >    X(3)*(X(1)**2-X(2)**2)

D1=Y(1)*(X(2)*X(3)**2-X(3)*X(2)**2)+
 >     Y(2)*(X(3)*X(1)**2-X(1)*X(3)**2)+
 >     Y(3)*(X(1)*X(2)**2-X(2)*X(1)**2)

D2=Y(1)*(X(2)**2-X(3)**2)+
 >     Y(2)*(X(3)**2-X(1)**2)+
 >     Y(3)*(X(1)**2-X(2)**2)

D3=X(2)*(Y(3)-Y(1))+
 >     X(1)*(Y(2)-Y(3))+
 >     X(3)*(Y(1)-Y(2))

A=D1/D
B=D2/D
C=D3/D

XR=-B/(2.*C)
YR=A+B*XR+C*XR**2

XM=XR
IF(XR.GT.X(1).OR.XR.LT.X(3))XM=X(1)
YM=A+B*XM+C*XM**2
IF(YM.LT.Y(1))XM=X(1)
IF(YM.LT.Y(1))YM=Y(1)

RETURN
END

“>” is a continuation sign.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:41:04+00:00Added an answer on May 15, 2026 at 11:41 am

    The code run as follows

    Routine TRII takes as input the coordinates of three points (x,y) and interpolates a parabola using Lagrange interpolation. Also takes as input the coordinate XR. Returns in YR the value at XR for the interpolating parabola.
    I guess the name of the routine comes from “TRI” (Croatian for “three” (points)) and “I” for Interpolation.

    Routine TRIM also calculates the same parabola, and returns the minimun value of the function in the interval {X(1),X(3)}.The name comes from “TRI” and “M” (minimum)

    (I “really” executed the program) >)

    Note that this is FORTRAN code and the parameters are passed by reference, so the results are returned back in the same parameters (very odd!)

    Edit

    Just for fun, let’s run TRII

    TRII[X_, Y_, XR_] := 
      Module[{D0, D1, D2, D3, A, B, C}, 
         D0 = X[[1]]*(X[[2]]^2 - X[[3]]^2) + 
              X[[2]]*(X[[3]]^2 - X[[1]]^2) + 
              X[[3]]*(X[[1]]^2 - X[[2]]^2);
         D1 = Y[[1]]*(X[[2]]*X[[3]]^2 - X[[3]]*X[[2]]^2) + 
              Y[[2]]*(X[[3]]*X[[1]]^2 - X[[1]]*X[[3]]^2) + 
              Y[[3]]*(X[[1]]*X[[2]]^2 - X[[2]]*X[[1]]^2);
         D2 = Y[[1]]*(X[[2]]^2 - X[[3]]^2) + 
              Y[[2]]*(X[[3]]^2 - X[[1]]^2) + 
              Y[[3]]*(X[[1]]^2 - X[[2]]^2);
         D3 = X[[2]]*(Y[[3]] - Y[[1]]) + 
              X[[1]]*(Y[[2]] - Y[[3]]) + 
              X[[3]]*(Y[[1]] - Y[[2]]);
       A = D1/D0;
       B = D2/D0;
       C = D3/D0;
       Return[A + B*XR + C*XR^2];];
    
    X = RandomReal[1, 3];
    Y = RandomReal[1, 3];
    Show[Plot[TRII[X, Y, x], {x, 0, 1}], 
     ListPlot[Transpose[{X, Y}], PlotMarkers -> Automatic]]
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this isn't strictly a programming question but y'all must have experienced this.
I know this question isn't directly programming related, but since I want to be
I know this isn't strictly a programming question, but it is related to git.
I know this isn't strictly speaking a programming question but something I always hear
I know this isn't best practice, but can I include all of the dependencies
I know this isn't a programming question but it is a programming tool question.
I know this isn't a unique issue but I've not had much luck finding
I know this is not programming directly, but it's regarding a development workstation I'm
I know this isn't specific to PHP, but what's the point of using timezones
I know this isn't a good thing to do, but its also a temporary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.