+ Reply to Thread
Results 1 to 5 of 5

Thread: Plot a function into an interval

  1. #1

    Plot a function into an interval

    How can I plot a function into a defined interval?
    For example f(x) for x>0 or for -5 < x < 5.

    Thanks

    Emil

  2. #2
    After you plot the function, right click on the plot and choose Properties. go to the "Plot" tab, and then you will see a place to put in domain boundaries. For x>0, you will have to choose a large enough number on the right to see what you want to see because you cannot put infinity as a boundary.

  3. #3
    Thank you mpatterson: it works.

    But, can I set an interval for parts: -5<x<-1 and 1<x<5 ?
    And, can I set as interval a specific number's set: Natural, Rational, ....


    Thank


    Emil

  4. #4
    The only way I've been able to have two parts as you suggest is to enter the function twice and set the domain. There are some advanced tools for doing piecewise functions which might help - just depends how often you need to do this or elegant you want it to be.

    As for the set, I don't think there will be a way to set if for, say, rational numbers, but there is an option in the plot tab (where he domain is) for Continuous vs. Discrete. If you choose discreet and then dramatically reduce the number of Samples, you can create a series of unconnected points.

  5. #5
    Sketchpad Developer
    Join Date
    Oct 2010
    Location
    Philadelphia
    Posts
    71
    Quote Originally Posted by mpatterson View Post
    there is an option in the plot tab (where he domain is) for Continuous vs. Discrete. If you choose discreet and then dramatically reduce the number of Samples, you can create a series of unconnected points.
    This is a nice observation, Margaret. In fact, if you set the properties of a function plot to discrete, set the domain 0 <= x <= 20, and set the number of samples to 21, you will see only the 21 points that correspond to a domain of positive integers. But this still doesn't set the function's domain to be those integers; in fact, Sketchpad's functions are based on independent variables defined on the rationals (not the reals because there are holes in the set of numbers representable using the native representations built into digital computers).

    So here's a workaround you could use to create a function plot whose domain is a subset of the integers. As an example, we'll use the function f(x) = sqrt(x) and the domain of integers from 0 to 20 inclusive.
    1. Create the function f(x) = sqrt (x) and the parameter a = 4.
    2. To restrict parameter a to the integers, calculate round(a). This is the independent variable: it's always an integer.
    3. Calculate f(round(a)). This is the dependent variable.
    4. Plot the point defined by the independent and dependent variables: [round(a), f(round(a))].
    5. Select the plotted point and the independent variable, which is round(a). Then choose Construct | Locus.
    6. Finally, set the properties of the locus to be Discrete, Domain from 0 to 20, with 21 samples.

    The result really is the discrete graph of f(x) over the integers from 0 to 20. If you construct a point on this locus and drag it, you'll see it jump from one discrete value to the next. If you measure its coordinates, you'll find that the x-value is always an integer.

    You can use this technique to construct the graphs of quite a variety of functions defined on particular discrete domains.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts