Problem with TransformedDistributionCalculate probability functionWhen are `If`, `Piecewise`, `Switch`, and `Which` interchangeable and when are they not?Calculate PDF and CDF of a product of independent exponentially distributed random variablesConditional probabilityFullSimplify on TransformedDistributionNProbability not reliability analysis?TransformedDistribution using $k$ iid random variables, but $k$ not fixedConvolve discrete random variables efficientlyProbability distribution defined by partitioning an intervalDistribution of Function of Random Sum of Random Variables

copy and scale one figure (wheel)

Lowest total scrabble score

Yosemite Fire Rings - What to Expect?

Creepy dinosaur pc game identification

What is the evidence for the "tyranny of the majority problem" in a direct democracy context?

The probability of Bus A arriving before Bus B

What is this called? Old film camera viewer?

Is this toilet slogan correct usage of the English language?

Does a 'pending' US visa application constitute a denial?

Why should universal income be universal?

Loading commands from file

Are the IPv6 address space and IPv4 address space completely disjoint?

Multiplicative persistence

How to indicate a cut out for a product window

How can I block email signup overlays or javascript popups in Safari?

Is it improper etiquette to ask your opponent what his/her rating is before the game?

Why is it that I can sometimes guess the next note?

Sklearn 'Seed' Not Working Properly In a Section of Code

How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?

How should I respond when I lied about my education and the company finds out through background check?

Store Credit Card Information in Password Manager?

Is the U.S. Code copyrighted by the Government?

How much character growth crosses the line into breaking the character

If infinitesimal transformations commute why dont the generators of the Lorentz group commute?



Problem with TransformedDistribution


Calculate probability functionWhen are `If`, `Piecewise`, `Switch`, and `Which` interchangeable and when are they not?Calculate PDF and CDF of a product of independent exponentially distributed random variablesConditional probabilityFullSimplify on TransformedDistributionNProbability not reliability analysis?TransformedDistribution using $k$ iid random variables, but $k$ not fixedConvolve discrete random variables efficientlyProbability distribution defined by partitioning an intervalDistribution of Function of Random Sum of Random Variables













1












$begingroup$


I am trying to use Mathematica to obtain the probability distribution of $frac12(A + B)$ where $A$ and $B$ are independent random variables each distributed according to the uniform distribution, with lower and upper bounds of $L$ and $H$ respectively.



I suspect the distribution is triangular with lower and upper bounds of $L$ and $H$ respectively and mode equal to $frac12(A + B)$. However, I am having difficulty using TransformedDistribution to show that.



My code is:



[ScriptCapitalD] = TransformedDistribution[1/2 (A + B), B [Distributed] UniformDistribution[L, H], A [Distributed] UniformDistribution[L, H]]









share|improve this question











$endgroup$











  • $begingroup$
    That was a typo. But I am still not getting what I expect.
    $endgroup$
    – user120911
    1 hour ago










  • $begingroup$
    Did you try PDF[[ScriptCapitalD], y]?
    $endgroup$
    – JimB
    1 hour ago










  • $begingroup$
    PDF[[ScriptCapitalD], y] produces one expression with a denominator that looks correct, but the triangular distribution is split at the mode. Mathematica is not showing that. At least not in a way that is easy to see.
    $endgroup$
    – user120911
    1 hour ago











  • $begingroup$
    Are you aware TriangularDistribution[] is built-in?
    $endgroup$
    – J. M. is slightly pensive
    1 hour ago






  • 1




    $begingroup$
    Why not check the PDFs? Simplify[PDF[TransformedDistribution[(a + b)/2, a, b [Distributed] UniformDistribution[l, h, l, h]], t] == PDF[TriangularDistribution[l, h], t], l < t < h]
    $endgroup$
    – J. M. is slightly pensive
    41 mins ago















1












$begingroup$


I am trying to use Mathematica to obtain the probability distribution of $frac12(A + B)$ where $A$ and $B$ are independent random variables each distributed according to the uniform distribution, with lower and upper bounds of $L$ and $H$ respectively.



I suspect the distribution is triangular with lower and upper bounds of $L$ and $H$ respectively and mode equal to $frac12(A + B)$. However, I am having difficulty using TransformedDistribution to show that.



My code is:



[ScriptCapitalD] = TransformedDistribution[1/2 (A + B), B [Distributed] UniformDistribution[L, H], A [Distributed] UniformDistribution[L, H]]









share|improve this question











$endgroup$











  • $begingroup$
    That was a typo. But I am still not getting what I expect.
    $endgroup$
    – user120911
    1 hour ago










  • $begingroup$
    Did you try PDF[[ScriptCapitalD], y]?
    $endgroup$
    – JimB
    1 hour ago










  • $begingroup$
    PDF[[ScriptCapitalD], y] produces one expression with a denominator that looks correct, but the triangular distribution is split at the mode. Mathematica is not showing that. At least not in a way that is easy to see.
    $endgroup$
    – user120911
    1 hour ago











  • $begingroup$
    Are you aware TriangularDistribution[] is built-in?
    $endgroup$
    – J. M. is slightly pensive
    1 hour ago






  • 1




    $begingroup$
    Why not check the PDFs? Simplify[PDF[TransformedDistribution[(a + b)/2, a, b [Distributed] UniformDistribution[l, h, l, h]], t] == PDF[TriangularDistribution[l, h], t], l < t < h]
    $endgroup$
    – J. M. is slightly pensive
    41 mins ago













1












1








1





$begingroup$


I am trying to use Mathematica to obtain the probability distribution of $frac12(A + B)$ where $A$ and $B$ are independent random variables each distributed according to the uniform distribution, with lower and upper bounds of $L$ and $H$ respectively.



I suspect the distribution is triangular with lower and upper bounds of $L$ and $H$ respectively and mode equal to $frac12(A + B)$. However, I am having difficulty using TransformedDistribution to show that.



My code is:



[ScriptCapitalD] = TransformedDistribution[1/2 (A + B), B [Distributed] UniformDistribution[L, H], A [Distributed] UniformDistribution[L, H]]









share|improve this question











$endgroup$




I am trying to use Mathematica to obtain the probability distribution of $frac12(A + B)$ where $A$ and $B$ are independent random variables each distributed according to the uniform distribution, with lower and upper bounds of $L$ and $H$ respectively.



I suspect the distribution is triangular with lower and upper bounds of $L$ and $H$ respectively and mode equal to $frac12(A + B)$. However, I am having difficulty using TransformedDistribution to show that.



My code is:



[ScriptCapitalD] = TransformedDistribution[1/2 (A + B), B [Distributed] UniformDistribution[L, H], A [Distributed] UniformDistribution[L, H]]






probability-or-statistics






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago







user120911

















asked 1 hour ago









user120911user120911

71328




71328











  • $begingroup$
    That was a typo. But I am still not getting what I expect.
    $endgroup$
    – user120911
    1 hour ago










  • $begingroup$
    Did you try PDF[[ScriptCapitalD], y]?
    $endgroup$
    – JimB
    1 hour ago










  • $begingroup$
    PDF[[ScriptCapitalD], y] produces one expression with a denominator that looks correct, but the triangular distribution is split at the mode. Mathematica is not showing that. At least not in a way that is easy to see.
    $endgroup$
    – user120911
    1 hour ago











  • $begingroup$
    Are you aware TriangularDistribution[] is built-in?
    $endgroup$
    – J. M. is slightly pensive
    1 hour ago






  • 1




    $begingroup$
    Why not check the PDFs? Simplify[PDF[TransformedDistribution[(a + b)/2, a, b [Distributed] UniformDistribution[l, h, l, h]], t] == PDF[TriangularDistribution[l, h], t], l < t < h]
    $endgroup$
    – J. M. is slightly pensive
    41 mins ago
















  • $begingroup$
    That was a typo. But I am still not getting what I expect.
    $endgroup$
    – user120911
    1 hour ago










  • $begingroup$
    Did you try PDF[[ScriptCapitalD], y]?
    $endgroup$
    – JimB
    1 hour ago










  • $begingroup$
    PDF[[ScriptCapitalD], y] produces one expression with a denominator that looks correct, but the triangular distribution is split at the mode. Mathematica is not showing that. At least not in a way that is easy to see.
    $endgroup$
    – user120911
    1 hour ago











  • $begingroup$
    Are you aware TriangularDistribution[] is built-in?
    $endgroup$
    – J. M. is slightly pensive
    1 hour ago






  • 1




    $begingroup$
    Why not check the PDFs? Simplify[PDF[TransformedDistribution[(a + b)/2, a, b [Distributed] UniformDistribution[l, h, l, h]], t] == PDF[TriangularDistribution[l, h], t], l < t < h]
    $endgroup$
    – J. M. is slightly pensive
    41 mins ago















$begingroup$
That was a typo. But I am still not getting what I expect.
$endgroup$
– user120911
1 hour ago




$begingroup$
That was a typo. But I am still not getting what I expect.
$endgroup$
– user120911
1 hour ago












$begingroup$
Did you try PDF[[ScriptCapitalD], y]?
$endgroup$
– JimB
1 hour ago




$begingroup$
Did you try PDF[[ScriptCapitalD], y]?
$endgroup$
– JimB
1 hour ago












$begingroup$
PDF[[ScriptCapitalD], y] produces one expression with a denominator that looks correct, but the triangular distribution is split at the mode. Mathematica is not showing that. At least not in a way that is easy to see.
$endgroup$
– user120911
1 hour ago





$begingroup$
PDF[[ScriptCapitalD], y] produces one expression with a denominator that looks correct, but the triangular distribution is split at the mode. Mathematica is not showing that. At least not in a way that is easy to see.
$endgroup$
– user120911
1 hour ago













$begingroup$
Are you aware TriangularDistribution[] is built-in?
$endgroup$
– J. M. is slightly pensive
1 hour ago




$begingroup$
Are you aware TriangularDistribution[] is built-in?
$endgroup$
– J. M. is slightly pensive
1 hour ago




1




1




$begingroup$
Why not check the PDFs? Simplify[PDF[TransformedDistribution[(a + b)/2, a, b [Distributed] UniformDistribution[l, h, l, h]], t] == PDF[TriangularDistribution[l, h], t], l < t < h]
$endgroup$
– J. M. is slightly pensive
41 mins ago




$begingroup$
Why not check the PDFs? Simplify[PDF[TransformedDistribution[(a + b)/2, a, b [Distributed] UniformDistribution[l, h, l, h]], t] == PDF[TriangularDistribution[l, h], t], l < t < h]
$endgroup$
– J. M. is slightly pensive
41 mins ago










2 Answers
2






active

oldest

votes


















2












$begingroup$

You get what you expect if you do it it in two steps



[ScriptCapitalD] = 
TransformedDistribution[x/2,
x [Distributed] TransformedDistribution[(A + B),
B [Distributed] UniformDistribution[L, H],
A [Distributed] UniformDistribution[L, H]]]

(* TriangularDistribution[L, H] *)





share|improve this answer









$endgroup$












  • $begingroup$
    That is very nice!
    $endgroup$
    – user120911
    20 mins ago


















0












$begingroup$

PDF[[ScriptCapitalD]][z]



(((-30 + z)Sign[-30 + z])/2 - (-20 + z)
Sign[-20 + z] + ((-10 + z)*Sign[-10 + z])/2)/100




For plotting, assign values to L and H:



L = 10; H = 30;
Plot[Evaluate@PDF[[ScriptCapitalD]][x], x, 10, 30]


enter image description here



pdF[l_, h_] := Module[L = l, H = h, Evaluate[PDF[[ScriptCapitalD]]]]
Plot[Evaluate @ Flatten@Table[pdF[l, h][x], l, 0, 5, h, 10, 15], x, 0, 15,
PlotRange -> All,
PlotLegends -> (Flatten @ Table[ToString@l, h, l, 0, 5, h, 10, 15])]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
    $endgroup$
    – user120911
    1 hour ago











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



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193838%2fproblem-with-transformeddistribution%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2












$begingroup$

You get what you expect if you do it it in two steps



[ScriptCapitalD] = 
TransformedDistribution[x/2,
x [Distributed] TransformedDistribution[(A + B),
B [Distributed] UniformDistribution[L, H],
A [Distributed] UniformDistribution[L, H]]]

(* TriangularDistribution[L, H] *)





share|improve this answer









$endgroup$












  • $begingroup$
    That is very nice!
    $endgroup$
    – user120911
    20 mins ago















2












$begingroup$

You get what you expect if you do it it in two steps



[ScriptCapitalD] = 
TransformedDistribution[x/2,
x [Distributed] TransformedDistribution[(A + B),
B [Distributed] UniformDistribution[L, H],
A [Distributed] UniformDistribution[L, H]]]

(* TriangularDistribution[L, H] *)





share|improve this answer









$endgroup$












  • $begingroup$
    That is very nice!
    $endgroup$
    – user120911
    20 mins ago













2












2








2





$begingroup$

You get what you expect if you do it it in two steps



[ScriptCapitalD] = 
TransformedDistribution[x/2,
x [Distributed] TransformedDistribution[(A + B),
B [Distributed] UniformDistribution[L, H],
A [Distributed] UniformDistribution[L, H]]]

(* TriangularDistribution[L, H] *)





share|improve this answer









$endgroup$



You get what you expect if you do it it in two steps



[ScriptCapitalD] = 
TransformedDistribution[x/2,
x [Distributed] TransformedDistribution[(A + B),
B [Distributed] UniformDistribution[L, H],
A [Distributed] UniformDistribution[L, H]]]

(* TriangularDistribution[L, H] *)






share|improve this answer












share|improve this answer



share|improve this answer










answered 33 mins ago









Bob HanlonBob Hanlon

60.9k33597




60.9k33597











  • $begingroup$
    That is very nice!
    $endgroup$
    – user120911
    20 mins ago
















  • $begingroup$
    That is very nice!
    $endgroup$
    – user120911
    20 mins ago















$begingroup$
That is very nice!
$endgroup$
– user120911
20 mins ago




$begingroup$
That is very nice!
$endgroup$
– user120911
20 mins ago











0












$begingroup$

PDF[[ScriptCapitalD]][z]



(((-30 + z)Sign[-30 + z])/2 - (-20 + z)
Sign[-20 + z] + ((-10 + z)*Sign[-10 + z])/2)/100




For plotting, assign values to L and H:



L = 10; H = 30;
Plot[Evaluate@PDF[[ScriptCapitalD]][x], x, 10, 30]


enter image description here



pdF[l_, h_] := Module[L = l, H = h, Evaluate[PDF[[ScriptCapitalD]]]]
Plot[Evaluate @ Flatten@Table[pdF[l, h][x], l, 0, 5, h, 10, 15], x, 0, 15,
PlotRange -> All,
PlotLegends -> (Flatten @ Table[ToString@l, h, l, 0, 5, h, 10, 15])]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
    $endgroup$
    – user120911
    1 hour ago
















0












$begingroup$

PDF[[ScriptCapitalD]][z]



(((-30 + z)Sign[-30 + z])/2 - (-20 + z)
Sign[-20 + z] + ((-10 + z)*Sign[-10 + z])/2)/100




For plotting, assign values to L and H:



L = 10; H = 30;
Plot[Evaluate@PDF[[ScriptCapitalD]][x], x, 10, 30]


enter image description here



pdF[l_, h_] := Module[L = l, H = h, Evaluate[PDF[[ScriptCapitalD]]]]
Plot[Evaluate @ Flatten@Table[pdF[l, h][x], l, 0, 5, h, 10, 15], x, 0, 15,
PlotRange -> All,
PlotLegends -> (Flatten @ Table[ToString@l, h, l, 0, 5, h, 10, 15])]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
    $endgroup$
    – user120911
    1 hour ago














0












0








0





$begingroup$

PDF[[ScriptCapitalD]][z]



(((-30 + z)Sign[-30 + z])/2 - (-20 + z)
Sign[-20 + z] + ((-10 + z)*Sign[-10 + z])/2)/100




For plotting, assign values to L and H:



L = 10; H = 30;
Plot[Evaluate@PDF[[ScriptCapitalD]][x], x, 10, 30]


enter image description here



pdF[l_, h_] := Module[L = l, H = h, Evaluate[PDF[[ScriptCapitalD]]]]
Plot[Evaluate @ Flatten@Table[pdF[l, h][x], l, 0, 5, h, 10, 15], x, 0, 15,
PlotRange -> All,
PlotLegends -> (Flatten @ Table[ToString@l, h, l, 0, 5, h, 10, 15])]


enter image description here






share|improve this answer









$endgroup$



PDF[[ScriptCapitalD]][z]



(((-30 + z)Sign[-30 + z])/2 - (-20 + z)
Sign[-20 + z] + ((-10 + z)*Sign[-10 + z])/2)/100




For plotting, assign values to L and H:



L = 10; H = 30;
Plot[Evaluate@PDF[[ScriptCapitalD]][x], x, 10, 30]


enter image description here



pdF[l_, h_] := Module[L = l, H = h, Evaluate[PDF[[ScriptCapitalD]]]]
Plot[Evaluate @ Flatten@Table[pdF[l, h][x], l, 0, 5, h, 10, 15], x, 0, 15,
PlotRange -> All,
PlotLegends -> (Flatten @ Table[ToString@l, h, l, 0, 5, h, 10, 15])]


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









kglrkglr

189k10206424




189k10206424











  • $begingroup$
    That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
    $endgroup$
    – user120911
    1 hour ago

















  • $begingroup$
    That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
    $endgroup$
    – user120911
    1 hour ago
















$begingroup$
That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
$endgroup$
– user120911
1 hour ago





$begingroup$
That confirms my intution, but can you get Mathematica to output the PDF for the triangular distribution? That is what I am having trouble doing.
$endgroup$
– user120911
1 hour 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%2f193838%2fproblem-with-transformeddistribution%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

Era Viking Índice Início da Era Viquingue | Cotidiano | Sociedade | Língua | Religião | A arte | As primeiras cidades | As viagens dos viquingues | Viquingues do Oeste e Leste | Fim da Era Viquingue | Fontes históricas | Referências Bibliografia | Ligações externas | Menu de navegação«Sverige då!»«Handel I vikingetid»«O que é Nórdico Antigo»Mito, magia e religião na volsunga saga Um olhar sobre a trajetória mítica do herói sigurd«Bonden var den verklige vikingen»«Vikingatiden»«Vikingatiden»«Vinland»«Guerreiras de Óðinn: As Valkyrjor na Mitologia Viking»1519-9053«Esculpindo símbolos e seres: A arte viking em pedras rúnicas»1679-9313Historia - Tema: VikingarnaAventura e Magia no Mundo das Sagas IslandesasEra Vikinge

What's the metal clinking sound at the end of credits in Avengers: Endgame?What makes Thanos so strong in Avengers: Endgame?Who is the character that appears at the end of Endgame?What happens to Mjolnir (Thor's hammer) at the end of Endgame?The People's Ages in Avengers: EndgameWhat did Nebula do in Avengers: Endgame?Messing with time in the Avengers: Endgame climaxAvengers: Endgame timelineWhat are the time-travel rules in Avengers Endgame?Why use this song in Avengers: Endgame Opening Logo Sequence?Peggy's age in Avengers Endgame

Are there legal definitions of ethnicities/races? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Legal definitions in the United StatesAre there truly legal limits on US interest rates?Are gender identity and sexual orientation federally protected?Why is there an apparent legal bias against digital services?What limits are there to the powers of individual judges in the United States legal system?Are women only scholarships legal under Irish / EU law?Is the term “race” defined by Public Law enacted by Congress of the United StatesIs there a legal definition of race in the US?Neighbors are spying for landlord on Renters is it legal?Are Protected Classes Bi-directional?