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;








1












$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



enter image description here



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



enter image description here



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!










share|improve this question









$endgroup$











  • $begingroup$
    Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
    $endgroup$
    – Michael E2
    5 hours ago

















1












$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



enter image description here



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



enter image description here



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!










share|improve this question









$endgroup$











  • $begingroup$
    Possible duplicates: mathematica.stackexchange.com/questions/95177/…, mathematica.stackexchange.com/questions/45450/…
    $endgroup$
    – Michael E2
    5 hours ago













1












1








1





$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



enter image description here



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



enter image description here



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!










share|improve this question









$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



enter image description here



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



enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
















  • $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










1 Answer
1






active

oldest

votes


















6












$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]


Mathematica graphics



Mathematica graphics






share|improve this answer











$endgroup$












  • $begingroup$
    Many thanks, Nasser! It was very helpful!
    $endgroup$
    – ppp
    5 hours ago













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
);



);













draft saved

draft discarded


















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









6












$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]


Mathematica graphics



Mathematica graphics






share|improve this answer











$endgroup$












  • $begingroup$
    Many thanks, Nasser! It was very helpful!
    $endgroup$
    – ppp
    5 hours ago















6












$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]


Mathematica graphics



Mathematica graphics






share|improve this answer











$endgroup$












  • $begingroup$
    Many thanks, Nasser! It was very helpful!
    $endgroup$
    – ppp
    5 hours ago













6












6








6





$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]


Mathematica graphics



Mathematica graphics






share|improve this answer











$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]


Mathematica graphics



Mathematica graphics







share|improve this answer














share|improve this answer



share|improve this answer








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
















  • $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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її