Hi, I'm trying to solve a self-consistent equation using Mathematica. I'm really new here. Essentially, I have a function f[T_]
which outputs a different expression from every T_
. I then I want to use the value f[T_]
as the input for a second function, S[T_]
, but since the output of f[T_]
is of the form {x->x0}, I can't just plug it into S[T_]
. See code below, thank you!! (I also added a screenshot at the bottom)
s[a_] := (
Sqrt[a] E^(a/2) Sqrt[3/(
2 \[Pi])] (E^a/
a - ((1 + a) E^(-a/2) Sqrt[\[Pi]/6] Erfi[Sqrt[3/2] Sqrt[a]])/a^(
3/2)))/Erfi[Sqrt[3/2] Sqrt[a]]
f[T_] := FindRoot[s[x] - T*x, {x, 20}]
f[T_] := Inactivate[FindRoot[s[x] - T*x, {x, 20}]]
f[0.2] // Activate
Which outputs
{x -> 3.07401}
Then, if I try to define:
S[T_] := s[f[T] // Activate]
S[0.2]
{(0.690988 2.71828^(0.5 (x -> 3.07401)) Sqrt[
x -> 3.07401] (2.71828^(x -> 3.07401)/(x -> 3.07401) - (
0.723601 2.71828^(-0.5 (x -> 3.07401))
Erfi[1.22474 Sqrt[x -> 3.07401]] (1. + (x -> 3.07401)))/(x ->
3.07401)^(3/2)))/Erfi[1.22474 Sqrt[x -> 3.07401]]
Note the {x->3.07401} everywhere... Any idea how to solve this? I've been searching online for about an hour now.
