substituting functions in a function

I need to substitue funstions g(y) = (Wg/y)^2, h(x) = sqrt(1+g(sqrt(2)*x))+1/(sqrt(1+g(sqrt(2)*x))-1), V(z) = z-1/(z+1) and f(w) = sqrt(sqrt(w)+1/(sqrt(w)-1)) in final equation theta = ln(V[f(g(sqrt2)+1)]/V[f(g(Lg))]) + ln(h(2.3*t)/h(s)). I am using nested equation but not able to solve it. Please help.

 Accepted Answer

You will need to check that I transcribed everything correctly.
syms Lg Wg s t w x y z
g(y) = (Wg/y)^2
g(y) = 
Root2 = sqrt(sym(2));
h(x) = sqrt(1+g(Root2*x))+1/(sqrt(1+g(Root2*x))-1)
h(x) = 
V(z) = z-1/(z+1)
V(z) = 
f(w) = sqrt(sqrt(w)+1/(sqrt(w)-1))
f(w) = 
Theta = log(V(f(g(Root2)+1))/V(f(g(Lg)))) + log(h(sym(2.3)*t)/h(s))
Theta = 
simplify(Theta, 'steps', 50)
ans = 

3 Comments

Marsha Parmar
Marsha Parmar on 14 Aug 2023
Edited: Marsha Parmar on 14 Aug 2023
Thank you for the answer. But may be I was not able to explain my self clearly. There is a big theta equation which goes as,
θ_total=1/(πWg k) ln(V[f(g[√2 s])+1]/V[f(g[Lg ])] )+1/2πsk ln((h(2.3t))/(h(s))).
Here you can see that 'V' is function of 'f' which in turn is a function of 'g' etc. Now these functions are given as,
g(y)=(Wg/y)^2
f(w)= √((√w+1)/(√w-1) )
V(z)=(z-1)/(z+1)
h(x)= (√(1+g(√2 x))+1)/(√(1+g(√2 x))-1).
So now suppose I wish to substiute g in h(x), then it will be,
h(x)= (√(1+(Wg/(√2 x))^2 )+1)/(√(1+(Wg/(√2 x))^2 )-1)
which I have done manually. Now if I need to calculate,
V[f(g[√2 s]), where 'g' is function of √2 s, 'f' is a function of f(g[√2 s]), and then 'V' is afunction of V[f(g[√2 s]).
If there is a way to write down a cose to substitute these function into a bigger function it will be very helpful.
But that's exactly what @Walter Roberson 's code does.
It defines functions g(y), f(w), V(z) and h(x) and computes a new function Theta by certain compositions of the functions previously defined.
Yes, I got to see now. Thank you so much.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2023a

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!