Transform two functions into one, Review #1784
-
I have asked a question on Stack overflow. Unfortunatly, I haven't received any reaction whatsoever. I hope There are people here that can help me. I want to use Manim to explain Amplitude Modulation. I have produced the following code:
As can be seen in the code, I use two different Transform classes. I was wondering if this can be narrowed down to one Transform class. Also, I want to know if instead of defining another Functiongraph there is another way to get the AM signal. I have tried to use the following code:
However, the compiler gives the following error:
I hope someone can give me feedback on this. Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
My bad. I thought that this issue was a PR (didn't realize I had clicked the issues tab). Though this is still a fine place to get an answer (perhaps better suited toward q&a). |
Beta Was this translation helpful? Give feedback.
-
Hey! As for your first question, you could do something like And as for your second question: What output do you expect to get from |
Beta Was this translation helpful? Give feedback.
Hey! As for your first question, you could do something like
Transform(VGroup(cos_func, sin_func_1), cos_sin_func_1)
, which is a bit cleaner because you don't end up with two copies ofcos_sin_func_1
in your scene. (But that's a technical detail and shouldn't matter much in practice.)And as for your second question: What output do you expect to get from
sin_func_1 * cos_func + cos_func
? The graph corresponding to the function that is obtained by multiplying/adding the respective functions? Direct operations on theFunctionGraph
s are currently not supported, as you have already found out.