Post Reply 
System of differenital equations with odesolve
01-26-2024, 08:10 AM
Post: #1
System of differenital equations with odesolve
Dear community,

I want to solve a system of differential equations numerically by using the odesolve command.
I think it should be possible, but I am not able to figure out the correct syntax to do so.
By searching the web I have found the following example:
Code:

DE1:=diff(y1(x),x)=y2(x)
DE2:=diff(y2(x),x)=-y1(x)

IC1:=y1(0)=1
IC2:=y2(0)=0

odesolve({DE1,DE2},{y1(x),y2(x)},{IC1,IC2},x)
However, I know the {} cannot be correct, so I replaced them with [], but it does not work either.
Could somebody please give me a hint to solve this.

Thank you in advance.
Best wishes,
Jo
Find all posts by this user
Quote this message in a reply
01-27-2024, 08:36 PM
Post: #2
RE: System of differenital equations with odesolve
Here is an example:
Code:

f(t,v):=[-v[2],v[1]];
odesolve(0..pi,f,[0,1])
The second argument of odesolve must be a function of the time variable and of a vector, returning a vector of the same vector space.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)