How to display very small numbers in Mathematica?
$begingroup$
I am trying to evaluate the function:
$$f(x) = cos(x) - mathrm{e}^{-2.7 x}$$
at $x = 1.7 times 10^{-25}$
and Mathematica keeps returning '0.'
How do I evaluate the expression in a better way?
precision-and-accuracy
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to evaluate the function:
$$f(x) = cos(x) - mathrm{e}^{-2.7 x}$$
at $x = 1.7 times 10^{-25}$
and Mathematica keeps returning '0.'
How do I evaluate the expression in a better way?
precision-and-accuracy
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to evaluate the function:
$$f(x) = cos(x) - mathrm{e}^{-2.7 x}$$
at $x = 1.7 times 10^{-25}$
and Mathematica keeps returning '0.'
How do I evaluate the expression in a better way?
precision-and-accuracy
New contributor
$endgroup$
I am trying to evaluate the function:
$$f(x) = cos(x) - mathrm{e}^{-2.7 x}$$
at $x = 1.7 times 10^{-25}$
and Mathematica keeps returning '0.'
How do I evaluate the expression in a better way?
precision-and-accuracy
precision-and-accuracy
New contributor
New contributor
edited 18 mins ago
Henrik Schumacher
50.8k469145
50.8k469145
New contributor
asked 3 hours ago
Ray_56Ray_56
111
111
New contributor
New contributor
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
$begingroup$
Can also use exact numbers.
f[x_] = Cos[x] - E^(-27 x/10);
f[17 10^-26]//N[#,50]&
(*4.5899999999999999999999988020950000000000000000002*10^-25*)
$endgroup$
add a comment |
$begingroup$
The simplest methods are usually the best. Try this code
N[Cos[x] - Exp[-x 27/10] /. x -> 17*^-26, 15] // InputForm
or a minor variation
With[{x = 17*^-26}, N[Cos[x] - Exp[-x 27/10], 15]] // InputForm
or define a function first
f = Cos[#] - Exp[-# 27/10] &; N[f[17*^-26], 15] // InputForm
All of these return the result
4.589999999999999999999998802094999`15.*^-25
You can get more digits by increasing the 15 digits precision.
For example, with 34 digits precision the result returned is
4.5899999999999999999999988020950000000000000000001613`34.*^-25
$endgroup$
add a comment |
$begingroup$
First convert the expression to trigonometric form:
y = Cos[x] - Exp[-2.7*x] // ExpToTrig
Cos[x] - Cosh[2.7 x] + Sinh[2.7 x]
y /. x -> 1.7*10^-25
4.59*10^-25
This is the exact solution.
$endgroup$
add a comment |
$begingroup$
Do a series expansion:
Series[Cos[x] - Exp[-2.7 x], {x, 0, 1}]
(*
SeriesData[x, 0, {2.7}, 1, 2, 1]
*)
Then plug in $x = 1.7 times 10^{-25}$ to get:
$$4.59 times 10^{-25}$$
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Ray_56 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f189857%2fhow-to-display-very-small-numbers-in-mathematica%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Can also use exact numbers.
f[x_] = Cos[x] - E^(-27 x/10);
f[17 10^-26]//N[#,50]&
(*4.5899999999999999999999988020950000000000000000002*10^-25*)
$endgroup$
add a comment |
$begingroup$
Can also use exact numbers.
f[x_] = Cos[x] - E^(-27 x/10);
f[17 10^-26]//N[#,50]&
(*4.5899999999999999999999988020950000000000000000002*10^-25*)
$endgroup$
add a comment |
$begingroup$
Can also use exact numbers.
f[x_] = Cos[x] - E^(-27 x/10);
f[17 10^-26]//N[#,50]&
(*4.5899999999999999999999988020950000000000000000002*10^-25*)
$endgroup$
Can also use exact numbers.
f[x_] = Cos[x] - E^(-27 x/10);
f[17 10^-26]//N[#,50]&
(*4.5899999999999999999999988020950000000000000000002*10^-25*)
answered 1 hour ago
Bill WattsBill Watts
3,0811518
3,0811518
add a comment |
add a comment |
$begingroup$
The simplest methods are usually the best. Try this code
N[Cos[x] - Exp[-x 27/10] /. x -> 17*^-26, 15] // InputForm
or a minor variation
With[{x = 17*^-26}, N[Cos[x] - Exp[-x 27/10], 15]] // InputForm
or define a function first
f = Cos[#] - Exp[-# 27/10] &; N[f[17*^-26], 15] // InputForm
All of these return the result
4.589999999999999999999998802094999`15.*^-25
You can get more digits by increasing the 15 digits precision.
For example, with 34 digits precision the result returned is
4.5899999999999999999999988020950000000000000000001613`34.*^-25
$endgroup$
add a comment |
$begingroup$
The simplest methods are usually the best. Try this code
N[Cos[x] - Exp[-x 27/10] /. x -> 17*^-26, 15] // InputForm
or a minor variation
With[{x = 17*^-26}, N[Cos[x] - Exp[-x 27/10], 15]] // InputForm
or define a function first
f = Cos[#] - Exp[-# 27/10] &; N[f[17*^-26], 15] // InputForm
All of these return the result
4.589999999999999999999998802094999`15.*^-25
You can get more digits by increasing the 15 digits precision.
For example, with 34 digits precision the result returned is
4.5899999999999999999999988020950000000000000000001613`34.*^-25
$endgroup$
add a comment |
$begingroup$
The simplest methods are usually the best. Try this code
N[Cos[x] - Exp[-x 27/10] /. x -> 17*^-26, 15] // InputForm
or a minor variation
With[{x = 17*^-26}, N[Cos[x] - Exp[-x 27/10], 15]] // InputForm
or define a function first
f = Cos[#] - Exp[-# 27/10] &; N[f[17*^-26], 15] // InputForm
All of these return the result
4.589999999999999999999998802094999`15.*^-25
You can get more digits by increasing the 15 digits precision.
For example, with 34 digits precision the result returned is
4.5899999999999999999999988020950000000000000000001613`34.*^-25
$endgroup$
The simplest methods are usually the best. Try this code
N[Cos[x] - Exp[-x 27/10] /. x -> 17*^-26, 15] // InputForm
or a minor variation
With[{x = 17*^-26}, N[Cos[x] - Exp[-x 27/10], 15]] // InputForm
or define a function first
f = Cos[#] - Exp[-# 27/10] &; N[f[17*^-26], 15] // InputForm
All of these return the result
4.589999999999999999999998802094999`15.*^-25
You can get more digits by increasing the 15 digits precision.
For example, with 34 digits precision the result returned is
4.5899999999999999999999988020950000000000000000001613`34.*^-25
edited 35 mins ago
answered 50 mins ago
SomosSomos
4778
4778
add a comment |
add a comment |
$begingroup$
First convert the expression to trigonometric form:
y = Cos[x] - Exp[-2.7*x] // ExpToTrig
Cos[x] - Cosh[2.7 x] + Sinh[2.7 x]
y /. x -> 1.7*10^-25
4.59*10^-25
This is the exact solution.
$endgroup$
add a comment |
$begingroup$
First convert the expression to trigonometric form:
y = Cos[x] - Exp[-2.7*x] // ExpToTrig
Cos[x] - Cosh[2.7 x] + Sinh[2.7 x]
y /. x -> 1.7*10^-25
4.59*10^-25
This is the exact solution.
$endgroup$
add a comment |
$begingroup$
First convert the expression to trigonometric form:
y = Cos[x] - Exp[-2.7*x] // ExpToTrig
Cos[x] - Cosh[2.7 x] + Sinh[2.7 x]
y /. x -> 1.7*10^-25
4.59*10^-25
This is the exact solution.
$endgroup$
First convert the expression to trigonometric form:
y = Cos[x] - Exp[-2.7*x] // ExpToTrig
Cos[x] - Cosh[2.7 x] + Sinh[2.7 x]
y /. x -> 1.7*10^-25
4.59*10^-25
This is the exact solution.
edited 17 mins ago
Henrik Schumacher
50.8k469145
50.8k469145
answered 1 hour ago
VixillatorVixillator
4497
4497
add a comment |
add a comment |
$begingroup$
Do a series expansion:
Series[Cos[x] - Exp[-2.7 x], {x, 0, 1}]
(*
SeriesData[x, 0, {2.7}, 1, 2, 1]
*)
Then plug in $x = 1.7 times 10^{-25}$ to get:
$$4.59 times 10^{-25}$$
$endgroup$
add a comment |
$begingroup$
Do a series expansion:
Series[Cos[x] - Exp[-2.7 x], {x, 0, 1}]
(*
SeriesData[x, 0, {2.7}, 1, 2, 1]
*)
Then plug in $x = 1.7 times 10^{-25}$ to get:
$$4.59 times 10^{-25}$$
$endgroup$
add a comment |
$begingroup$
Do a series expansion:
Series[Cos[x] - Exp[-2.7 x], {x, 0, 1}]
(*
SeriesData[x, 0, {2.7}, 1, 2, 1]
*)
Then plug in $x = 1.7 times 10^{-25}$ to get:
$$4.59 times 10^{-25}$$
$endgroup$
Do a series expansion:
Series[Cos[x] - Exp[-2.7 x], {x, 0, 1}]
(*
SeriesData[x, 0, {2.7}, 1, 2, 1]
*)
Then plug in $x = 1.7 times 10^{-25}$ to get:
$$4.59 times 10^{-25}$$
answered 2 hours ago
David G. StorkDavid G. Stork
23.9k22153
23.9k22153
add a comment |
add a comment |
Ray_56 is a new contributor. Be nice, and check out our Code of Conduct.
Ray_56 is a new contributor. Be nice, and check out our Code of Conduct.
Ray_56 is a new contributor. Be nice, and check out our Code of Conduct.
Ray_56 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f189857%2fhow-to-display-very-small-numbers-in-mathematica%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown