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 8158409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:35:24+00:00 2026-06-06T17:35:24+00:00

I am trying to plot using piecewise in one of my problems and I

  • 0

I am trying to plot using piecewise in one of my problems and I have two variables: x and psi. However, the respective functions are only valid for a defined range of “x” and the psi range is the same. I am trying to make a 3D plot of these — and I basically just have Plot3D[p,{x,0,1},{psi,0.01,1}] —> These ranges are for the entire plot range and my x range for the respective functions is already defined in the Piecewise function.

I get the following error: saying that Plot::exclul: …… must be a list of equalities or \ real-valued functions.

Can anyone please help me with this. I am trying to follow the same procedure as: How can I use Piecewise[] with a variable number of graphs/intervals
But, I don’t know what to do about the plotting part.

Thanks.

The following is my code:

j = 10; 
s = 0; r = 0;

K[x_, psi_] := 
  Sum[Sin[n*Pi*x]*
    Sin[n*Pi*
      psi]*(2*Exp[-(n*Pi)^2*
         Abs[s + r]] - (Exp[-(n*Pi)^2*Abs[s - r]] - 
         Exp[-(n*Pi)^2*(s + r)])/(n*Pi)^2 ), {n, 1, j}];

TL[x_, psi_] = Integrate[K[x - y, psi]*y, {y, -10, 10}];

TU[x_, psi_] = Integrate[K[x - y, psi]*(1 - y), {y, -10, 10}];

eq = {TL[x, psi], TU[x, psi]};
cond = {{0 <= x <= 0.5, 0.01 <= psi <= 1}, {0.5 < x <= 1, 
    0.01 <= psi <= 1}};
p = Piecewise[{eq, cond}];

Plot3D[p, {x, 0, 1}, {psi, 0.01, 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-06-06T17:35:25+00:00Added an answer on June 6, 2026 at 5:35 pm

    Here is a working version:

    time = AbsoluteTime[];
    j = 10; s = 0; r = 0;
    K[x_, psi_] :=
      Sum[Sin[n*Pi*x]*Sin[n*Pi*psi]*
        (2*Exp[-(n*Pi)^2*Abs[s + r]] -
          (Exp[-(n*Pi)^2*Abs[s - r]] -
             Exp[-(n*Pi)^2*(s + r)])/(n*Pi)^2), {n, 1, j}];
    TL[x_, psi_] := Integrate[K[x - y, psi]*y, {y, -10, 10}];
    TU[x_, psi_] := Integrate[K[x - y, psi]*(1 - y), {y, -10, 10}];
    Plot3D[Piecewise[
      {{TL[x, psi], 0 <= x <= 0.5}, {TU[x, psi], 0.5 < x <= 1}}],
     {x, 0, 1}, {psi, 0.01, 1}]
    ToString[Round[AbsoluteTime[] - time]] <> " seconds"
    

    enter image description here

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

Sidebar

Related Questions

I have one y variable, which I am trying to plot against two related
I am trying to plot a graph using gnuplot. I have six text files.
I am trying to plot two columns from a text file using python matplotlib
I am using matplotlib and I'm finding some problems when trying to plot large
I have a a stacked bar plot using ggplot for which I'm trying to
I am trying to plot two data series in an MSChart. I am using
I am trying to plot a raster within a plot using grid. The only
I'm trying to produce a plot with two lines using data taken from stdin.
I have a bunch of points that I am trying to plot using matplotlib.
I am trying to place 3 density functions in plot using plot(density(all_noise),xlim=c(-1,1),ylim=c(0,10)) lines(density(max_nearby),col=blue) lines(density(max_repeats),col=red)

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.