Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi all,
I am new to Mathcan and I am trying to solve a matrix equation A = B*C symbolically. I would like to have the output written using only a set of primary variables.
I attached the equation. The output Et1 and Et2 contains Et2. What I would like to have is Et1 in terms on alpha, theta, k and t only.
Can anybody suggest something?
Many thanks in advance!
Newin
Solved! Go to Solution.
Like so?
Alan
Hi Alan,
Many thanks for your quick reply. That is exactly what I would like to do, but could you explain me how you get that to work? In other words, what does the statement mean, i.e. why do we need to put (Et1 Et2) vector on the left, and what is the thick equal signs to the right of (Et1 Et2)' vector? And how did you insert the long vertical bar next to solve and substitute?
I am completely new to Mathcad and your suggestions will be very helpful.
Newin
why do we need to put (Et1 Et2) vector on the left,
When you solve for more than one variable using the symbolic solver it gives the result as a row vector, so you need to assign the result to variables in a row vector (odd really, as Mathcad normally prefers column vectors!).
...what is the thick equal signs to the right of (Et1 Et2)' vector?
There are a number of different "equals" signs in Mathcad! The thick-lined = (obtained by Ctrl= or from the Boolean Logic menu) is used for logical testing of equality of both sides of the equation, and is needed for the symbolic maths (since you are stating both sides of the equation are equal, you are not assigning the right side to the left side). (There is also the normal =, which evaluates an expression numerically, and the right-arrow which evaluates symbolically).
And how did you insert the long vertical bar next to solve and substitute?
You choose solve and substitute from the symbolic menu (the one with the mortar board hat). After you put solve, and the vector of variables you want to solve for, just select substitute from this menu before clicking outside the expression, or pressing enter - the bar is inserted automatically by Mathcad.
Hope this helps.
Alan
Hi Alan,
That's really helpful, thanks a lot!
I managed to get it to work now, but the solution does not appear to the right on the arrow (symbolic equal sign), but only when I type Et1 -> on the next line. In fact, I saw the solution but then it disappear and I could not get it back again even when I rewrote the whole equation anew. Do you know why it is so?
Newin
Can't tell unless you upload your worksheet. You need to go to the Advanced editor for this - see top right hand part of the standard Reply editor.
Alan
also, do you know an easy way to fix the equation if I also want to solve for Ein1 and Ein2 as well? What I am doing now is to rewrite the whole equation.
Many thanks,
Newin
new jap wrote:
also, do you know an easy way to fix the equation if I also want to solve for Ein1 and Ein2 as well? What I am doing now is to rewrite the whole equation.
Many thanks,
Newin
Well, since Ein2 is a function of Et2, just go below Et2 and type Ein2-> (ie, Ein2 followed by the right arrow key).
Ein1 you've already defined as just 1. If you've got more complicated equations for these, upload them so we can see how best to treat them.
Alan
Hi Alan,
You were right, Ein2 can be directly evaluated from Et2. The solution to the right of the equation now appears, don't konw why but at least it works now. Many thanks again for your fast response and help, I really appreciated it.
Bests,
Newin
By the way Alan, may I ask one last question? This actually sort of takes me back to the original question. How can I tell MathCAD to output Ein2 in terms of only alpha, t and theta and not in terms of Et2. When I did Ein2 --> I got Et2.alpha.exp(i.theta). What I would like MathCAD to do is to automatically replace Et2 with the solution we evaluated above.
Do you have any suggestion?
Bests,
Newin
new jap wrote:
By the way Alan, may I ask one last question? This actually sort of takes me back to the original question. How can I tell MathCAD to output Ein2 in terms of only alpha, t and theta and not in terms of Et2. When I did Ein2 --> I got Et2.alpha.exp(i.theta). What I would like MathCAD to do is to automatically replace Et2 with the solution we evaluated above.
Do you have any suggestion?
Bests,
Newin
One possibility attached.
Alan
many thanks Alan, I think I will need to read through the tutorial to learn more about MathCAD, as it seems quite complicated, but fun.
Bests,
Newin
Hi Alan,
I continued to work on the equation and I still can't figure out an easy way to 'substitute'. I attached the file here. Would you please have a look? In addition I also could not expand the ()^2 term and the i*i (i represent the imaginary sqrt(-1)) is not automatically calculated by MathCAD. Do I also have to 'substitute' this somehow?
Many thanks in advance!
Newin
Better to upload the worksheet, then I don't have to spend time typing in all the extra stuff!
Alan
Hi Alan,
Sorry, I could not attached it last time. Here it is. The importance point I would like to be able to do is to 'substitute' or define variables and have the solution calculated automatically. For instance, I could not get it to work when I put theta+alpha = 2*pi.
Bests,
Newin
Ok. I did it anyway!. see attached.
Delete my earlier Et file.
Alan
NB My use of the absolute value lines, | |, in the last statement is unneccesary!
Hi Alan,
Thank you. That looks really neat. By the way, is it possible to leave the thing as it was last time and define the condition theta+phi = 2pi later and get a second equation.
And also, if I want to convert exponentials into cosine terms, will the rewrite, cos statement work in this case?
Bests,
Newin
new jap wrote:
Hi Alan,
Thank you. That looks really neat. By the way, is it possible to leave the thing as it was last time and define the condition theta+phi = 2pi later and get a second equation.
You can't define theta + phi = 2pi, but you can define phi := 2pi - theta. Note the use of colon equals here ( := ) for assignment.
And also, if I want to convert exponentials into cosine terms, will the rewrite, cos statement work in this case?
Try using the "rectangular" keyword on the symbolic menu. e.g.
Alan
Hi Alan,
Many thanks; I will try that soon, need to rush outside now.
Bests,
Newin
Hi Alan,
Attached is the worksheet that I expanded upon yours. I also noted the problems that I have and I would be grateful if you could have a look at them. In brief, I can't seem to be able to expand and substitute expressions at will
Bests,
Newin
Hi Alan,
sorry, I forgot to attach the actual equation from a book. Here it is. I will take a look at your file in a minute.
Bests,
Newin
The attached gets the same expressions for Pt1 as in the book. However, the expressions for Pt2 differ by a factor of alpha^2. Don't know why!
Alan
Hi Alan,
many thanks for your interest in my problem, I really appreciated it.
Everything is perfectly right; it is only that Eq 2.12 is Ein2^2 and not Et2^2
I attached the results I worked on your Et3 and it works out very well as you can see in the x,y plot and compare with the attached image (Fig 2.3.) As you can see, I will now try to extend the code to more complex equation Eq2.13, in which case there will be now two sets of matrix equation. Wish me luck. In fact, I might come back again if I face any problem
Bests,
Newin
forgot the attachments again; here they are.
new jap wrote:
Everything is perfectly right; it is only that Eq 2.12 is Ein2^2 and not Et2^2
Good! I'm glad it's working out ok.
Alan
Hi Alan,
I continued to expand on the file and now the matrix is doubled in size. I think I still do not understand quite clearly how to define parameters, and I just do this by trial and error. It works to some extent as you can see in the attached worksheet. I also attached two images so that you understand how the matrix size is doubled.
Basically, I try the substitute t1m by t2m, but it does not seem to work. Et2sq expression also does not calculate, which otherwise looks very similar to Et1sq expression, which generate a plot. The Et2sq plot vs lamda should look like the dotted line in Fig. 2.5 of the attached image p2.
It would be great if you could have a look. Also, could you suggest a proper way of working with Mathcad worksheet. It crashes very often.
Many thanks in advance,
Newin
Try the attached. Not sure if the apparent improvement is real or not!
Alan
Hi Alan,
It is me again. This time I applying what we have been doing to a simily, but more complicated system (please see Fig. 2 of the attached paper). I tried to calculate Eq. 8 and Eq. 9. But it does not work. The parameter b4 seems to stick and I can get rid of it, even by defining it beforehand as we used to do so far. Would you please have a look? All the equations that I am trying to model are shown in page1-3 or Section 3 of the attached paper.
By the way, the reason that you need to redefine as 1.8*10^-6 was because a mistake in the matrix equation where Er1bfn was written Er1bfn(Er1,alpha, theta*theta/2), while it should just be Er1bfn(Er1,alpha, theta) I attached also the working version.
Many thanks,
Newin
oops, sorry, here are the attachments. The new file I am working on is called hybrid.