Find value of large number

2 Ansichten (letzte 30 Tage)
Fatima Majeed
Fatima Majeed am 17 Jun. 2024
Beantwortet: Steven Lord am 17 Jun. 2024
\begin{align*}
B_2 &= 0.18525 \\
z &= 2.8 \times 10^{10} \\
H &= 3000175332800 \\
R &= \frac{z^{3/5}}{(\log(z))^{1/5}} \\
\\
\text{Substitute } z \text{ with } 2.8 \times 10^{10} \\
\\
R &= \left. \frac{z^{3/5}}{(\log(z))^{1/5}} \right|_{z = 2.8 \times 10^{10}} \\
\\
b &= \cdot (\exp(z_{\text{value}} \cdot -0.5) - 1) \cdot z^{\frac{6D - 15}{5}} \cdot \exp\left( \frac{B_2 (8D - 5) R}{3} \right)
\end{align*}
Could you fix this code, or do you have any ideas before I try it in MATLAB?
% Define the constants
B_2 = 0.18525;
H = 3000175332800;
D = 0.9999932;
z = 2.8 * 10^10;
% Define the expression for R
R = (log(z))^(3/5) / (log(log(z)))^(1/5);
% Display R
disp('R:');
disp(R);
RR = double(R);
disp('RR:');
disp(RR);
% Define the expression for b
b = (log(H/(2*pi)))^2 * (exp(-0.5 * z) - 1) * z^((6 * D - 15) / 5) * exp(B_2 * (8 * D - 5) * R / 3);
% Evaluate b
bb = double(b);
% Display b
disp('b:');
disp(b);
disp('bb:');
disp(bb);

Akzeptierte Antwort

Steven Lord
Steven Lord am 17 Jun. 2024
Use Symbolic Math Toolbox. Define your constants symbolically.
% Define the constants
B_2 = sym(0.18525);
H = sym('3000175332800');
D = sym(0.9999932);
z = sym(2.8) * 10^10;
I made no modifications below this line besides removing the blank line at the end of the code block.
% Define the expression for R
R = (log(z))^(3/5) / (log(log(z)))^(1/5);
% Display R
disp('R:');
R:
disp(R);
RR = double(R);
disp('RR:');
RR:
disp(RR);
5.3485
% Define the expression for b
b = (log(H/(2*pi)))^2 * (exp(-0.5 * z) - 1) * z^((6 * D - 15) / 5) * exp(B_2 * (8 * D - 5) * R / 3);
% Evaluate b
bb = double(b);
% Display b
disp('b:');
b:
disp(b);
disp('bb:');
bb:
disp(bb);
-3.0519e-16

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by