Problem with interpolating function returned by NDEigensystemFindRoot gives strange results when used on an interpolating function with vector outputIntegrating Squared of Interpolating Function with respect to one variableFunctionInterpolation with vector output and scalar inputHow to speed up NIntegrate when using an interpolating function output from NDEigensystem?3DPlot, Logarithmic x and y axes, Interpolating functionHow to quickly evaluate the same interpolating function many times?How to take derivative of the argument of an interpolating functionUsing NDEigensystem to find 100 eigenvaluesUsing multiple boundary conditions with NDEigensystemHow to increase the integration domain of NDEigensystem without a “non-Hermitian” error?
Is it normal practice to screen share with a client?
Can I pay with HKD in Macau or Shenzhen?
How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?
Would it be a good idea to memorize relative interval positions on guitar?
What would be the side effects on the life of a person becoming indestructible?
Monty Hall Problem with a Fallible Monty
Film where a boy turns into a princess
Is a normal-sized rug with the Animate Objects spell cast on it able to carry a person and fly?
Are glider winch launches rarer in the USA than in the rest of the world? Why?
Why keep the bed heated after initial layer(s) with PLA (or PETG)?
Why is the return type for ftell not fpos_t?
Can two figures have the same area, perimeter, and same number of segments have different shape?
Why are so many countries still in the Commonwealth?
Book with a female main character living in a convent who has to fight gods
How may I shorten this shell script?
What is a reasonable time for modern human society to adapt to dungeons?
Where is this photo of a group of hikers taken? Is it really in the Ural?
Why are angular mometum and angular velocity not necessarily parallel, but linear momentum and linear velocity are always parallel?
Where to place an artificial gland in the human body?
Why is a dedicated QA team member necessary?
How to handle aversion that derives from perceiving arrogance?
Do Rabbis get punished in Heaven for wrong interpretations or claims?
Short story about a group of sci-fi writers sitting around discussing their profession
Direct revelation mechanism's sets of strategies and types
Problem with interpolating function returned by NDEigensystem
FindRoot gives strange results when used on an interpolating function with vector outputIntegrating Squared of Interpolating Function with respect to one variableFunctionInterpolation with vector output and scalar inputHow to speed up NIntegrate when using an interpolating function output from NDEigensystem?3DPlot, Logarithmic x and y axes, Interpolating functionHow to quickly evaluate the same interpolating function many times?How to take derivative of the argument of an interpolating functionUsing NDEigensystem to find 100 eigenvaluesUsing multiple boundary conditions with NDEigensystemHow to increase the integration domain of NDEigensystem without a “non-Hermitian” error?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I'm trying to evaluate interpolating function returned by NDEigensystem at a point but Mathematica won't evaluate it.
vals, funs = NDEigensystem[-Laplacian[u[x], x], u[x], x, 0, [Pi], 4];
f = funs[[3]] (*3rd eigenfunction*)
Plot[f[x], x, 0, Pi] (*this plot returns blank plot*)
Plot[f, x, 0, Pi] (*this plot works fine*)
f[2]
As you can see, f[2] is not evaluated. Any help with the problem with the plot and function evaluation would be appreciated.

interpolation finite-element-method
$endgroup$
add a comment |
$begingroup$
I'm trying to evaluate interpolating function returned by NDEigensystem at a point but Mathematica won't evaluate it.
vals, funs = NDEigensystem[-Laplacian[u[x], x], u[x], x, 0, [Pi], 4];
f = funs[[3]] (*3rd eigenfunction*)
Plot[f[x], x, 0, Pi] (*this plot returns blank plot*)
Plot[f, x, 0, Pi] (*this plot works fine*)
f[2]
As you can see, f[2] is not evaluated. Any help with the problem with the plot and function evaluation would be appreciated.

interpolation finite-element-method
$endgroup$
add a comment |
$begingroup$
I'm trying to evaluate interpolating function returned by NDEigensystem at a point but Mathematica won't evaluate it.
vals, funs = NDEigensystem[-Laplacian[u[x], x], u[x], x, 0, [Pi], 4];
f = funs[[3]] (*3rd eigenfunction*)
Plot[f[x], x, 0, Pi] (*this plot returns blank plot*)
Plot[f, x, 0, Pi] (*this plot works fine*)
f[2]
As you can see, f[2] is not evaluated. Any help with the problem with the plot and function evaluation would be appreciated.

interpolation finite-element-method
$endgroup$
I'm trying to evaluate interpolating function returned by NDEigensystem at a point but Mathematica won't evaluate it.
vals, funs = NDEigensystem[-Laplacian[u[x], x], u[x], x, 0, [Pi], 4];
f = funs[[3]] (*3rd eigenfunction*)
Plot[f[x], x, 0, Pi] (*this plot returns blank plot*)
Plot[f, x, 0, Pi] (*this plot works fine*)
f[2]
As you can see, f[2] is not evaluated. Any help with the problem with the plot and function evaluation would be appreciated.

interpolation finite-element-method
interpolation finite-element-method
edited Jul 15 at 13:33
user21
22.7k7 gold badges66 silver badges107 bronze badges
22.7k7 gold badges66 silver badges107 bronze badges
asked Jul 15 at 12:30
Omar NagibOmar Nagib
1234 bronze badges
1234 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Change u[x] to u
vals, funs =NDEigensystem[-Laplacian[u[x], x], u , x, 0, [Pi], 4]
now
Plot[funs[[3]][x],x,0,Pi]
does what you are looking for.
To plot all the eigenfunctions try Plot[Through[funs[x]],x,0,Pi]

$endgroup$
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
1
$begingroup$
Tryff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi]orfff = Function[x, funs[[3]][x] + 2]
$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
1
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
|
show 1 more comment
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202115%2fproblem-with-interpolating-function-returned-by-ndeigensystem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Change u[x] to u
vals, funs =NDEigensystem[-Laplacian[u[x], x], u , x, 0, [Pi], 4]
now
Plot[funs[[3]][x],x,0,Pi]
does what you are looking for.
To plot all the eigenfunctions try Plot[Through[funs[x]],x,0,Pi]

$endgroup$
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
1
$begingroup$
Tryff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi]orfff = Function[x, funs[[3]][x] + 2]
$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
1
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
|
show 1 more comment
$begingroup$
Change u[x] to u
vals, funs =NDEigensystem[-Laplacian[u[x], x], u , x, 0, [Pi], 4]
now
Plot[funs[[3]][x],x,0,Pi]
does what you are looking for.
To plot all the eigenfunctions try Plot[Through[funs[x]],x,0,Pi]

$endgroup$
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
1
$begingroup$
Tryff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi]orfff = Function[x, funs[[3]][x] + 2]
$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
1
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
|
show 1 more comment
$begingroup$
Change u[x] to u
vals, funs =NDEigensystem[-Laplacian[u[x], x], u , x, 0, [Pi], 4]
now
Plot[funs[[3]][x],x,0,Pi]
does what you are looking for.
To plot all the eigenfunctions try Plot[Through[funs[x]],x,0,Pi]

$endgroup$
Change u[x] to u
vals, funs =NDEigensystem[-Laplacian[u[x], x], u , x, 0, [Pi], 4]
now
Plot[funs[[3]][x],x,0,Pi]
does what you are looking for.
To plot all the eigenfunctions try Plot[Through[funs[x]],x,0,Pi]

answered Jul 15 at 12:57
Ulrich NeumannUlrich Neumann
12.3k7 silver badges19 bronze badges
12.3k7 silver badges19 bronze badges
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
1
$begingroup$
Tryff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi]orfff = Function[x, funs[[3]][x] + 2]
$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
1
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
|
show 1 more comment
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
1
$begingroup$
Tryff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi]orfff = Function[x, funs[[3]][x] + 2]
$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
1
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
Thank you so much, this fixed my problem.
$endgroup$
– Omar Nagib
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
You're welcome!
$endgroup$
– Ulrich Neumann
Jul 15 at 13:33
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
$begingroup$
On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example?
$endgroup$
– Omar Nagib
Jul 15 at 13:50
1
1
$begingroup$
Try
ff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi] or fff = Function[x, funs[[3]][x] + 2]$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
$begingroup$
Try
ff = FunctionInterpolation[2 funs[[3]][x], x, 0, Pi] or fff = Function[x, funs[[3]][x] + 2]$endgroup$
– Ulrich Neumann
Jul 15 at 13:53
1
1
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
$begingroup$
There are no errors in both variants( of my comment). Perhaps the second variant is preferable.
$endgroup$
– Ulrich Neumann
Jul 15 at 14:09
|
show 1 more comment
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202115%2fproblem-with-interpolating-function-returned-by-ndeigensystem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown