JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
7 months ago87 views
clc;
clear;

% Declare symbolic variables
syms t x y z
 
% Input the function
f = input('Enter the function f(x,y,z): ');
 
% Input variable relations
x_t = input('Enter x as a function of t: ');
y_t = input('Enter y as a function of t: ');
z_t = input('Enter z as a function of t: ');
 
% Partial derivatives
fx = diff(f, x);
fy = diff(f, y);
fz = diff(f, z);
 
% Total derivative using chain rule
dfdt = subs(fx, x, x_t)*diff(x_t, t) + ...
       subs(fy, y, y_t)*diff(y_t, t) + ...
       subs(fz, z, z_t)*diff(z_t, t);
 
% Display output
disp('Total derivative df/dt = ');
disp(simplify(dfdt));


2


clc;
clear;
 
syms y(x)
 
% Enter Bernoulli equation
eqn = input('Enter the Bernoulli equation: ');
 
% Solve the equation
sol = dsolve(eqn);
 
% Display solution
disp('Solution is:');
disp(sol);

3

clc;
clear;
 
% Input the function
f = input('Enter the function f(x,y): ');
 
% Input initial conditions
x0 = input('Enter initial value of x: ');
y0 = input('Enter initial value of y: ');
h  = input('Enter step size h: ');
xn = input('Enter final value of x: ');
 
x = x0;
y = y0;
 
while x < xn
    k1 = h * f(x, y);
    k2 = h * f(x + h/2, y + k1/2);
    k3 = h * f(x + h/2, y + k2/2);
    k4 = h * f(x + h, y + k3);
 
    y = y + (k1 + 2*k2 + 2*k3 + k4)/6;
    x = x + h;
end
 
disp('The solution using RK-4 method is:');
disp(y);

⚠️Content was pasted as plain text and auto-formatted as a code block. Use the Code Block button in the editor for proper formatting.

← Back to timeline