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

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

Newbie Question(s) - Some Frustrations

StuartGregory
1-Newbie

Newbie Question(s) - Some Frustrations

Hi

First of all I am not a mathmatican, so please be gentle with any explanation. I have poured over the manuals and examples but they either get to the numerical answer too soon or don't seem to cover the way I would like to approach the problem!

I want to use Mathcad to provide me with a way of making the graphing and solving of networks of electrical impedances very much easier than on paper.

So far I have used 'solve' blocks to find n unknown currents from n simultaneous equations, either as numbers or as functions of a variable. Great!

However use of the symbolic answer involves cutting and pasting it to use in in further expressions, this is not very 'smooth' and of course stops Mathcad being 'live', so:

Q1 = Is there a way of taking the output from a 'solve block' and using it in further calculations, ie Find(i1,i2,i3)-> gives a nice matrix but in the next line I want to use i1, in another formula, say, Rin = Vin/i1 -> This doesn't seem to work, should it, and I am doing something wrong or is there a better way? I suspect that there is as Mathcad told me at one point that the answer was too long to print and I should.... (but I lost the text so no clues!)

Q2 = To keep the solve equations short I am using Z1, Z2, etc, to represent impedances so my answer is in terms of i1= some function of Z1, Z2, Z3 etc. But now I have that equation I want to exchange the Zs for 1/2pifC and 2pifL etc. But there seems to be no way of saying Z1 = 1/2pifC, etc and having Mathcad make the substitution symbolically. I can do that with pen and paper but Mathcad seems to fight shy of it!

I can upload a file but as this is my first post I thought I'd see what happens first. Any pointers to examples on the web gratefully accepted!

Many Thanks

Stuart

1 ACCEPTED SOLUTION

Accepted Solutions

Q1 = Is there a way of taking the output from a 'solve block' and using it in further calculations, ie Find(i1,i2,i3)-> gives a nice matrix but in the next line I want to use i1, in another formula, say, Rin = Vin/i1 -> This doesn't seem to work, should it, and I am doing something wrong or is there a better way? I suspect that there is as Mathcad told me at one point that the answer was too long to print and I should.... (but I lost the text so no clues!)

You can combine a numeric assignment with a symbolic evaluation. For example:

Currents(Z1,Z2,Z3):=Find(i1,i2,i3)->

Note that Currents is defined a function of the undefined variables that are on the RHS of the symbolic evaluation.

Q2 = To keep the solve equations short I am using Z1, Z2, etc, to represent impedances so my answer is in terms of i1= some function of Z1, Z2, Z3 etc. But now I have that equation I want to exchange the Zs for 1/2pifC and 2pifL etc. But there seems to be no way of saying Z1 = 1/2pifC, etc and having Mathcad make the substitution symbolically. I can do that with pen and paper but Mathcad seems to fight shy of it!

Look up the symbolic keyword "substitute".

View solution in original post

17 REPLIES 17

There are techniques that can help with circuit analysis, but what makes sense depends on the type of circuits you are trying to analyze (arbitrary, passive filters, nonlinear, etc.) and the level of complexity. Post your sheet so we have some idea of where you are.

Lou

Q1 = Is there a way of taking the output from a 'solve block' and using it in further calculations, ie Find(i1,i2,i3)-> gives a nice matrix but in the next line I want to use i1, in another formula, say, Rin = Vin/i1 -> This doesn't seem to work, should it, and I am doing something wrong or is there a better way? I suspect that there is as Mathcad told me at one point that the answer was too long to print and I should.... (but I lost the text so no clues!)

You can combine a numeric assignment with a symbolic evaluation. For example:

Currents(Z1,Z2,Z3):=Find(i1,i2,i3)->

Note that Currents is defined a function of the undefined variables that are on the RHS of the symbolic evaluation.

Q2 = To keep the solve equations short I am using Z1, Z2, etc, to represent impedances so my answer is in terms of i1= some function of Z1, Z2, Z3 etc. But now I have that equation I want to exchange the Zs for 1/2pifC and 2pifL etc. But there seems to be no way of saying Z1 = 1/2pifC, etc and having Mathcad make the substitution symbolically. I can do that with pen and paper but Mathcad seems to fight shy of it!

Look up the symbolic keyword "substitute".

Speaking of frustrations, that scroll window is a PITA

TTFN

RichardJ
19-Tanzanite
(To:IRstuff)

I hadn't noticed that. I have no idea why it even exists. Why doesn't it just wrap the line?

RichardJ
19-Tanzanite
(To:IRstuff)

It's some weird formatting problem. I tried to fix it, but now it's worse than before!

Oddly, the post looked perfectly fine when it was extracted and placed at the bottom of the page for my reply.

TTFN

RichardJ
19-Tanzanite
(To:IRstuff)

It looks fine in the editor dialog too. There are some invisible formatting characters that cause the problem.

Here's what I see in Word, with all formatting showing:

formatting.gif

Notice the paragraph marks and carriage returns.

If I paste back from Word I see the same problem. But if I first delete all the carriage returns (this took some experimenting!) first, and then paste back

we get:

You can combine a numeric assignment with a symbolic evaluation. For example:

Currents(Z1,Z2,Z3):=Find(i1,i2,i3)->

Note that Currents is defined a function of the undefined variables that are on the RHS of the symbolic evaluation.

Hi Guys

Thanks for the replies! Forums - great things.

Richard - 'substitute' was exactly right for me, but as I warned my Maths isn't good enough to translate:

"Currents is defined a function of the undefined variables that are
on the RHS of the symbolic evaluation"

into any sort of working text!.

Tried all sorts of options, in fact I've finally attached the file with my fumblings! Any chance you could have a look and enlighten me please?

Many Thanks

Stuart

Like so.

Hi Richard

Thanks for that but I have got that far before, I don't want a numeric value just yet.

What I want to do is to 'extract' that great long string of variables that defines, say, i3 from it's place in that array. (I've tried just using i3= but no use) The name could remain i3 or be "current_3", whatever it takes. (see attached pic)

Next I would substitute 1/jwC etc for the Z's and still get an expression which I want to graph.At this point I now know all the variables and I can play...

So, to find the power in the load resistor for example:

PL = i3.i3.RL -> Long expression using the Resistor, capacitor and other values

Now plot the variation in Load Power against omega (or 2.pi.frequency)

Thats what I would do if I were to do it by hand and it would be good to automate the pain away with Mathcad!

Cheers

Stuartcalc 1.jpg

Something along thses lines? The key is to ignore errors about undefined variables when working with the symbolic processor. The symbolic processor doesn't care about undefined variables (it thrives on them!).

Thanks Richard

Sorry to be so long to reply, but I am still all at sea with Mathcad which seems to be less and less how they advertise it as "use it as you would write it"!

Thanks for the advice with the numeric processor warnings, I had been stupidly(?) and studiously ensuring no error warnings in my working!

My next problem is that, while 'substitute' works I can't preserve the substitution action, I substitute and the next time I use the expression it has reverted back to the previous expression!

Can anyone advise me how to keep the substitute action? Example attached.

Cheers

Stuart

Sorry to be so long to reply, but I am still all at sea with Mathcad which seems to be less and less how they advertise it as "use it as you would write it"!

Mostly. In practice that's either impossible or undesirable. People do things on paper that involve a lot of implicit assumptions, which may not even be the same from one time to the next. We do it because we just know what we meant when we wrote it. Computers can't read minds though (yet ) so you have to be very explicit about what you want.

The right shaft is a symbolic evaluation operator. That's all it does: evaluate symbolically and display the result. The numeric evaluation operator evaluates numerically and displays the result. Nothing is ever stored implicitly, for the very good reason that just because one wants to see the evaluation result does not mean one wants it to overwrite the expression that is being evaluated! Suppose I wanted to use the same expression later on for something else? If you want to save the result of an evaluation you must explicitly save it to either a variable or a function definition using the assignment operator. That's what the assignment operator is for.

Hi Richard

Thanks for your last file - I think I may be on the home run now! (from the book of famous last words......)

I had tried to re-assign the whole expression in my last file posting but to no avail, Mathcad kept refusing to do the things I was typing in, or even more oddly deleting whole blocks that I didn't want it to delete.

I had previously noted that some evaluations lead to the answer being given in fractional format and try as I might to 'Format' the result as a decimal, nothing happened, 236543274/4765773737 isn't exactly the sort of format that is very useful! Now I would interpret this as an 'anticipated quirk' of the symbolic processor. I assume that this would be fixed by assigning the variable to itself and pushing the expression over to the numeric processor.

I have to say that in all the maths I have ever done subtitution was always 'sticky' - if you make a substitution in a formula such as: X = 5 + Z to become X = 5 + 2t then the next line in the working would still see X as 5 + 2t. While I take your point that you may want to use X = 5 + Z later in the proof we always handled this by 'numbering' the X = 5 + Z line with a 1 in a circle to the left of the expression. This effectively stores that particular expession as the variable "1 in a circle" (sort of a paper computer). You would then say "From 1 above" when you wanted to retrieve the original expression. Mathcad does it completely the opposite way round it seems.

My use of Mathcad comes from the need to have an alternative to SPICE as in some cases I need to graph variations in component values instead of voltages and frequencies, hence the need to keep all those variables, as variables, right to the bitter end as I might want to vary any one of them! I couldn't possibly do that on paper as the expressions explode in size!

In this long exchange I have learned much about Mathcad that I did not pick up from the Help files or from the many examples on the web, the numeric and symbolic processors for one thing. Thanks very much for that! I'm also aware that I've used your advice to bulldoze my way through learning Mathcad and I'm grateful that you haven't responded with RTFM as I don't think that I would have persevered!

Cheers

James

I gave you a most elegant solution @ "Solve wisely". Plug your complex impedances for the particular solution. Spice is Mathcad based, so you should get the same results. No more maths than so much capacitance here and there and so much inductance here and there and so much resistance here and there is needed. You can consult your books for composing each complex impedance and consult again your book to put in the electrical mathematical format. If you do wrong, Mathcad will do right your wrongdoing, if you do right everything will done. In short, I gave the general literal algebraic representation that you have to fill-in the blank. From thereon, and assuming you would want or hope to shape your power load to a prescribed shape, the next step will be solving for the complex components. If Mathcad can solve or not ? you will know from a work sheet. From educated guess, the answer is yes ...

Thanks Jean

I've found the item you refer to. It does indeed look elegant, I may have to study it awhile to fully understand it though!

I have though got the calculations I wanted thanks to you all!

Cheers

Stuart

I had tried to re-assign the whole expression in my last file posting but to no avail, Mathcad kept refusing to do the things I was typing in, or even more oddly deleting whole blocks that I didn't want it to delete.

Without something more specific I can't help much. You would have to tell me exactly what you were trying to type. Mathcad never deletes anything unless you tell it to delete it.

I had previously noted that some evaluations lead to the answer being given in fractional format and try as I might to 'Format' the result as a decimal, nothing happened, 236543274/4765773737 isn't exactly the sort of format that is very useful! Now I would interpret this as an 'anticipated quirk' of the symbolic processor. I assume that this would be fixed by assigning the variable to itself and pushing the expression over to the numeric processor.

It's not a quirk of the symbolic processor, it's the nature of it. The symbolic processor deals with expressions, not numbers. The expression may contain numbers, or consist only of numbers, but form the point of view of the symbolic processor it's still an expression. That's what symbolic math is. So yes, if you want to do numeric math use the numeric processor.

I have to say that in all the maths I have ever done subtitution was always 'sticky' - if you make a substitution in a formula such as: X = 5 + Z to become X = 5 + 2t then the next line in the working would still see X as 5 + 2t. While I take your point that you may want to use X = 5 + Z later in the proof we always handled this by 'numbering' the X = 5 + Z line with a 1 in a circle to the left of the expression. This effectively stores that particular expession as the variable "1 in a circle" (sort of a paper computer). You would then say "From 1 above" when you wanted to retrieve the original expression. Mathcad does it completely the opposite way round it seems.

If you write the 1 in a circle next to an equation on a piece of paper the fact that it is a label associated with the equation (it does not, in any way, store the equation) is a piece of information that is stored in your head, not on the piece of paper. Suppose I also write some text comment close to the equation. Is the equation now "stored" in the text? And when you subsequently write "from 1 above" your brain does some impressive processing in that it interprets the text, figures out the meaning, locates the "1", and based on proximity alone finds the equation, despite the fact that the text doesn't actually say anything about an equation. Maybe at some point in the future we will have software that's smart enough to do that, but we are a long way from it right now. The assignment to the "label", which in Mathcad would be a variable or function name, has to be explicit. And you are confusing the expression and the label that references it. X=5+Z is the expression, it does not mean 5+Z is stored in X. If it did, then you wouldn't need the 1 in a circle to refer to it, you would just refer to X, and that would return 5+Z, not X=5+Z.

In short, when you are writing math on a piece of paper in the way you describe your brain is doing a lot or processing to go from one step to the next. Mathcad does not have access to your brain, and needs things written in such a way that it can get the sequence of steps correct. We are nowhere near the point where software can interpret paragraphs of text to figure that sequence out, so everything has to be written according to specific rules.

Top Tags