Subject: Equation Manipulation From: Neil Date: 12 Jul, 2010 15:08:19 Message: 1 of 2 All, As a self-taught MATLAB user, one of things I've never encountered is simple equation and substitution techniques. Essentially what I'm trying to do is to get from one equation to another using a known substitution, i.e. Known equations: estress = ((1/2)*((y^2)+(x^2)+(x-y)^2))^(1/2); alpha = y/x; Now, I already know that by substituting alpha into estress yields... estress = (1-alpha+alpha^2)^(1/2)*x; ...but I am unable to produce a code to do produce it automatically! I have tried all the usual suspects, for example I can get subs to work in th ereverse direction - not much use though really! What I'm aiming to do is produce a code that will turn more complex versions of the estress equations into ones which incorporate ratios of y and x rather than their discrete values. Thanking you all in advance for your help Neil
 Subject: Equation Manipulation From: Roger Stafford Date: 12 Jul, 2010 18:01:06 Message: 2 of 2 "Neil " wrote in message ... > All, > > As a self-taught MATLAB user, one of things I've never encountered is simple equation and substitution techniques. Essentially what I'm trying to do is to get from one equation to another using a known substitution, i.e. > > Known equations: > > estress = ((1/2)*((y^2)+(x^2)+(x-y)^2))^(1/2); > alpha = y/x; > > Now, I already know that by substituting alpha into estress yields... > > estress = (1-alpha+alpha^2)^(1/2)*x; > > ...but I am unable to produce a code to do produce it automatically! I have tried all the usual suspects, for example I can get subs to work in th ereverse direction - not much use though really! > > What I'm aiming to do is produce a code that will turn more complex versions of the estress equations into ones which incorporate ratios of y and x rather than their discrete values. > > Thanking you all in advance for your help > Neil - - - - - - - - -   The form you obtained presumably by hand has replaced y by alpha and x, so when you use 'subs' you need to bear that in mind. Substitute 'alpha*x' for 'y' and then use the simplify function. On my system it does just the simplification you had in mind except that it keeps x^2 inside the square root. It is correct in doing so because moving it outside as you have done requires the knowledge that x is a non-negative quantity for otherwise the resulting expression would be in error.   Performing algebraic manipulations on very complicated expressions still remains something of an art that can require considerable human intervention. It is a pet peeve of mine that none of the symbolic manipulation programs I have seen make what I regard as adequate provision for a very detailed control by a human, such as, "please factor out the q^2 in these three terms, use the following trigonometric identity, and then group these other terms together, etc". When I am working on very messy stuff I often do a copy and paste to an outside editor, perform manipulations by hand with the editor, and then bring the result back and, as a check against my possible errors, ask the symbolic toolbox if their difference when simplified with 'simple' is equal to zero. It can be slow and aggravating process. Roger Stafford

Separated by commas
Ex.: root locus, bode

### What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.