Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7498379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:27:22+00:00 2026-05-29T19:27:22+00:00

I’m trying to create three separate graphs, this code will give you the idea:

  • 0

I’m trying to create three separate graphs, this code will give you the idea:

f[t_] := Sin[10 t] + Cos[15 t];
Slider[Dynamic[dx], {0.01, 1}]
var = Dynamic[Fourier[Table[f[t], {t, 0, 100, dx}]]];
ListLinePlot[Abs[var]]
ListLinePlot[Re[var]]
ListLinePlot[Im[var]]

This won’t work because var hasn’t been evaluated an so ListLinePlot/Abs/Re/Im does not recognize it as a list of numbers. Dynamic has to wrap ListLinePlot.

Wrapping ListLinePlot and everything else with Dynamic works. But then I would have to calculate Fourier[Table[… once for each graph. Per principle, I don’t want to have this duplication of code.

This is a way that avoids duplication of code but is not as semantic as my proposed not working example above, plus it puts all series in one graph and not in three separate:

Dynamic[
 ListLinePlot[
  (#[Fourier[
       Table[f[t], {t, 0, 100, dx}]
       ]]) & /@ {Abs,Re,Min}, DataRange -> {0, 100}
  ]
 ]

Hopefully you can see now what I am trying to achieve. Something like my first piece of code except it should work. How can I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:27:25+00:00Added an answer on May 29, 2026 at 7:27 pm

    In most cases you only need to wrap Dynamic around the expression that needs to be recomputed. As you noticed, if you wrap Dynamic around the contents of var, it will not work because ListPlot will see a Dynamic head, not the list, when you pass var to it. What needs to be recomputed in this case is the complete ListPlot.

    The correct solution is to use a delayed definition for var (i.e. := instead of =) and wrap Dynamic around ListPlot:

    f[t_] := Sin[10 t] + Cos[15 t];
    Slider[Dynamic[dx], {0.01, 1}]
    
    var := Fourier[Table[f[t], {t, 0, 100, dx}]];
    
    Dynamic@ListLinePlot[Abs[var]]
    Dynamic@ListLinePlot[Re[var]]
    Dynamic@ListLinePlot[Im[var]]
    

    People often get confused with Dynamic because it sometimes shows up deep within in expression, e.g. in your Slider example. But there Dynamic has a different function: setting a value.

    Generally, unless used to set a value, Dynamic always needs to be the outermost head in an expression. (There are some exceptions, notably when we’re handling expressions that directly correspond to what is shown on screen, and are handled by the front end, such as graphics primitives: Slider[Dynamic[x], {0, 5}], Graphics[{Disk[], Dynamic@Disk[{x, 0}]}] will work.)

    Dynamic affects only the way expressions are displayed in the front end, not how the kernel sees them. Here’s an example:

    x=1
    arr = {Dynamic[x], 2, 3}
    

    The Front End will display arr as {1, 2, 3}, but the kernel still sees it as {Dynamic[x], 2, 3}. So if we calculate Total[arr], the front end will display it as 1 + 5 but the kernel will see if as Dynamic[x] + 5. I hope this clarifies the situation a bit.

    Note: I did not want to use Manipulate in this solution because the OP didn’t use it either. Manipulate is just a high level convenience function and everything it does can be achieved with Dynamic and some controls such as Slider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.