Alternatives to syms?

16 views (last 30 days)
Sam
Sam on 19 Mar 2024
Edited: John D'Errico on 19 Mar 2024
I'm doing a uni project however as an added challenge we are not allowed to use syms, are there any alternatives or ways around this? The majority of questions are solving an equation for x but I can write syms x.

Answers (1)

John D'Errico
John D'Errico on 19 Mar 2024
Edited: John D'Errico on 19 Mar 2024
Well, it is pretty old, but you COULD just use my sympoly toolbox. ;-) It is on the FEX for free download. (Pretty old by now, but I think it still works.)
The thing is, I assume that would also be out of order for your assignment.
Perhaps you are expected to use tools like fzero or fsolve. These are tools that will apply to function handles.
fun = @(x) sin(x) - 0.5;
[xsol,fval,exitflag] = fzero(fun,1)
xsol = 0.5236
fval = 0
exitflag = 1
As you can see, I solved for a value of x which satisfies the problem. No use of syms was ever needed.
In terms of other operations, you can always multiply polynomials implicitly, using conv. For example, what is the product (x+1)*(x-3), without use of syms?
conv([1,1],[1,-3])
ans = 1×3
1 -2 -3
Now consider what the coefficients of the result would have been, had you performed the multiply using syms?
I think the target of your project is to teach you how to work without using symbolic tools. Too often I think people seem to get stuck in a mental rut, that just because you don't know the value of some number, then it MUST be symbolic. You need to learn not to get trapped in those mental ruts. (This is a problem in all sorts of fields, where you need to learn to think outside of the box.)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!