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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

The parameter ORIGIN does not work inside a program block.

JCBanks
11-Garnet

The parameter ORIGIN does not work inside a program block.

I am using Mathcad Prime Release 9.0 and Datecode9.0.0.0

The parameter ORIGIN does not work inside a program block.

Here are the errors that I faced:
The parameter ORIGIN does not work inside a program block.

10 REPLIES 10
LucMeekes
23-Emerald III
(To:JCBanks)

Please attach a worksheet that demonstrates the problem that you are experiencing.

 

Success!
Luc

Attached is the file with the reported issue.

Thanks,

Julio C. Banks

Solutions Consultant

Doing Business by the Book

e-mail: Creo_Solutions@Outlook.com

(772) 577-9744

P Please consider the environment before printing this email.

Education is a better safeguard of liberty than a standing army"

Edward Everett

.

LucMeekes
23-Emerald III
(To:JCBanks)

Attachments to your mail do (apparently) NOT make it to this forum, so I cannot see it.

Check: https://community.ptc.com/t5/Mathcad-Installation/The-parameter-ORIGIN-does-not-work-inside-a-program-block/m-p/899806#M3295

 

Success!
Luc

Dear Luc, the System parameter, ORIGIN, does not

work inside programming blocks.

 

Attached is the work book you provided which I

modified to demonstrate the issue.

 

The program in Mathcad Prime 9.0 is intended

for "reader using software such as Excel" that

thy can implement but thank you anyway for

indicating to me that it is a built-in function.

 

Please advise, Luc

LucMeekes
23-Emerald III
(To:JCBanks)

As I explained, you should not (try to) modify the value of ORIGIN within a program; it does not work.

If you delete the first assignment in that program

ORIGIN <- 1

Then the program calculates the correct value of Q, irrespective of the setting of ORIGIN.

 

In short: Don't change ORIGIN in a worksheet. You normally should use it. E.g. to sum all values of an array, use:

LucMeekes_0-1694630810565.png

This will let the index i run from the first index (no matter what the setting of ORIGIN is, it can be 0, 1  or -200) to the last index. as shown here:

LucMeekes_1-1694631042603.png

Now if you change ORIGIN to any (other, integer) value , Sum(A) will still produce the same answer. And if you change the number of elements in A, the result will follow accordingly.

 

Success!
Luc

Understood, Luc.

 

It seems logical to me that if ORIGIN set on the outside

of a programming block controls the definition of the

ORIGIN of  arrays then it should also work inside

Programing blocks.

 

In any event, I could live with the fact Mathcad does

not allow the user to define "The arrays ORIGIN inside

programing blocks".

 

The question I have is:

 

Is it logical for the Mathcad Prime software to

allow a "Local definition of ORIGIN" when it is

 "defined inside a Programming block"? - As a

customer requested enhancement?

 

I do not see why this suggestion would not be

logical.

 

Please advise the logic of not allowing the definition

of the ORIGIN of arrays that are only used within

Programing blocks.

 

Thanks, Luc.

LucMeekes
23-Emerald III
(To:JCBanks)

You should think of ORIGIN as being a setting, not a variable. And one shouldn't mess with settings...

Note that there are many programming languages where the index start is fixed, generally 0, sometimes 1, but you cannot change it. There may not be many applications that call for other values than 0 or 1, At least Mathcad allows to change it at will on worksheet level.

It's logical in the sense that it's always been this way, with Mathcad, and now with Prime.

As to why?  My guess is as good as yours, we're in the same boat: users.

 

Success!
Luc

Luc, I will define the ORIGIN outside the Programming blocks.

 

"Kill the dog, get rid of the fleas" 🙂

 

Thanks, Luke.

 

Julio Banks

JCBanks
11-Garnet
(To:JCBanks)

Luc, attached is the file showing the error when

assigning ORIGIN inside "Program blocks".

 

Notice that ORIGIN := 1 on page 1 and ORIGIN := 0

on the second page.

 

Thanks,

 

Julio Banks

LucMeekes
23-Emerald III
(To:JCBanks)

You're confusing

LucMeekes_0-1694614648099.png

with

LucMeekes_1-1694614663897.png

The first is the system variable ORIGIN, which defines the first/starting index for arrays (vectors and matrices).

The second is a(n ordinary) variable ORIGIN, which has NOTHING to do with array indexing.

If you want to define ORIGIN, you must ensure that the identifier is labelled correctly:

LucMeekes_3-1694615288575.png

 

Apart from that, you are right to observe that the statement ORIGIN <- 1 (or whatever other value) does not work (as might be expected) in a program. See this:

LucMeekes_2-1694615152411.png

Note that I use different font settings for the differently labelled items, because that makes life easier, and helps to prevent errors. My program demonstrates that even if ORIGIN is 3, I can still use index 0 for array b.

Now is this a bug? I think not. I think that changing the value of ORIGIN to various values within one sheet should not be done. In the case of your Ft calculation along b, you apparently need i to run from 1 to a value n, so it would be better programmed as:

LucMeekes_4-1694615951635.png

Finally. It seems as though you are programming a function that is (almost) readily available in Prime.

Check out pnorm():

LucMeekes_5-1694616299638.png

then

LucMeekes_6-1694616329854.png

and

LucMeekes_7-1694616345616.png

Your second function is related to the built-in qnorm():

LucMeekes_0-1694619302868.png then

LucMeekes_1-1694619310106.png

LucMeekes_2-1694619318624.png

 

Success!
Luc

Top Tags