I want to put the results (X, and Rn) of the end of this code in a table for X and Rn.they are 2 different variables which don't depend on each other, and plot them with X on x-axis and Rn on y-axis also if possible export both of them in a single Excel file. Kindly I appreciate any help.
ClearAll["Global"]
ClearAll[My`Print]
ClearAll[X1]
SetAttributes[My`Print, HoldAll]
My`Print[args___] :=
Do[Print[Extract[Hold[args], i, HoldForm], "=", {args}[[i]]],
{i, Length[{args}]}]
s = 0.1; c = 0; k = ((1 - a^2)/2)*s^2; h = 10; n = 0.3; a = n/(1 - n);
p = (-a)*y + 1 - Sqrt[(a*y - 1)^2 - 2*((1/2)*y^2 - a*y - k)];
f := (-Exp[-p])*Exp[y];
NIntegrate[f, {y, s, -s}];
\[Rho] = h/NIntegrate[f, {y, s, -s}];
rn = \[Rho]*Exp[s]; rp = \[Rho]*Exp[-s]; \[Delta] = rp - rn;
My`Print[\[Rho], rn, rp, \[Delta]]
g = -Exp[-((-a)*Log[y/\[Rho]] + 1 -
Sqrt[(a*Log[y/\[Rho]] - 1)^2 -
2*((1/2)*Log[y/\[Rho]]^2 - a*Log[y/\[Rho]] -
k)])];
R = 10;
X = ({#1, -(h/2) + NIntegrate[g, {y, rn, rn + #1*(\[Delta]/R)}]} & ) /@
Range[R];
Rn = ({#1, rn + #1*(\[Delta]/10)} & ) /@ Range[R];
TableForm[{X, Rn}]
Export["mfile.xls", {X, Rn}]
Plot[X, Rn]