Message Boards Message Boards

0
|
414 Views
|
7 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Loop of solving integrals constants doesn't work properly?

Posted 12 days ago

There are 6 steps whereby I use DSolve, then Update and evaluate the Mathematica package. Each step the output yields a function which contains obviously integration constants. For example Step 2 output yields a function with integration constants C1 , C2, C3 . Step 3 outputs yields a function with integration constants C1, C2 (instead of C4 , C5). Step 4 outputs a function with integration constants, C1, C2 (instead of C6 , C7). See attachment

May you please assist with a way of achieving obtaining continuous integration constants.

POSTED BY: Nomsa Ledwaba
7 Replies

You can do a replacement like C[1]->C[2] when you need it.

POSTED BY: Gianluca Gorni
Posted 7 days ago

Can I use GeneratedParameters -> (Module[{C}, C] &) so that every time I execute DSolve achieve the continuous integration constants?

POSTED BY: Nomsa Ledwaba

Yes, you can, if you like constants of the form C$5267. Another way:

constantCounter = 1;
DSolve[y''[x] == y[x], y, x, 
 GeneratedParameters -> (C[constantCounter++] &)]
DSolve[y''[x] == y[x], y, x,
 GeneratedParameters -> (C[constantCounter++] &)]

although I don't understand the jumps in the numbers that come out.

POSTED BY: Gianluca Gorni
Posted 5 days ago

In my case is the partial derivative of u[x,t]. This is what I have written:

constantCounter = 1;
DSolve[ D[u[x, t], {x, 2}] == -(3 /(2*k*\[Theta])) x  D[u[x, t], t] - 
   k  3 /(2*k*\[Theta]) x  (\[Theta] - x) D[u[x, t], x] + 
   3 /(2*k*\[Theta])  x*x * 
    u[x, t] (*y''[x]==y[x]*)(*EDs[[5]]*), u, x, t, 
 GeneratedParameters -> (C[constantCounter++] &)]

This is the Output:

DSolve[
\!\(\*SuperscriptBox[\(u\), 
TagBox[
RowBox[{"(", 
RowBox[{"2", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, t] == (3 x^2 u[x, t])/(2 k \[Theta]) - (
   3 x 
\!\(\*SuperscriptBox[\(u\), 
TagBox[
RowBox[{"(", 
RowBox[{"0", ",", "1"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, t])/(2 k \[Theta]) - (
   3 x (-x + \[Theta]) 
\!\(\*SuperscriptBox[\(u\), 
TagBox[
RowBox[{"(", 
RowBox[{"1", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, t])/(2 \[Theta]), u, x, t, 
 GeneratedParameters -> (C[constantCounter++] &)]

No evaluation. Please advise how to enter partial differential equation for this GeneratedParameters command to work.

POSTED BY: Nomsa Ledwaba

It is not a question of parameters, rather, the equation is just too difficult to solve:

DSolve[D[u[x, t], {x, 2}] == -(3/(2*k*\[Theta])) x D[u[x, t], t] - 
   k 3/(2*k*\[Theta]) x (\[Theta] - x) D[u[x, t], x] + 
   3/(2*k*\[Theta]) x*x*u[x, t] , u, {x, t}]

Sorry, I realized now that my suggestion GeneratedParameters -> (C[constantCounter++] &) can give wrong formulas:

constantCounter = 1;
eq = D[u[x, t], {x, 2}] == D[u[x, t], t];
sol = DSolveValue[eq,
  u, {x, t},
  GeneratedParameters -> (C[constantCounter++] &)]
eq /. u -> sol /.
 {t -> 0, x -> 1, C[4 | 5] -> 0, C[7 | 8] -> 1, C[6] -> 0}
POSTED BY: Gianluca Gorni
Posted 21 hours ago

This is what I've written in place of the equation. I only replaced the differential equation.

'eq = D[u[x, t], {x, 2}] == -(3 /(2*k*\[Theta])) x  D[u[x, t], t] - 
    k  3 /(2*k*\[Theta]) x  (\[Theta] - x) D[u[x, t], x] + 
    3 /(2*k*\[Theta])  x*x * u[x, t];
sol = DSolve(*Value*)[eq, u, {x, t}, 
  GeneratedParameters -> (C[constantCounter++] &)]
eq /. u -> sol /.
 {t -> 0, x -> 1, C[1 | 2] -> 0, C[4 | 5] -> 1, C[7 | 8] -> 0, 
  C[6] -> 1}'

However, there are errors:

  • DSolve::dsvar: 1 cannot be used as a variable.
  • General::stop: Further output of DSolve::dsvar will be suppressed during this calculation.
  • Increment::rvalue: constantCounter is not a variable with a value, so its value cannot be changed.
POSTED BY: Nomsa Ledwaba

The equation is too difficut, it cannot solve it. The errors are consequence of this.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract