Get Help

Turn on suggestions

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: I can't seem to get the summation function to ...

Options

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

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

Showing results for

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

10-20-2019
02:57 PM

10-20-2019
02:57 PM

Here is the issue, I've tried every which way to get this summation to work, but it keeps giving me an "undefined variable" error. I tried adding the matrix vector operator "[" to indicate the "i" index, but that didn't seem to work either.

Can someone point me in the right direction here?

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

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

10-20-2019
04:29 PM

10-20-2019
04:29 PM

1) You used the wrong equal sign when you tried to define alpha and lambda. You must use the assignment (:=) and not the boolean (the bold equal sign)

2) At least lambda must also be assigned the correct unit (1/s) as otherwise you get an error because the exponent lambda*t2 must be dimensionless. You may consider assigning alpha a correct unit, too, so the outcome Gamma.total can be shown with the correct unit.

Gamma normally will be shown in W. If you want MeV/s to be seen, you simply overwrite W by the unit you want to see and Prime adjusts the rest as needed.

8 REPLIES 8

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

10-20-2019
03:55 PM

10-20-2019
03:55 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

Hi,

Matrix indexing is first element is numbered zero by default. Your summation interval is 1 to 11.

Two options.

One change the indexing to 0 to 10

Two set the worksheet variable ORIGIN := 1

Cheers

Terry

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

10-20-2019
03:59 PM

10-20-2019
03:59 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

Hi,

You also need to add the indexing [i to each instance of alpha and lambda in the summations

Cheers

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

10-20-2019
04:14 PM

10-20-2019
04:14 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

So, I added '[' index i's to all of the lambda and alpha terms and changed the summation bounds from i=0 to 10, but MATHCAD is still giving me the same error.

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

10-20-2019
04:10 PM

10-20-2019
04:10 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

Your first approach can't work the way you had set it up but there might be a simples way doing it using vectorization

Your second approach should work if you have set ORIGIN to 1 and if you used the correct subscript (matrix index as you said you have done) and if the various P.. and t.. are defined above.

The error message you describe ("undefined variable") indicates that the problem is not a wrong ORIGIN setting but rather a problem with Prime's infamous auto-label feature. Check if all lambda and all alpha are labelled the same (either "variable" or "-").

It's hard to debug just a picture and so it would be a good idea if you attach your worksheet as well.

If you don't use the latest version of Prime you should also state which version you are using.

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

10-20-2019
04:18 PM

10-20-2019
04:18 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

I'm not really sure what you mean by "setting ORIGEN:=1." I attached my worksheet and made corrections to the indexing range. The problem starts on page #4. I'm using Prime 5.0.

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

10-20-2019
04:29 PM

10-20-2019
04:29 PM

1) You used the wrong equal sign when you tried to define alpha and lambda. You must use the assignment (:=) and not the boolean (the bold equal sign)

2) At least lambda must also be assigned the correct unit (1/s) as otherwise you get an error because the exponent lambda*t2 must be dimensionless. You may consider assigning alpha a correct unit, too, so the outcome Gamma.total can be shown with the correct unit.

Gamma normally will be shown in W. If you want MeV/s to be seen, you simply overwrite W by the unit you want to see and Prime adjusts the rest as needed.

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

10-20-2019
04:41 PM

10-20-2019
04:41 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

That is exactly what the problem was. I knew it had to have been something simple that I had overlooked. Thank you for taking a look for me.

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

10-20-2019
04:47 PM

10-20-2019
04:47 PM

Re: I can't seem to get the summation function to work properly in mathcad using pre-defined vectors

Addendum:

ORIGIN is a system variable which determines what the number of the first element of a vector would be. By default its value is 0. You can change the value of ORIGIN in the calculation menu or simply by typing ORIGIN:=1 (or an other value) on top of your worksheet.

To avoid the hassle in your sum you can replace the start value by ORIGIN and as stop value you may use last(lambda) or last(alpha) as shown in the first sum in the picture below. This makes the calculation independent of the current value of ORIGIN.

As mentioned in my first replay there is also a way to avoid the index i by using vectorization. Its an ORIGIN-independent calculation, too. This is shown here:

Worksheet in P5 format attached.