Plot the solution from DSolvePiecewise IntegrationWhy does evaluating an integral within a Plot expression take so long?DSolve yields a strange character K[1]How to plot an inequality?How to use initial fixed timestep, then decrease it according to dependent variable, while spatial stepsize is fixedDSolve for a huge linear inhomogeneous ODE in parallelSimplifying the result of DSolveDSolve[] is unable to compute the symbolic solution of a non-linear BVP with double Neumann BCsIssue with boundary Integration of FEM numerical solution (interpolation function)DSolve doesn't find formal solutionParametricPlot shows nothing when changing a parameter?How to express the MeijerG as Bessel function, which leads to the general solution of the below differential equationBoth DSolve and NDSolve fail for a simple system of two PDEs
As the Ferris wheel turns
Why is the UH-60 tail rotor canted?
Why can't a country print its own money to spend it only abroad?
Why Lie algebras if what we care about in physics are groups?
How can I disable a reserved profile?
Importance of moon phases for Apollo missions
Create Circle with Inner Radius
Why was Quirrell said to be in the Black Forest if Voldemort was actually in Albania?
Why are Oscar, India, and X-Ray (O, I, and X) not used as taxiway identifiers?
Has Iron Man made any suit for underwater combat?
Impact of throwing away fruit waste on a peak > 3200 m above a glacier
Are Linux kernel modules a sort of Linux system paged pool?
Do I care if the housing market has gone up or down, if I'm moving from one house to another?
Stellen - Putting, or putting away?
Can I use Sitecore's Configuration patching mechanics for my Identity Server configuration?
What does the following chess proverb mean: "Chess is a sea where a gnat may drink from and an elephant may bathe in."
Capture SQL Server queries without third-party tooling and without using deprecated features?
Is there any direct train from LHR Airport to Newcastle Gateshead?
Why didn't NASA launch communications relay satellites for the Apollo missions?
"It is what it is"
Reflect IR beam off reflector instead of emitting straight to TSOP receiver
Why is there an extra "t" in Lemmatization?
Did Don Young threaten John Boehner with a 10 inch blade to the throat?
Storyboarding Approaches for the Non-Artistic
Plot the solution from DSolve
Piecewise IntegrationWhy does evaluating an integral within a Plot expression take so long?DSolve yields a strange character K[1]How to plot an inequality?How to use initial fixed timestep, then decrease it according to dependent variable, while spatial stepsize is fixedDSolve for a huge linear inhomogeneous ODE in parallelSimplifying the result of DSolveDSolve[] is unable to compute the symbolic solution of a non-linear BVP with double Neumann BCsIssue with boundary Integration of FEM numerical solution (interpolation function)DSolve doesn't find formal solutionParametricPlot shows nothing when changing a parameter?How to express the MeijerG as Bessel function, which leads to the general solution of the below differential equationBoth DSolve and NDSolve fail for a simple system of two PDEs
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I'm trying to solve a differential equation as in the following code:
FullSimplify[DSolve[x'[t] == a + b E^(g t) + (c + d E^(-g t)) x[t], x[t], t]]
which generates
Now, I would like to plot it with specific parameter values assigned, for example: a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
where I replaced the integration constant c_1
with A
.
Here is my code for plotting x[t]
:
a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
x[t_] := E^(-((d E^(-g t))/g) + c t) (A + Integrate[E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1, t])
Plot[x[t], t, 1, 10]
It runs forever. To check whether Mathematica is doing calculations, I tried
x[1]
and it yielded
3.83926*10^-15
which is nice. But when I tried
x[2]
I got
It seems Mathematica cannot compute the integral unless the integration region is $int_1^1$. Is this because the integrand is too complicated? Is there any way to let Mathematica compute it? Thanks!
plotting differential-equations
$endgroup$
add a comment |
$begingroup$
I'm trying to solve a differential equation as in the following code:
FullSimplify[DSolve[x'[t] == a + b E^(g t) + (c + d E^(-g t)) x[t], x[t], t]]
which generates
Now, I would like to plot it with specific parameter values assigned, for example: a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
where I replaced the integration constant c_1
with A
.
Here is my code for plotting x[t]
:
a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
x[t_] := E^(-((d E^(-g t))/g) + c t) (A + Integrate[E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1, t])
Plot[x[t], t, 1, 10]
It runs forever. To check whether Mathematica is doing calculations, I tried
x[1]
and it yielded
3.83926*10^-15
which is nice. But when I tried
x[2]
I got
It seems Mathematica cannot compute the integral unless the integration region is $int_1^1$. Is this because the integrand is too complicated? Is there any way to let Mathematica compute it? Thanks!
plotting differential-equations
$endgroup$
$begingroup$
Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
I'm trying to solve a differential equation as in the following code:
FullSimplify[DSolve[x'[t] == a + b E^(g t) + (c + d E^(-g t)) x[t], x[t], t]]
which generates
Now, I would like to plot it with specific parameter values assigned, for example: a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
where I replaced the integration constant c_1
with A
.
Here is my code for plotting x[t]
:
a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
x[t_] := E^(-((d E^(-g t))/g) + c t) (A + Integrate[E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1, t])
Plot[x[t], t, 1, 10]
It runs forever. To check whether Mathematica is doing calculations, I tried
x[1]
and it yielded
3.83926*10^-15
which is nice. But when I tried
x[2]
I got
It seems Mathematica cannot compute the integral unless the integration region is $int_1^1$. Is this because the integrand is too complicated? Is there any way to let Mathematica compute it? Thanks!
plotting differential-equations
$endgroup$
I'm trying to solve a differential equation as in the following code:
FullSimplify[DSolve[x'[t] == a + b E^(g t) + (c + d E^(-g t)) x[t], x[t], t]]
which generates
Now, I would like to plot it with specific parameter values assigned, for example: a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
where I replaced the integration constant c_1
with A
.
Here is my code for plotting x[t]
:
a = 1; b = 2; c = 3; d = 4; g = 0.1; A = 1
x[t_] := E^(-((d E^(-g t))/g) + c t) (A + Integrate[E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1, t])
Plot[x[t], t, 1, 10]
It runs forever. To check whether Mathematica is doing calculations, I tried
x[1]
and it yielded
3.83926*10^-15
which is nice. But when I tried
x[2]
I got
It seems Mathematica cannot compute the integral unless the integration region is $int_1^1$. Is this because the integrand is too complicated? Is there any way to let Mathematica compute it? Thanks!
plotting differential-equations
plotting differential-equations
asked 8 hours ago
pppppp
4023 silver badges11 bronze badges
4023 silver badges11 bronze badges
$begingroup$
Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
$endgroup$
– Michael E2
5 hours ago
$begingroup$
Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
$endgroup$
– Michael E2
5 hours ago
$begingroup$
Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
$endgroup$
– Michael E2
5 hours ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
It runs forever, since you used :=
instead of =
so it was trying to integrate it each time for each different range of t
.
You need to integrate it once (which will take few seconds), and then use the result instead. Much faster now, since when you change t
, it will not integrate it again. And changed g = 0.1
to g=1/10
as it is best to use exact numbers with Integrate
Try
ClearAll[t, x]
a = 1; b = 2; c = 3; d = 4; g = 1/10; A = 1;
x[t_] = E^(-((d E^(-g t))/g) + c t) (A +
Integrate[
E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1,
t]);
Plot[x[t], t, 1, 3]
$endgroup$
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
add a comment |
Your Answer
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
);
);
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%2f202574%2fplot-the-solution-from-dsolve%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
It runs forever, since you used :=
instead of =
so it was trying to integrate it each time for each different range of t
.
You need to integrate it once (which will take few seconds), and then use the result instead. Much faster now, since when you change t
, it will not integrate it again. And changed g = 0.1
to g=1/10
as it is best to use exact numbers with Integrate
Try
ClearAll[t, x]
a = 1; b = 2; c = 3; d = 4; g = 1/10; A = 1;
x[t_] = E^(-((d E^(-g t))/g) + c t) (A +
Integrate[
E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1,
t]);
Plot[x[t], t, 1, 3]
$endgroup$
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
add a comment |
$begingroup$
It runs forever, since you used :=
instead of =
so it was trying to integrate it each time for each different range of t
.
You need to integrate it once (which will take few seconds), and then use the result instead. Much faster now, since when you change t
, it will not integrate it again. And changed g = 0.1
to g=1/10
as it is best to use exact numbers with Integrate
Try
ClearAll[t, x]
a = 1; b = 2; c = 3; d = 4; g = 1/10; A = 1;
x[t_] = E^(-((d E^(-g t))/g) + c t) (A +
Integrate[
E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1,
t]);
Plot[x[t], t, 1, 3]
$endgroup$
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
add a comment |
$begingroup$
It runs forever, since you used :=
instead of =
so it was trying to integrate it each time for each different range of t
.
You need to integrate it once (which will take few seconds), and then use the result instead. Much faster now, since when you change t
, it will not integrate it again. And changed g = 0.1
to g=1/10
as it is best to use exact numbers with Integrate
Try
ClearAll[t, x]
a = 1; b = 2; c = 3; d = 4; g = 1/10; A = 1;
x[t_] = E^(-((d E^(-g t))/g) + c t) (A +
Integrate[
E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1,
t]);
Plot[x[t], t, 1, 3]
$endgroup$
It runs forever, since you used :=
instead of =
so it was trying to integrate it each time for each different range of t
.
You need to integrate it once (which will take few seconds), and then use the result instead. Much faster now, since when you change t
, it will not integrate it again. And changed g = 0.1
to g=1/10
as it is best to use exact numbers with Integrate
Try
ClearAll[t, x]
a = 1; b = 2; c = 3; d = 4; g = 1/10; A = 1;
x[t_] = E^(-((d E^(-g t))/g) + c t) (A +
Integrate[
E^((d E^(-g K[1]))/g - c K[1]) (a + b E^(g K[1])), K[1], 1,
t]);
Plot[x[t], t, 1, 3]
edited 8 hours ago
answered 8 hours ago
NasserNasser
60.4k4 gold badges92 silver badges211 bronze badges
60.4k4 gold badges92 silver badges211 bronze badges
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
add a comment |
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
$begingroup$
Many thanks, Nasser! It was very helpful!
$endgroup$
– ppp
5 hours ago
add a comment |
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%2f202574%2fplot-the-solution-from-dsolve%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
$begingroup$
Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
$endgroup$
– Michael E2
5 hours ago