Message Boards Message Boards

GROUPS:

Plot a DifferentialRoot?

Posted 5 months ago
574 Views
|
3 Replies
|
1 Total Likes
|

I have a problem with DifferentialRoot command. I am trying to solve certain ODE by DSolve and the solution is given as DifferentialRoot expression. Unfortunately when I try to work with it I obtain an error written below in the example.

I have traced the problem to this simplified question. When I execute the following

Plot[DifferentialRoot[Function[{y, x}, {-y''[x] + y[x] == 0, y[1] == 3, y'[1] == 1}]][x], {x, 0, 1}]

I obtain plot of the solution to this equation. However when I change the coefficient in the equation to

Plot[DifferentialRoot[Function[{y, x}, {-y''[x] +0.5 y[x] == 0, y[1] == 3, y'[1] == 1}]][x], {x, 0, 1}]

I obtain an empty plot. Executing the command

DifferentialRoot[Function[{y, x}, {-y''[x] +0.5 y[x] == 0, y[1] == 3, y'[1] == 1}]]

leads to the following error

DifferentialRoot::ieqn: The supplied equation in Function[{y,x},{-(<<<<1>>>>^(<<<<1>>>>))[<<<<1>>>>]+0.5 y[<<<<1>>>>]==0,y[1]==3,(y^\[Prime])[1]==1}] is not a linear differential equation with polynomial coefficients.**
**DifferentialRoot::ifprec: Parameters in DifferentialRoot[Function[{y,x},{-(<<1>>^(<<1>>))[<<1>>]+0.5 y[<<1>>]==0,y[1]==3,(y^\[Prime])[1]==1}]] are not exact numbers.

Does anyone have any suggestion what the problem is? Both equation are perfectly well defined solvable second order linear ODE. I have attached the file of the example.

Attachments:
3 Replies

Error messages says, you don't uses exact numbers(polynomial coefficients).Use: 1/2 not 0.5.

 Plot[DifferentialRoot[
    Function[{y, x}, {-y''[x] + 1/2*y[x] == 0, y[1] == 3, 
      y'[1] == 1}]][x], {x, 0, 1}]

Then works.

Posted 5 months ago

Thank you for the reply. Do I understand it correctly that if I would like to have coefficients which are not whole numbers I always need to use Rationalize enviroment for them?

Yes.Use:

Rationalize[0.5, 0]
(*1/2*)
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