Please help me to solve this problem below.

I want to run this coding based on the time given by the system.


A = ( { {E^(I [Beta]1 + I [Beta]3) Cos[[Beta]2t], E^(I [Beta]1 - I [Beta]3) Sin[[Beta]2t]}, {-E^(-I [Beta]1 + I [Beta]3) Sin[[Beta]2t], E^(-I [Beta]1 - I [Beta]3) Cos[[Beta]2t]} } ) /. {[Beta]1 -> 0, [Beta]3 -> 0} [Beta]2 = Pi; For[i = 1, i < 11, i++; t++, t = t + TimeUsed[]; Print[A]].

My problem are: 1. I cannot run this coding since I only want β2 influence by time. I want to look the changes of β2 only on time(For example start with t=0s until t=10s). 2. It is true that I used command TimeUsed[] for the time?(I want the time come from the computer). 3. How can I plot the graph from this command TimeUsed[]. I can't make the graph.

Thank you so much for helping me.

  • 1
  • 1
    $\begingroup$ A = {{Exp[I* β1 + I* β3] Cos[β2* t], Exp[I* β1 - I* β3] Sin[β2* t]}, {-Exp[-I* β1 + I* β3] Sin[β2* t], Exp[-I* β1 - I* β3] Cos[β2* t]}}; β1 = 0; β2 = Pi; β3 = 0; t = 0; tu = Table[ t++; t = t + TimeUsed[]; Print[A]; t, {i, 1, 10}] and then ListPlot[tu] but you need to explain more clearly what you mean by "only β2 dependent on time" $\endgroup$ – Bill Jun 5 '16 at 17:56
  • $\begingroup$ Tq Bill, what I mean by 'only β2 dependent on time' is β2 is varies with time. For example, 1st case, β2=Pi. 2nd case, β2=2Pi and in both cases, the value of β1 and β3 remain constant. that mean the value β1 and β3 not varies with time. $\endgroup$ – munirah Jun 14 '16 at 3:14
  • $\begingroup$ I did the coding suggest by u but why the value of identity, I cannot be evaluate? i get the output as: {{-0.8053078857111251 + 0.*I, 0.5928568201610549 + 0.*I}, {-0.5928568201610549 + 0.*I, -0.8053078857111251 + 0.*I}} $\endgroup$ – munirah Jun 14 '16 at 3:23

I suppose I know what you mean. If you actually want β2 t changed while β2 keeps the constant Pi, I guess the following two codes can solve your problem:

β1 = 0.;
β2 = Pi;
β3 = 0.;
A={{Exp[I β1 + I β3] Cos[β2 t], Exp[I β1 - I β3] Sin[β2 t]}, {-Exp[-I β1 + I β3] Sin[β2 t], Exp[-I β1 - I β3] Cos[β2 t]}};
  1. Using Animate (or Manipulate) while setting the setting bar's running speed the same as your computer time's running speed:

    Animate[Evaluate@MatrixForm@Chop@A, {t, 0, 1}, DefaultDuration -> 1]
  2. Using Dynamic:

    Dynamic[With[{t = FractionalPart@SessionTime[]}, Evaluate@Chop@A], UpdateInterval -> .1]
  3. I suppose you will need a plot of A as a function of t, so the following code will solve this problem:

    Grid[MapIndexed[Plot[#, {t, 0, 1}, AxesLabel -> {"t", "Value at " <> ToString /@ #2}] &, A, {2}]]

I will further update this post if you can make clearer what you want to do.

  • $\begingroup$ Simply change the DefaultDuration will do the job. In the second solution, use FractionalPart[SessionTime[]/t0] $\endgroup$ – Wjx Jun 14 '16 at 3:21
  • $\begingroup$ Tqvm Wjx for replying. Sorry, this solution is given by you? , It is mean DefaultDuration will run the coding? In second solution why add /t0 at the Session time $\endgroup$ – munirah Jun 14 '16 at 3:30
  • $\begingroup$ Thank you Wjx. I mention wrong person. I have question;1. do the coding and run it. but the value of Identity cannot be valued. For example, I do the Dynamic and get the result as: Dynamic[With[{t = FractionalPart[SessionTime[]]}, Evaluate[MatrixForm[A]]], ImageSizeCache -> {261., {10., 17.}}, UpdateInterval -> 0.1]. 2. I also wonder about the t interval; In 1(using animate), the Default Duration is increased by 1. it is mean by 1 second? How can I fix the duration? For example, I want to fix from t=0s until t=10s. $\endgroup$ – munirah Jun 14 '16 at 3:36
  • $\begingroup$ I suppose that's my solution...... DefaultDuration measures the time the dynamic will run for a time by default. /10 means that the time it costs to change fractional part from 0 to 1 will increase to 10 times the original. $\endgroup$ – Wjx Jun 14 '16 at 3:38
  • $\begingroup$ I'm very sorry again Wjx, I mention wrong person for the solution. I read the wrong name. $\endgroup$ – munirah Jun 14 '16 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.