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
Hello
Quick question:
I'm trying to add to my mathcad programme and every time I try to write a new equation with the same variables that exist in the programme already and have been defined it tells me that they haven't been defined. Am I missing something here? Never imagined I was dumb. This is baffling.
Thank you
Solved! Go to Solution.
It means numerically defined. If I write
c:=a+b
it cannot calculate a value for c because you have not numerically defined a or b. If I write
a:=2
b:=4
c:=a+b
then it can calculate c.
c=6
If I write
c(a,b):=a+b
then a and b do not need to be predefined, becsuse that's a function definition and a and b will be passed as parameters later, when the function is evaluated:
c(5,8)=13
It means numerically defined. If I write
c:=a+b
it cannot calculate a value for c because you have not numerically defined a or b. If I write
a:=2
b:=4
c:=a+b
then it can calculate c.
c=6
If I write
c(a,b):=a+b
then a and b do not need to be predefined, becsuse that's a function definition and a and b will be passed as parameters later, when the function is evaluated:
c(5,8)=13
Excellent. I get that thank you.
But what if I don't have a value for it?
Because in my assignment I'm now trying to seperate the two sections of the probability functions as two integrals and integrate them from -∞ to threshold voltage and from threshold voltage to ∞ in order to find out what the threshold voltage is. If I give a value for the threshold voltage then I won't be able to find a value ('cause I've just given it a made up one)
Maz Foz wrote:
Excellent. I get that thank you.
But what if I don't have a value for it?
Because in my assignment I'm now trying to seperate the two sections of the probability functions as two integrals and integrate them from -∞ to threshold voltage and from threshold voltage to ∞ in order to find out what the threshold voltage is. If I give a value for the threshold voltage then I won't be able to find a value ('cause I've just given it a made up one)
Read the section on solve blocks - you should be able to use a solve block to iterate over the integrals.
Could you post your worksheet on this forum (preferably in M11 format plus whatever version you use - widens the reader base that way)? Maybe somebody could give more specific and tailored advice ... unfortunately, many probability functions don't admit symbolic solutions, otherwise I'd suggest that route .. although a simplification might be possible.
Stuart
If I give a value for the threshold voltage then I won't be able to find a value ('cause I've just given it a made up one)
You will if the value you give is only a guess, and then the correct answer is solved for iteratively. But, as I mentioned in the other thread, we can't do that unless you define what the threshold voltage is (I might be able to answer that for myself by searching the web, but I'm too lazy to do so!).
Maz,
Variables that are defined inside a program have program scope only, i.e., they are not defined outisde the program. This is a good thing, as it lets you write programs an not worry about redefining variables out side the program. FYI, Variables defined outside a program, but before the program is defined are available iside the program, but the values of those variables inside the program will always be the definition just before the definition of the program, unless put into the argument list or unless redefined inside the program (and that change only applies to the program).
To access variables defined inside a program, they must be included in the return; To return multiple resutls, may want to return a nested matrix for that, and then assign the variable outisde the program to the appropriate nexted array.