Why does MATLAB dot product function interpret r as 2 different variables. I want to use trigonometric identities. How can I fix it?
3 views (last 30 days)
Show older comments
Joan Miquel Pons Crespi
on 12 Nov 2021
Commented: Joan Miquel Pons Crespi
on 12 Nov 2021
syms x y z u v r a
x=(a+r.*cos(u)).*cos(v);
y=(a+r.*cos(u)).*sin(v);
z=r.*sin(u);
X=[x y z]
Xu=diff(X,u)
Xv=diff(X,v)
E=dot(Xu,Xu)
simplify(E)
0 Comments
Accepted Answer
Steven Lord
on 12 Nov 2021
If you want MATLAB to assume that r is real, tell it that.
syms r1 % r1 could be complex
syms r2 real % r2 must be real
x1 = dot(r1, r1)
x2 = dot(r2, r2)
More Answers (0)
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!