Replies: 3 comments 10 replies
-
Hello, Nobody have an idea? Thanks |
Beta Was this translation helpful? Give feedback.
1 reply
-
To answer your question on how to rewrite asin(x)+bcos(x) into R*cos(x-c), we can do this as follows: import sympy as sym
a,b,c,R,x= sym.symbols('a b c R x')
lhs=a*sym.cos(x)+b*sym.sin(x) # form we have
rhs=R*sym.cos(x-c) # form we want
eq=lhs-rhs #solve expects an equation of the type lhs-rhs=0 instead of lhs=rhs
#solve for the unknowns in the form we want
s1,s2=sym.solve(eq,c) #as it turns out, two solutions are found for c (makes sense to me in a cos)
s3=sym.solve(eq,R)[0] #solve returns an array, even if one solution is found``` I do realise this does not obtain the form of R and c you were looking for, but perhaps it is still useful? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I would like to simplify a trigonometric function like acos(x)+bsin(x) into Rcos(x-c).
My expression is:
I have tried many functions, I thought that TR10i function of fu library could work but maybe it only works with numbers.
Does anybody have a suggestion?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions