Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.3K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Define a function using NDSolve?

Hello, colleagues

I am making a simple code.

rhs[x_, y_, om_] := f2[x, y, om]/x/f1[y];
psr[ro_, om_, a_] :=  NDSolve[{f'[t] - rhs[t, f[t], om] == 0, f[a] == 1}, f, {t, a, 1}][[1]][[1]][[2]][ro];

rhs is defined based on the functions of f1 and f2.

An ODE, f ' [t] == rhs[t, f [t], om ] , is solved using NDSolve, then its calcuation result defines a new function, psr[ro_,om_,a_].

My question is what the role of [[1]][[1]][[2]][ro] at the end of psr. I just guess it may be related to the positions and dimensions of variables of psr.

Thanks for the answers in advance.

POSTED BY: Richard Edwin
5 Replies

Dear @Richard Edwin, welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your posts and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

enter image description here

POSTED BY: EDITORIAL BOARD

I am sorry. The problem you pointed out is just corrected.

Thank you for the comment.

POSTED BY: Richard Edwin
POSTED BY: Michael Rogers

Thank you so much for the perfect answer !!!

I am sure your advice will improve my performace to code.

Thank you again.

POSTED BY: Richard Edwin

Me too I have not see this function....

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