Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Want the oppurtunity to discuss enhancements to PTC products? Join a working group!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Nov 27, 2020
08:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
08:28 AM

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.html#<<, 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

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.html#<<, 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

Solved! Go to Solution.

ACCEPTED SOLUTION

Accepted Solutions

Nov 27, 2020
10:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
10:43 AM

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:

https://community.ptc.com/t5/PTC-Mathcad/Prime-Express-A-joke/m-p/604216#M185378

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

Nov 27, 2020
08:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
08:36 AM

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

Nov 27, 2020
09:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
09:05 AM

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.

Nov 27, 2020
10:16 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
10:16 AM

Many thanks for the quick response LucMeekes and Werner!

Please find attached the worksheet.

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!

Nov 27, 2020
10:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
10:43 AM

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:

https://community.ptc.com/t5/PTC-Mathcad/Prime-Express-A-joke/m-p/604216#M185378

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...

Nov 27, 2020
11:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
11:05 AM

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!

Nov 27, 2020
11:16 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
11:16 AM

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

Nov 27, 2020
11:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
11:23 AM

@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.

Nov 27, 2020
02:31 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 27, 2020
02:31 PM

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.

Dec 01, 2020
02:26 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 01, 2020
02:26 PM

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!