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

Global Definition operator questions

mzeftel
1-Newbie

Global Definition operator questions

Hi,

I'm specifying the behavior of the global definition operator for Mathcad Prime 3.0, and have a few questions. First of all, how do you use the global definition operator in Mathcad 15? We know people like to set it up next to a plot or other results, to see what happens when you change its value. How else is the global definition useful.

We'd like to clean up some of the current behavior. In Mathcad 15, you can have this situation:

This behavior seems very confusing, especially if the values and definitions are spread throughout a worksheet.

We are defining the global definition for Prime 3.0, so that a variable can only be defined globally once in a worksheet. If a variable is defined globally, you will get an error if you try to redefine it locally. Likewise if you globally define x ~3 and x~4, you will get errors on both definitions, until you remove one of them.

Let me know if this change will cause problems for any converted worksheets.

Thanks,

Mona

31 REPLIES 31

My image of Mathcad 15 behavior didn't upload. Here it is

global-definition-15.png

For completeness, version 14 does the same thing.

This illustrates why Dixie cautions her students against globals, and why I caution my coworkers too. And why the sheets in the Roark workbook are so exasperating--there are globals all over those!

Globals are useful whenn you have an eight (or twelve, or ..) long sheet with your final result graph on the last page and you need to play "what if" with a variable that you specified on page 1 and used ten times on every page without making it the argument of functions. Disabling the first instance, and putting a global definition next to the answer graph saves an awful lot of scrolling!

Other than that, I agree with Dixie, there's too much capacity for confusion.

AlanStevens
15-Moonstone
(To:mzeftel)

I rarely use globals, but I know some engineers like to use them, when producing a Mathcad report, to put essential, but distracting constants in an appendix at the end. The constants might be commonly understood parameters (to the people who will read the report) whose values are needed for the calculations, but which can provide an annoying delay before the reader gets to the meat of the report if placed at the beginning. Personally, I'd use a collapsed region in such a case, but I've known those who prefer to use an appendix (the latter approach is more important if the recipient of the report doesn't have Mathcad, but just gets a hardcopy).

Alan

RichardJ
19-Tanzanite
(To:mzeftel)

I agree with Fred and Dixie. The only time I really "need" global definitions is when I want to change a variable that normally would be at the top of the sheet, and see what happens at the bottom. But a MUCH better option for that would be a split screen view that would allow us to view two parts of the same worksheet at once.

So impose all the restrictions you propose. I think that would break very few worksheets, and if it does they were badly written anyway

And give us a split screen view

SteenGroðe
6-Contributor
(To:mzeftel)

I also use globals very rare but I believe I use them for a trick or two. I'll have to search my archieves for it though because I can't remember any rigth off my mind.

Anyway I have suggested a different approach - give the user a tool to set a specific order regions is read in. Default is as now from left to right, top to buttom, but If a user right click one of the things that shows is the regions number (from the scan so far) and this number can the user change. Another way to implement this is to have a graph layer showing the structure as a graph the user can manipulate.

I guess this will make global equal obsolete - but I'll still have to check my files.

RichardJ
19-Tanzanite
(To:SteenGroðe)

I guess this will make global equal obsolete - but I'll still have to check my files.

Even if obsolete, it would still be needed for backward compatibility.

Joeboy
11-Garnet
(To:mzeftel)

Mona, I very rarely use Global definitions and caution my students not to use them, there are safer ways to do things.

RichardJ
19-Tanzanite
(To:mzeftel)

you will get errors on both definitions, until you remove one of them.

I assume "remove" would include simply disabling one of them?

Yes, disabling would remove a region from the calculation order, so would do the same thing as deleting a region.

Mona

I use the Global definition operator when I make (debug) an animation:

GlDefAnimation.png

Do we have an animation tolls in future version of Prime?

I use a global definition operator if I want to have a constant in my calculatuon.

I use a := operator if I want to have a variable in my calculatuon.

One example:

Nautilus.png

BertBeirinckx
4-Participant
(To:mzeftel)

I do not use a global variable. But I do fancy the idea of a split screen or a popup.

I usually create sheets with an input section, math and output. The input section can be pretty large at times, often extra input is needed along the calculation, so to examine the final results while varying the input, a split screen is very handy indeed.

But not just one split, I'd like to have multiple views on the same worksheet as I have some pretty large calculations.

It would be a very efficient tool while developing new calculations, because I then can evaluate multiple intermediate results with one click instead of scrolling through the worksheet. It would help me a lot to keep track of things and to keep focus.

MikeArmstrong
5-Regular Member
(To:mzeftel)

Will the global definition be compatible with Excel components and other scripted objects?

Mike

Mike,

Do you mean putting an global definition inside an Excel component? Can you provide an example of what you want?

Thanks,

Mona

MikeArmstrong
5-Regular Member
(To:mzeftel)

No Mona, I just remember trying to use global definitions in my early days and having issues passing the globally defined variables to say, an embedded Excel component. If the globally defined variables had the ability to be passed to any feature within the software, I believe that would be a massive improvement.

Hope that makes sense.

Mike

I don't have Prime at work, but is this what you're asking for?

Prime 2 can't do this?

It works....... Well I am shocked. I remember having issues with this in the past and wasn't able to get it to work. I also thought a globally defined variable couldn't be used in a solve block, which I have just tried and been found to be wrong again.

Mike

SteenGroðe
6-Contributor
(To:mzeftel)

I just came across... I use it when I want to write parametric functions. Like y.a,b(x):=a*x+b

I have to use shift+ctrl+k to make the left side so this can be improved and the I have to use either a definition to a and b before the function or which I prefer somewhere else.

RichardJ
19-Tanzanite
(To:SteenGroðe)

Can you provide an example in a Mathcad worksheet?

SteenGroðe
6-Contributor
(To:RichardJ)

Yes, but how do I attach a file in here???? This actually says a lot about this forum!

RichardJ
19-Tanzanite
(To:SteenGroðe)

Yes, that is very confusing. At the top right of the editor, in very small type, it says "Use Advanced Editor". Click on that, and you can attach a file.

The advanced editor used to be the default. I don't know why they changed it.

MikeArmstrong
5-Regular Member
(To:RichardJ)

I'm sure it was changed when everyone was having issues with posts not registering and collabs where multi posting.

Mike

SteenGroðe
6-Contributor
(To:RichardJ)

I actually had checked the advanced but who could know I had to look in the buttom...

RichardJ
19-Tanzanite
(To:SteenGroðe)

Yes, OK. I see what you mean. Sometimes I would also like to be able to write the function defintion before I define the parameters, because that's the way it's often done in books.

I actually had checked the advanced but who could know I had to look in the buttom...

It certainly would be a lot easier of they just put an "Attach Files" in the basic editor. Top or bottom.

Steen,

Thanks for the example. It looks like the proposal for global definition in Mathcad Prime 3.0, will work just fine with how you want to use it.

Mona

SteenGroðe
6-Contributor
(To:mzeftel)

So far so good, but please pay attention to another indirect proposal in my very basic example. I have been asking for this since v6 so it is not a new one:

An option to define parametric functions where the parameters actually not is constants. I would like to have the opportunity to have variables as an "index", so Mathcad/Prime can handle at least three different indicies.

And speaking of indices - for the matrixes (this is my spelling but feel free to use it) or actually when in connection with recursive function could the parser be a little more intelligent. Sometimes I would wish that the parser could handle situations where the user didn't define everything, most obvious the user neglects to define n. It is more or less what the graphical window in Mathcad does - defines x to -10 to 10 if you don't do anything, why not have the index defined properly kind of 0 to 10 or 1 to 10 what ever will be the correct thing in the case. Inclued an option to just define the end point and let the parser handle the beginning. I asking this because I know it is difficult for most users.

Steen,


I'm not sure that most users want their matrices with indexes from 0-10 or 1-10? It seems that many users have much larger matrices. Even if someone defined the endpoint, the interval may not always be 1. However, maybe it's easier to start with a default, and then edit it. That's what we did with the input and output expressions for the new Excel component.

Can others weigh in on this?

Thanks,


Mona

MikeArmstrong
5-Regular Member
(To:mzeftel)

I tend to agree Mona with not limiting the size of indices, but I do also like Steen's proposal of more indices applied to a variable.

Mike

SteenGroðe
6-Contributor
(To:mzeftel)

I must try to see if I can explain myself a bit better about a more intelligent parser in conjunction with recursive functions. As it is now, the parser takes care of situations where a user has to define the n-th element by setting the elements from 0 to n-1 equals to zero. That's fine and I do not want changed.
But when you use the index to define a recursive function which sets the nth element from previous elements you instead get an error message if you haven't defined any initial value.
The difference between the two situations is that in the first case you define a particular element in an array to a specific numerical value, while in the second case you define an arbitrary element in a matrix as a calculation of the previous elements without defining an initial element. If the translator in the last case was thinking something like: Okay, the user has not determined a n, I let n be temporarily 10, and let me define element at Origin to 0 (in some cases both this and as well the netxt and the next depending on how many is needed according to the recursive definition and accept defintionen calculating until n equals 10 (or the first 10 calculated elements), instead of thinking that I do not know n so I must flag with an error.

Did this help?

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."