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
How can I find Alpha if "m", "m_2" and "e" are known. (I'm using Mathcad prime 3)
Solved! Go to Solution.
You will have to look up the syntax of root(). You can use it with just two parameters (and will need a guess value) or with four parameters if you know two values of alpha where the function you want to solve for have different sign.
I am not sure what you wanted to get with the root() expression in your file. You are asking for a value of alpha where lamda1' is zero! Look at the definition of lamda1', the only value of alpha which will make this expression to zero is infinity, so Mathcad will find no solution, even if you use the correct sytnax!
What you have asked for is a value of alpha which makes lamda1(L2, alpha) - L1 to zero. L1 and L2 are the lamda values you get using m1,m2 and e.
So you have to setup your function(s) correct.
lamda2' should only be dependent on alpha and its definition will call lamda1' so you will have to use
lamda1'(alpha), not just lamda1'.
The same applies to the definition of lamda1() - all lamda1' and lamda2' there need the parameter alpha as they are functions, not variables.
After that you have to calculate L1 and L2 dependent on m,m2 and e and then at last find the root of the function lamda1(L2,alpha)-L1. I would suggest the 2 patrameter variant of root with a guess value of alpha:=8. You should assign the result of root() to variable alpha to be able to use it in your plot.
You may also consider defining a range variable for lamda2 (0,0.01..1.4) for a smoother plot.
Please post a worksheet with the equation(s) you want to be solved.
Generally you can solve equations or systems of equations either by using the symbolic "solve" or by using a solve block with Find(). The equations have to be written with the boolean equal sign, bt you probably have already looked that up in the help or other literature.
You don't have typed a single equation, just assignments.
Just because you type a<b before an assignment for a doesn't mean anything for Mathcad.
If I am right in guessing what you want, the first thing you should do is creating a function lamda1 with the two parameters lamda1 and alpha using Mathcads programming tab. lamda1&2* should be calculated locallyyand you would have to use the if condition to calculate the correct value lamda2 for every lamda1 and alpha.
Then try to duplicate the plot which is shown in your picture. As lamda2 is on the abscissa you should not use Mathcads quickplot feature but use a range variable for lamda2 (0,0.01..1.4).
To solve for alpha for a given set of lamda1 and lamda2 you can't use the symbolic "solve" because Mathcads symbolics still has big problems with conditonal operators. You will have to use a small solve block instead.
BTW, did you lose interest in your former question? http://communities.ptc.com/message/232198#232198
I appreciate your both answers, but I have to wait till I upgrade my Express version to a full version, becauze the Programing tab is not avaible in the Express version
You may use the if-function as shown in the other thread you opened. Sure not that convenient for this task, though.
But I am confused because you wrote you had tried the symbolic solve command. Symbolics also is considered premium content by PTC and not available im Express!?
Just checked it - you can solve your problem using the if- and the root-function instead of the programming facility and the solve block.
Looks nice! I hope that I will be able to reproduce it.
The symbolics are considered premium content. I used Mathcad at work, and at home. At home I have only, the Express version of Mathcad. This problem takes part of a homework project, so mainly I work on it at home.
Adam Szotyori wrote:
Looks nice! I hope that I will be able to reproduce it.
If not come back here qnd post what you have.
I'm not to familiar with the symbolics and the programing functions... I wasn't able to find the values for Alpha.
I send you the mathcad file. I think that I'm on a totaly wrong way...
You will have to look up the syntax of root(). You can use it with just two parameters (and will need a guess value) or with four parameters if you know two values of alpha where the function you want to solve for have different sign.
I am not sure what you wanted to get with the root() expression in your file. You are asking for a value of alpha where lamda1' is zero! Look at the definition of lamda1', the only value of alpha which will make this expression to zero is infinity, so Mathcad will find no solution, even if you use the correct sytnax!
What you have asked for is a value of alpha which makes lamda1(L2, alpha) - L1 to zero. L1 and L2 are the lamda values you get using m1,m2 and e.
So you have to setup your function(s) correct.
lamda2' should only be dependent on alpha and its definition will call lamda1' so you will have to use
lamda1'(alpha), not just lamda1'.
The same applies to the definition of lamda1() - all lamda1' and lamda2' there need the parameter alpha as they are functions, not variables.
After that you have to calculate L1 and L2 dependent on m,m2 and e and then at last find the root of the function lamda1(L2,alpha)-L1. I would suggest the 2 patrameter variant of root with a guess value of alpha:=8. You should assign the result of root() to variable alpha to be able to use it in your plot.
You may also consider defining a range variable for lamda2 (0,0.01..1.4) for a smoother plot.
Thank you! Now I had time to work on it, and I understood how to solve it in mathcad. I have only one question... I dont't know how the root function works. Why did you write (Lambda1(L2,Alpha) - L1,Alpha) insted of (Lambda1(Lambda2,Alpha),Lambda2,Alpha) ?
1) The mathcad knows that Lambda2 is L2, and it will use L2 instead of Lambda2 in the formula of Lambda1(Lambda2,Alpha)? In this way reducing the number of the unknon variables from 2 (lambda2,Alpha) to 1 (Alpha)
2) Why "-" and why L1?
And also thaks for the links included in the mathcad file.
I dont't know how the root function works.
Thats what the help system is for Its not of the quality and ease of use as we had in in Mathcad 15, but you still find some information.
http://www.ptc.com/cs/help/mathcad_hc/prime3_hc/mprime/finding_roots.html#styler-id1.1.1.4.15.8.4.1
You don't have to use the online help - you have it instlled locally on your computer.
Why did you write (Lambda1(L2,Alpha) - L1,Alpha) insted of (Lambda1(Lambda2,Alpha),Lambda2,Alpha) ?
1) The mathcad knows that Lambda2 is L2, and it will use L2 instead of Lambda2 in the formula of Lambda1(Lambda2,Alpha)? In this way reducing the number of the unknon variables from 2 (lambda2,Alpha) to 1 (Alpha)
2) Why "-" and why L1?
L1 and L2 are the values calculated from the given values m,m2,e. Your function lamda1 is dependend on two parameters, lamda2 and alpha and thats the way its defined lamda1(lamda2,alpha):=.... The arbitrary lamda2 and alpha are called independend parameters of the function. In the function definition they are also called the formal parameters. It does not matter which names you use here as long as you use the same in the parameter parenthesis and on the RHS of the definition. The names you use here have nothing to do with any variables of the same name you may have already defined. When you evaluate lamda1(0.4, 5)=... Mathcad of course knows that 5 is alpha because of the order of the parameters. 0.4 and 5 are called the actual parameters and naturally you can use variables which have been assigned a value as well (like L2).
You are searching a value for alpha so that the function lamda1 yields the result L1 if lamda2 is set to L2. So you are going to solve the equation lamda1(L2, alpha)=L1 for alpha (the only unknown in that equation.
root() is only the root of a function = the point of zero and so you have to rearrange your equation to lamda1(L2, alpha) - L1 = 0 and feed the LHS in the function root. The alpha:=7 before is a guess value which the numeric solver needs. Its the value it will begin his iterative calculations with and sometimes the choice of the guess value influences the result - if the equation has multiple solutions the guess value affects which of them is found and an inappropriate guess value may lead to Mathcad not finding any solution if the iteration does not converge.
Hi everybody,
this thread discussion heps me a lot. But I would like to complicate the equations a little more.
The sheet works very well with a pair of values of lambda1 and lambda2. My questions is: Is it possible evaluate several pairs of lambda values and obtain the alpha list or array of them?
Thank you in advance
Best regards