Mathematica Asked on July 1, 2021
Consider the following code:
ClearAll["Global`*"]
s0 = ParametricNDSolveValue[{A''[t] - [Omega]^2 A[t] == 1, A[0] == 0,
A[1] == 0}, A, {t, 0, 1}, {[Omega]}]
A1[[Omega]_?NumericQ][t] := s0[[Omega]][t];
s1 = ParametricNDSolveValue[{B''[t] - [Omega]^2 B[t] ==
D[A1[[Omega]][t], t], B[0] == 0, B[1] == 0},
B, {t, 0, 1}, {[Omega]}]
B1[[Omega]_?NumericQ][t] := s1[[Omega]][t];
Plot[B1[1][t], {t, 0, 1}]
I get the error "Dependent variables {B,A1[[Omega]]} cannot depend on parameters { [Omega]}"
.
How do I get rid of this error? In the second equation A1
should be a known function, not a dependent one.
Try this:
s0 = ParametricNDSolveValue[{A''[t] - [Omega]^2 A[t] == 1, A[0] == 0,
A[1] == 0}, A, {t, 0, 1}, {[Omega]}];
s1 = ParametricNDSolveValue[{B''[t] - [Omega]^2 B[t] ==
D[s0[[Omega]][t], t], B[0] == 0, B[1] == 0},
B, {t, 0, 1}, {[Omega]}];
Plot[s1[1][t], {t, 0, 1}]
Have fun!
Correct answer by Alexei Boulbitch on July 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP