[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reverse function numerically

From: Steven Dorsher
Subject: Re: Reverse function numerically
Date: Sun, 28 Jan 2018 18:09:57 -0600

A classic example of this problem is x=e^x. This can be generalized to vectors. This is called a transcendental equation, because it has no algebraic solution. These can be solved by picking an initial guess and iteratively improving the guess by feeding it back into the right hand side of the function. In this case it works better if the equation is written in a different form. It may take some manipulation. The technique is called the relaxation method, and can be found in many introductory numerical methods textbooks. I haven’t looked this up before summarizing, so you might want to. Best of luck!

There are other methods for solving transcendental equations, but I can’t remember their names or details without looking them up. Please ask again if you need my help with this.

S. Dorsher

On Jan 28, 2018, at 5:35 PM, stn021 <address@hidden> wrote:


this is the same question I asked in my previous mail about an hour ago.
I have added a code-example to illustrate what I mean.

See at the bottom of this email.
This is only meant as an example. It can be solved algebraically, so
please simply assume that it cannot be solved,

My question is this:
I have 2 functions:

y1 = f1( x1,x2 )
y2 = f2( x1,x2 )

also there is the reverse function

x1 = g1( y1,y2 )
x2 = g2( y1,y2 )

in octave syntax:
[ y1,y2 ] = f( [ x1,x2 ] )
[ x1,x2 ] = g( [ y1,y2 ] )

Both functions lead to exactly one distinct pair of results for each
pair of input variables.
That means that within predefined limits ( im my example all variables
are >=0 and <=1 )

this is true :   f ( g ( [x1,x2] ) ) == [ x1,x2 ]
and this also:   ( f(a,b) == f(c,d) )  <=>  ( a==c and b==d )

I am not a mathmatician so I hope I got this one right :-)

My problem is this: I can calculate f(x1,x2) but I cannot calculate g(y1,y2).
Meaning that f( [x1,x2] ) cannot be algebraically reversed.

I am looking for a way to calculate g( [y1,y2] ).
The obvious solution would be some kind of approximation.
(fft looks like a good choice)

So far I could not piece together how to do that.
Could you please give me a hint ?



# function [x1 x2] = g(y1,y2)
#    ...unclear...
# end

function [y1 y2] = f( x1,x2 )
 y1 = x1.^2 .* (2-x2) / 2 ;
 y2 = (2-x1) .* x2.^2 / 2 ;

x = 0:.025:1 ;
[ x1 x2 ] = meshgrid( x,x ) ;
[ y1 y2 ] = f( x1 , x2 ) ;

plot3( x1,x2,y1,".g" ) ; hold on ;
plot3( x1,x2,y2,".b" ) ;
xlabel( "x1" ) ; ylabel( "x2" ) , zlabel( "y1 y2" ) ;

Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]