Differential equation with Scilab question

Messages about other areas of TRIUS expertise (Energy, Radiation Safety, Risk,..) and Technology, in general...
Post Reply
User avatar
Dale Valenti
Casual User
Casual User
Posts: 12
Joined: Wed Nov 02, 2011 8:23 pm

Differential equation with Scilab question

Post by Dale Valenti »

Hi everyone, Hope you can help. I have to set up scilab to solve a differential equation, but I don't know how to get started. Here is the equation.

dy/dx=(x+1/y) , y(0)=0.1

Any help you can provide will be helpful. Also, this is time sensitive, so the sooner you can replay the more thankful I will be :-)
User avatar
NumCruncher
New User
New User
Posts: 6
Joined: Mon Nov 06, 2017 3:03 pm

Re: Differential equation with Scilab question

Post by NumCruncher »

Dale Valenti wrote: Mon Nov 06, 2017 2:35 pm Hi everyone, Hope you can help. I have to set up scilab to solve a differential equation, but I don't know how to get started. Here is the equation.

dy/dx=(x+1/y) , y(0)=0.1

Any help you can provide will be helpful. Also, this is time sensitive, so the sooner you can replay the more thankful I will be :-)
Is this for a homework or something? I don't mind helping, but if it's for a homework assignment, just giving you the solution would be a disservice.

Have you tried and are you getting stuck at a certain point during the solution? What is that point?
User avatar
Dale Valenti
Casual User
Casual User
Posts: 12
Joined: Wed Nov 02, 2011 8:23 pm

Re: Differential equation with Scilab question

Post by Dale Valenti »

NumCruncher wrote: Mon Nov 06, 2017 5:14 pm
Dale Valenti wrote: Mon Nov 06, 2017 2:35 pm Hi everyone, Hope you can help. I have to set up scilab to solve a differential equation, but I don't know how to get started. Here is the equation.

dy/dx=(x+1/y) , y(0)=0.1

Any help you can provide will be helpful. Also, this is time sensitive, so the sooner you can replay the more thankful I will be :-)
Is this for a homework or something? I don't mind helping, but if it's for a homework assignment, just giving you the solution would be a disservice.

Have you tried and are you getting stuck at a certain point during the solution? What is that point?
I am not an expert in Scilab and I have to solve this problem. If you can help guide me and point me to the right direction, please do - I will be thankful. Yes, it is for homework (sort of), but I am not asking you to just give me the solution, just help me understand the basic concept(s) and I will take it from there.
User avatar
NumCruncher
New User
New User
Posts: 6
Joined: Mon Nov 06, 2017 3:03 pm

Re: Differential equation with Scilab question

Post by NumCruncher »

O.K., Dale. I guess I don't know what is it that you are having a hard time with. Scilab has a built-in function to solve ordinary differential equations (ODE). Are you looking for something beyond that? Anyway, here is a short script that will solve your equation.

// dy/dx=(x+1)/y, y(0)=0.1
clc
function ydot=f(x, y)
ydot=(x+1)/y
endfunction
y0=0.1;
y=ode(y0,x0,x,f);
// You can even plot it to see what it looks like
plot(x,y)


let me know if that's not what you were looking for.
User avatar
JimCuren
Casual User
Casual User
Posts: 13
Joined: Thu Nov 09, 2017 8:07 pm

Re: Differential equation with Scilab question

Post by JimCuren »

This is great. I find better answers here than what I am finding in the scilab specific forums. I guess those are for people that already have expertise on the subject.

I also have a question. Does anyone know of a scilab script for doing exponential interpolations?

Thanks in advance for any help.
User avatar
NumCruncher
New User
New User
Posts: 6
Joined: Mon Nov 06, 2017 3:03 pm

Re: Differential equation with Scilab question

Post by NumCruncher »

Hey Jim. Since this message thread is about scilab and diff equations, you may want to post your question about the interpolation in a new thread with its own subject line. This way those that can help will :P
User avatar
Dale Valenti
Casual User
Casual User
Posts: 12
Joined: Wed Nov 02, 2011 8:23 pm

Re: Differential equation with Scilab question

Post by Dale Valenti »

NumCruncher wrote: Thu Nov 09, 2017 2:48 pm O.K., Dale. I guess I don't know what is it that you are having a hard time with. Scilab has a built-in function to solve ordinary differential equations (ODE). Are you looking for something beyond that? Anyway, here is a short script that will solve your equation.

// dy/dx=(x+1)/y, y(0)=0.1
clc
function ydot=f(x, y)
ydot=(x+1)/y
endfunction
y0=0.1;
y=ode(y0,x0,x,f);
// You can even plot it to see what it looks like
plot(x,y)

let me know if that's not what you were looking for.
Thank you! That's exactly what I was looking for.
Post Reply