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

  • Home
  • SEARCH
  • 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 6892897
In Process

The Archive Base Latest Questions

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

Consider the following definition: f[x_]=Piecewise[{{0,x<1/2},{Interval[{0,1}],x==1/2},{1,x>1/2}}]; Then when one does the Plot[f[x],{x,0,1}] of the function,

  • 0

Consider the following definition:

f[x_]=Piecewise[{{0,x<1/2},{Interval[{0,1}],x==1/2},{1,x>1/2}}];

Then when one does the Plot[f[x],{x,0,1}] of the function, the graph does not depict the interval value f[1/2] of the graph.

Any ideas on how to plot interval-valued functions in Mathematica would be much appreciated.

Update #1: I’ve found a hack:

Plot[ f[x], {x,0,1}, ExclusionsStyle->Opacity[1]];

The hack, however, does not work on a general interval-valued function, such as

f[x_]=Piecewise[{{0,x<1/2},{Interval[{0,1}],1/2<=x<=1}}];

which is the essence of the question.

Update #2:

As a followup to the neat example of @Heike below: it’s only a partial solution. For if one tries the following:

f[x_] = Piecewise[{{0, x < 1/2}, {Interval[{x, 1}], 1/2 <= x <= 1}}];
Plot[ {f[x] /. Interval[a_] :> a[[1]], f[x] /. Interval[a_] :> a[[2]]},
{x, 0, 1}, Filling -> {1 -> {2}}]

then the graph depicts a segment at x=1/2 that is equal to the value [0,1] instead of [1/2,1].

  • 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-27T06:35:30+00:00Added an answer on May 27, 2026 at 6:35 am

    Maybe you could do something like

    f[x_]=Piecewise[{{0,x<1/2},{Interval[{0,1}],1/2<=x<=1}}];
    
    Plot[{f[x] /. Interval[a_] :> a[[1]], 
     f[x] /. Interval[a_] :> a[[2]]}, {x, 0, 1}, Filling -> {1 -> {2}}]
    

    plotting an interval

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

Sidebar

Related Questions

The question is to consider the following function definition: def read_value_type(prompt='Enter a Boolean> ',
Consider I have the following function prototype: void MyFunction(int MyParameter); With the following definition:
Consider following function definition in ghci. let myF = sin . cos . sum
Consider the following class definition: class StrToTokens { StrToTokens(const char* str, const char* delimiters
Consider the following sequence of events: A view v_Foo is defined A user-defined function
Consider the following definition of a category: trait Category[~>[_, _]] { def id[A]: A
Consider the following definition in Scala: val f = ((_: Int) + 1).toString() The
Consider the following HTML table definition. <table> <tbody> <tr> <td rowspan='2'>A</td> <td>2</td> <td rowspan='2'>B</td>
Consider the following definition let test = Async.FromContinuations( fun (cont,econt,ccont) -> let rec inner
Consider the following contrived example of a templated array definition: template <typename t, unsigned

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.