cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

## Plotting / Calculating probability distributions  3-Visitor

## Plotting / Calculating probability distributions

Hi,
IÂ´m currently using MathCad_Prime6.0 trial version as I need to edit some of my old scipts calculating statistic methods from my former studies. So I use those scripts as I set them up 5 months ago, calculating probability distributions and convolutions of them.
Trying to plot them in a diagram, identically according to e.g. >>https://support.ptc.com/help/mathcad/r6.0/de/PTC_Mathcad_Help/example_prob_dens_and_cum_prob_dist.ht...<<, plotting does not work graphically (there is only a single point in the plot depending on the diagram type, for instance), nor is an error message displayed. When changing the diagram type, the scaling, the variables or the functions nothing happens either. So is this connected to the trial version licence or am I missing something else? Unfortunately I cannot add a screenshot, but its excactly the typing of the example shown in the link. Maybe you can give me a short support. Thanks a lot in advance! Marco
1 ACCEPTED SOLUTION

Accepted Solutions  23-Emerald II
(To:MA_9732294)

You're using the dnorm() function, which PTC marks as a 'premium function'. This means it is not available in Prime express (the free edition of Prime).

If you've set this up more than a month ago, shortly after you started using the trial version, then you've now run out of the 30-day period where the trial will give you access to all functionality of Prime.

But don't despair. The dnorm() function can fairly easily be built, and is available through:

Success!
Luc

PS. I see that in your 'convolution', the definition of fA_1, you multiply fB_1(x) with an integral.

The result of that integral is NOT a function of x.

So when calculating PA_1, where you essentially integrate fA_1 over the range 0 to tau.max, you might as well put the integral involving fF(x) out of that integral. See: I suspect that is not what you intended to do, so i suggest you review your convolution formula...

9 REPLIES 9  23-Emerald II
(To:MA_9732294)

It's generally not necessary to attach a screenshot, even though that should be simple to do.

More important is that you attach your Prime worksheet.

That'll surely help to solve your problem.

Success!
Luc  24-Ruby V
(To:MA_9732294)

I can only agree with Luc and strongly recommend that you attach the worksheet.

As you just see one point, chances are that you have assigned a value to variable x somewhere above the plot. That way x can't be used for a quickplot.

Solutions would be to either

1) redefine x as a range (above the plot), like x:=-4,-3.99 .. 6

or

2) Use a different variable name for plotting, like xx. Note that you have to change every x in the plot for xx if you chose this option.

or

3) Write clear(x) somewhere above the plot in case you no longer need the value of the variable x that you assigned earlier.  3-Visitor
(To:Werner_E)

Many thanks for the quick response LucMeekes and Werner!

This is basically the function fA_1 which does not plot. I once scriptted it working, but currently there are no error messages, like complex numbers or NaNs for instance - and I´m wondering if this contains any trail-version-blocked funtion 😕

Many thanks for the help, I appreciate it!  23-Emerald II
(To:MA_9732294)

You're using the dnorm() function, which PTC marks as a 'premium function'. This means it is not available in Prime express (the free edition of Prime).

If you've set this up more than a month ago, shortly after you started using the trial version, then you've now run out of the 30-day period where the trial will give you access to all functionality of Prime.

But don't despair. The dnorm() function can fairly easily be built, and is available through:

Success!
Luc

PS. I see that in your 'convolution', the definition of fA_1, you multiply fB_1(x) with an integral.

The result of that integral is NOT a function of x.

So when calculating PA_1, where you essentially integrate fA_1 over the range 0 to tau.max, you might as well put the integral involving fF(x) out of that integral. See: I suspect that is not what you intended to do, so i suggest you review your convolution formula...  24-Ruby V
(To:MA_9732294)

Additionally to what Luc already wrote, you should be aware that you used the built-in "convolve" function in a wrong way. "convolve" will only work on vectors or matrices, not on functions. Look it up in the help.

If I deactivate your second definition of f.A_1 and active the first one (which probably doesn't do what you have in mind as this definition simply multiplies f.B_1 by the constant value 0.741) I get the plots without problems using the full version of Prime. If you don't, the reason may be that you have exceeded the evaluation period and the software turned into the limited Express version, where dnorm is not available. If thats the case you sure should have a look at Luc's great collection of workarounds for Express!  23-Emerald II
(To:Werner_E)

The function is called convolve(), and it replaces several (now deprecated) functions. Note that: means that dnorm is a 'premium' function, so not available in Prime Express...

But it's easily defined with: Luc  24-Ruby V
(To:LucMeekes)

@LucMeekes wrote:

The function is called convolve(), and it replaces several (now deprecated) functions.

Yes, I erroneously called it "convolute" (is now fixed).
But the point remains that "convolve" cannot be applied to functions, as the OP had mistakenly tried.  23-Emerald I
(To:MA_9732294)

Okay.

Since I only have Express, I've already either built or stolen the redefined "premium functions."

Attached is my Prime Express 6.0 sheet, you will note that I've already addressed most of Luc's and Werner's comments.  "convolve" is not a premium function (don't ask!), so I've created two arbitrary vectors and convolved them, shown on the plot.   3-Visitor
(To:MA_9732294)

Alright got it, thanks everybody!

On the way to set the worksheet for the right solution, it turned out that the root cause was probably a mixture of:
- the issue with the premium functions you mentioned
- the trial version (30days) runtime activation (re-start and re-connect Mathcad requiered)
- Updating the worksheet (save and re-open with correct trial activition)
Now it works.

Thank you all very much for the comprehensive, competent and above all very fast answers! 