Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How to find $f(x)$ from $f(g(x))$, $g(x)$, ex:

$g(x)=1-x^2$

$f(g(x))=(x^4+x^2)/(1+x^2)$

$f(1/2)=$

use matlab code....I don't know..help me thanks a lot!

share|improve this question
2  
When is $g(x)$ equal to $\frac12$? –  Jonas Meyer Dec 28 '12 at 6:54
    
Assuming you just want to use it for numeric calculations you do not need the symbolic toolbox, you can just define functions f and g, and then you can call them as f(g(x)) –  Dennis Jaheruddin Dec 28 '12 at 9:24

4 Answers 4

I give you an example, and hope you can translate it to Matlab. I don't know Matlab much but I think you can do it by yourself.

Assume you have $$h(x)=f(g(x))=4x^2+4x+7$$ and $$g(x)=2x+1$$ and want to find $f(x)$. Define $h(x)$ and $g(x)$ in Matlab environment and solve $$g(x)=t$$ respect to $x$(which $t$ is a parameter) You get: $$x=0.5t-0.5$$ Now put what you got into $h(x)$, so you get: $$h(0.5t-0.5)=t^2+6$$ This is your desired function $f(x)$ if you replace $t$ to $x$.

share|improve this answer
    
Nice suggestion, to try without Matlab! And good direction for doing just that! –  amWhy Mar 1 '13 at 1:04

For $g(x) = 1 - x^2$ to be equal to $1/2$, $x = 1/\sqrt{2}$.

So: $$f(1/2) = \frac{1/4 + 1/2}{1 + 1/2} = 0.75/1.5 = 1/2$$

share|improve this answer
    
I want code matlab,do you understand ???ex EX syms x; input('gx ') input(' f(gx) ') f(1/2)=????? –  user50980 Dec 28 '12 at 7:58
    
@nubis It makes no calculation difference, but you should technically have $x=\pm1/\sqrt{2}$ in the first line. –  Daryl Dec 28 '12 at 8:47
    
@user50980 - I want a pony. –  nbubis Dec 28 '12 at 16:41

A simple solution is to notice that $$f(g(x)) = \dfrac{x^4+x^2}{x^2+1} = \dfrac{x^2(x^2+1)}{x^2+1}= x^2 = 1 - g(x)$$ so if $g(x)=\frac{1}{2}$ then $f(g(x))=1-\frac{1}{2} = \frac{1}{2}$.

share|improve this answer
1  
Agh, 4 months too late. Ali's answer(???) bumped the thread. I hate it when this happens. –  Clive Newstead May 9 '13 at 19:02
clc;
syms f g x;
S = solve('g = 1 - x ^ 2', 'g = 1 / 2')
x = S.x(1);
f = (x ^ 4 + x ^ 2) / (1 + x ^ 2);
double (f)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.