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

  • Home
  • SEARCH
  • 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 3315224
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:19:30+00:00 2026-05-17T22:19:30+00:00

I want to write some functions as follows y = f(x) and another function,

  • 0

I want to write some functions as follows

y = f(x) and another function,
x = g(y) that acts as a reversible, where
y = f(g(y)) and where x and y are permutated integers.

For very simple example in the range of integers in 0 to 10 it would look like this:

0->1  
1->2  
2->3  
...  
9->10  
10->0 

but this is the simplest method by adding 1 and reversing by subtracting 1.

I want to have a more sofisticated algorithm that can do the following,

234927773->4299  
34->33928830  
850033->23234243423  

but the reverse can be obtained by conversion

The solution could be obtained with a huge table storing pairs of unique integers but this will not be correct. This must be a function.

  • 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-17T22:19:31+00:00Added an answer on May 17, 2026 at 10:19 pm

    You could use polynomial interpolation methods to interpolate a function one way, then do reverse interpolation to find the inverse function.

    Here is some example code in MATLAB:

    function [a] = Coef(x, y)
        n = length(x);
    
        a = y;
        for j = 2:n
            for i = n:-1:j
                a(i) = (a(i) - a(i-1)) / (x(i) - x(i-j+1));
            end
        end
    end
    
    function [val] = Eval(x, a, t)
        n = length(x);
    
        val = a(n);
        for i = n-1:-1:1
           val = a(i) + val*(t-x(i)); 
        end
    end
    

    It builds a Divided Difference table and evaluates a function based on Newtons Interpolation.

    Then if your sets of points are x, and y (as vectors of the same length, where x(i) matches to y(i), your forward interpolation function at value n would be Eval(x, Coef(x, y), n) and the reverse interpolation function would be Eval(y, Coef(y, x), n).

    Depending on your language, there are probably much cleaner ways to do this, but this gets down and dirty with the maths.

    Here is an excerpt from the Text Book which is used in my Numerical Methods class: Google Book Link

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

Sidebar

Related Questions

I want to write some JavaScript that will change the onmousedown of a div
I want to write a word addin that does some computations and updates some
I want to write a function in Python that returns different fixed values based
I want to write a function that takes an array of letters as an
I want to write some javascript and have it call into the DOM for
I want to use Powershell to write some utilities, leveraging our own .NET components
I want to write a script in Ruby to clean up some messed up
I want to write a command that specifies the word under the cursor in
I want to write a little DBQuery function in perl so I can have
So, im trying to write some code that utilizes Nvidia's CUDA architecture. I noticed

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.