Mathematica: Transistor Harmonic Derivations

In summary, the developer was trying to figure out why a piece of code was executing both the then and the else statement, but was unable to do so due to the dense code.
  • #1
vadar
16
0
Hello,

I am trying to derive the harmonic content of a signal passing through a transistor's transfer function. After a Taylor expansion in Mathematica 7, I have the expanded equation and the next step is to reduce everything to first order Sine/Cosine functions.

In Mathematica, if I have a term like

(A Sin (wt) )^3

What function can I use to reduce this down? Doing it by hand it should look something like

a Sin(wt) - b Sin(3wt) + c Sin(wt)

where a,b,c are the collections of constants.
Any idea how I can do this reduction in Mathematica? I can't seem to get/find a function like TrigReduce to do what I want.

Thanks for any help.
 
Physics news on Phys.org
  • #2
Mathematica often has its own idea about the form it wants things in and trying to force it to put it in the form you want can often be a frustrating experience.

This can show you the coefficients without having to do it by hand, and without what I think might be a typo in what you said the result should be.

In[1]:= Table[Integrate[Sin[n w t]A Sin[w t]^3,{t,0,2Pi/w}]/(Pi/w),{n,0,3}]

Out[1]= {0, (3*A)/4, 0, -A/4}

In[2]:= FullSimplify[3A/4Sin[w t]-A/4Sin[3 w t]==A Sin[w t]^3]

Out[2]= True

Only after I finished that did I grope around and discover this

In[3]:= TrigReduce[A Sin[w t]^3]

Out[3]= (3*A*Sin[t*w] - A*Sin[3*t*w])/4

Note: You may find if your "A" is a large complicated collection of other things then this might confuse TrigReduce to the point where it will not do the transformation that you desire. If that is the case you may be able to use pattern matching and substitution to temporarily remove the large complicated collection, do the TrigReduce, and then put back the large complicated collection.
 
Last edited:
  • #3
Gah... I was using Sin() instead of Sin[]...

I have TrigReduce working now, Thank you very much! Its always the little things haha

Cheers
 
  • #4
vadar said:
Gah... I was using Sin() instead of Sin[]...

I have been recommending for a long time that there be a new feature in Mathematica.

This would make things
like sin(x), sin[x], e^x, etc, etc, etc
and many or most of the other simple errors like this

BIG RED BLINKING TEXT!

Now if I could just make that blink I would be done.

Just yesterday I spent twenty minutes trying to figure out why in the world someone's if-then-else code was actually executing BOTH the then and the else... Finally in two pages of tiny printed code I stumbled onto it was if[condition,then,else]. Did you notice that i in if wasn't capitalized? In two pages of dense code? And without a peep of an error message? And it wasn't RED BLINKING TEXT! To find that I had to put Print statements all over in the code until I was able to even see both then and else were being executed and then moving the Prints around until I finally stumbled onto the reason. He had wasted a day trying to figure this out. There is no excuse for the software not pointing this out.
 
Last edited:
  • #5


Hello,

Thank you for sharing your work with me. It sounds like you are working on an interesting problem involving transistor harmonic derivations. To answer your question about reducing the term (A Sin (wt))^3 in Mathematica, there are a few different functions you could use depending on the specific outcome you are looking for.

One option is to use the function ExpandAll, which will expand all terms in the expression and then use the function TrigExpand to expand any trigonometric functions. This should give you the expanded expression in terms of sine and cosine functions.

Another option is to use the function Simplify, which will attempt to simplify the expression using various rules and transformations. You can specify the assumptions for Simplify to use, such as assuming A is a constant, using the Assumptions option.

I hope this helps and good luck with your research! Let me know if you have any further questions or if I can be of any assistance.
 

Related to Mathematica: Transistor Harmonic Derivations

1. What is Mathematica?

Mathematica is a powerful computational software program used for mathematical, scientific, and engineering computations. It is widely used by scientists, engineers, and researchers for data analysis, visualization, and modeling.

2. What is a transistor?

A transistor is a semiconductor device that is used to amplify or switch electronic signals. It is a fundamental component of modern electronics and is widely used in computer processors, communication devices, and other electronic systems.

3. How does Mathematica aid in transistor harmonic derivations?

Mathematica has built-in functions and tools that allow for efficient and accurate calculations of transistor harmonic derivations. It can handle complex equations and perform numerical simulations, allowing for the analysis of different transistor configurations and parameters.

4. What are the benefits of using Mathematica for transistor harmonic derivations?

Using Mathematica for transistor harmonic derivations can save time and effort compared to manual calculations. It also allows for more accurate results and the ability to easily modify and analyze different scenarios and configurations. Additionally, Mathematica has powerful visualization tools that can help in understanding the data and results.

5. Do I need to have prior experience with Mathematica to use it for transistor harmonic derivations?

While prior experience with Mathematica can be helpful, it is not necessary to use it for transistor harmonic derivations. The software has a user-friendly interface and extensive documentation that can guide users through the process. There are also many online resources and tutorials available for beginners.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Replies
5
Views
1K
Replies
4
Views
473
  • General Math
Replies
2
Views
840
Replies
3
Views
5K
  • Science and Math Textbooks
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
2K
  • Introductory Physics Homework Help
Replies
3
Views
1K
Back
Top