help-octave
[Top][All Lists]
Advanced

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

Re: Reverse function numerically


From: stn021
Subject: Re: Reverse function numerically
Date: Mon, 29 Jan 2018 00:35:01 +0100

Hello,

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 ?

THX,stn


code-example:

# 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 ;
end


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" ) ;



reply via email to

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