img
i
회원가입시 광고가 제거 됩니다
Using eigenvalues of an differential operator to numerically solve another differential equation and use the solutions to perform integration
2 $\begingroup$ I am trying to use eigenvalues of a differential operator in another differential equation to find solutions of the later. Next I want to use the solutions to perform a numerical integration where I want to use solutions for two different eigenvalues. plain text code: a = NDEigenvalues[-Laplacian[u[x], {x}] + u[x], u[x], {x, -5, 5},4];(* a[[n]] gives the nth eigenvalue *) pfun = ParametricNDSolveValue[{y'[t] == a[[n]]*y[t], y[0] == 1}, y, {t, 0, 10}, {n}]; (* I want to use the nth eigenvalue a[[n]] in the second line and find the solution such that the solution can be accessed using pfun[x][n] the parameter n for performing integration later*) s[n_, m_] := NIntegrate[pfun[x][n]*x*pfun[x][m], {x, 0, 1}](* Trying to define s that can be accessed using parameter n and m *) differential-equationsnumerical-integrationfinite-element-methodparametric-functionseigenvalues Share Improve this question Follow edited 3 hours ago user21 40.8k88 gold badges114114 silver badges170170 bronze badges asked 12 hours ago Sadman SakibSadman Sakib 3144 bronze badges New contributor Sadman Sakib is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. $\endgroup$ 3 1 $\begingroup$ The error message is clear. You can't type a[[n]] where n has no value. If you also post plain text code you used., may be someone could show you how to do what you want in other ways. $\endgroup$ – Nasser Commented 12 hours ago $\begingroup$ I want to use eigenvalues of an differential operator in another differential equation. Numerically solve the second differential equation such that the solutions can be accessed using a parameter to be used in an integration later. $\endgroup$ – Sadman Sakib Commented 11 hours ago 1 $\begingroup$ @SadmanSakib welcome to MSE. Your approach just need a little adjustment. Nasser answer is a neat way to treat also. Good luck. $\endgroup$ – ubpdqn Commented 9 hours ago Add a comment  |