Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I am trying to program a series of iteration in mathcad, and i can't seem to program the part that I needed to get a good result. Can someone help me proofread my program?
my dependent variable is c3 = 1, 1.1, kd2 that will be programmed to 2 different set of rules,
if c3<cbal , Fy and if c3>=cbal , (600(d-c3))/c3
My F(c3) and Mcr is not showing a result of array. I am confused where to put my index that will support my array function. Kindly help. Thank you.
Solved! Go to Solution.
I am not sure what you are trying to achieve.
If you expect a return vector of 2601 values, you could do it that way
No need to provide the local variable c.3 as function argument.
But you let c.3 run up to kd.2=261 so the condition c.3<c.bal is always true and you get a vector with 2601 entries being all the same (F.y=275).
Is this really what you expect?
BTW, here is an alternate way to create a vector F, this time not using a fix step of 0.1 for c.3 but the range from 1 to kd.2 is divided into N steps
Or was your intention to just define functions for further usage? Then M must be a function of c.3 as well
I am not sure what you are trying to achieve.
If you expect a return vector of 2601 values, you could do it that way
No need to provide the local variable c.3 as function argument.
But you let c.3 run up to kd.2=261 so the condition c.3<c.bal is always true and you get a vector with 2601 entries being all the same (F.y=275).
Is this really what you expect?
BTW, here is an alternate way to create a vector F, this time not using a fix step of 0.1 for c.3 but the range from 1 to kd.2 is divided into N steps
Or was your intention to just define functions for further usage? Then M must be a function of c.3 as well
how do you put Result rows(Result)> is it (ctrl -)?
Well, I wanted it to produce an array at my Mcr if the function goes otherwise.
Thank you.
@Teddy wrote:
how do you put Result rows(Result)> is it (ctrl -)?
No! Its a vector index ([). This is a convenient way but only works OK if ORIGIN is at its default value 0.
The first time rows(R) returns 0 because R is not an array but a single scalar. So the first value is now saved in the first entry (#0) of the vector R.
If ORIGIN is set to another value, you would have to use R [ ORIGIN+rows(R) instead of just R [ rows(R)
Nonetheless I would prefer the second method shown where you have more control over the number of entries in the vector and also can assure that the end value kd.2 is actually reached.
BTW, in your function/variable(?) M you used an undefined variable c (should it be c.3?). Prime uses its built-in constant c (speed of light) and so you get a unit mismatch error.
Once you got your calcs to work it would be a good idea to modify it to use correct units - Prime is good at dealing with units and you should take advantage of it.
In the meantime I had edited my post and attached the worksheet in Prime 6 format which seems to be the version you are using.
Yes, this was my intention because I am trying to study how the program will affect my moment graph if I have a value greater than cbal.
Thank you for helping me program my study.
Note that i changed your undefined variable c in the definition of the moment to c.3. Hope this is what it should be.