This Script run on Octave platform. The script get input second order differential equation with initial condition, of the form:
% Script to solve second-order differential equation
% Specify the second-order derivative by using:
% diff and the equation by using ==.
% Then, solve the equation by using dsolve.
% load symbolic package, and initilize PYTHON variable
pkg load symbolic
setenv PYTHON C:\ProgramData\Anaconda3\pythonw.exe
% Define symbolic variables:
% y(t) - function y and argumenr t
% a - parameter
% y0 - initial condition for y(t) - y(0) = y0
% y1 - initial condition for y'(t) - y'(0) = y1
syms y(t) a y0 y1
% **** input the equaion here: *****
eqn = diff(y,t,2) == a*y;
% S = dsolve(eqn, cond)
S = dsolve (eqn, y(0) == y0, diff(y)(0) == y1)
% Specify the second-order derivative by using:
% diff and the equation by using ==.
% Then, solve the equation by using dsolve.
% load symbolic package, and initilize PYTHON variable
pkg load symbolic
setenv PYTHON C:\ProgramData\Anaconda3\pythonw.exe
% Define symbolic variables:
% y(t) - function y and argumenr t
% a - parameter
% y0 - initial condition for y(t) - y(0) = y0
% y1 - initial condition for y'(t) - y'(0) = y1
syms y(t) a y0 y1
% **** input the equaion here: *****
eqn = diff(y,t,2) == a*y;
% S = dsolve(eqn, cond)
S = dsolve (eqn, y(0) == y0, diff(y)(0) == y1)
Example :
Differential equation with initial condition:
% **** input the equaion here: *****
eqn = diff(y,t,2) == a*y;
% S = dsolve(eqn, cond)
S = dsolve (eqn, y(0) == y0, diff(y)(0) == y1)
eqn = diff(y,t,2) == a*y;
% S = dsolve(eqn, cond)
S = dsolve (eqn, y(0) == y0, diff(y)(0) == y1)
The Solution:
No comments:
Post a Comment