Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Symbolic Math: Combining Equations
Replies: 2   Last Post: Feb 15, 2013 2:29 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Christopher Creutzig

Posts: 267
Registered: 2/24/09
Re: Symbolic Math: Combining Equations
Posted: Feb 15, 2013 2:29 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 14.12.12 21:53, cypher wrote:
> How do I combine equations symbolically? For example:
>
> f1 = sym('ax +b')
> f2 = sym('cx+d')
> f3 = f1*f2
> I'm looking for an output like
> f3 = 'acx^2+bcx+adx+bc'


If you mean the product a*x, don't write ax ? variables can have longer
names and ax is ist just that, a single variable. Also, I'd recommend
not to use strings:

syms a b c d x
f1 = a*x+b;
f2 = c*x+d;
collect(f1*f2, x)


HTH,
Christopher




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.