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.

 采纳的回答

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 个评论

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.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品

版本

R2023a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by