Page 1 of 1

### Differential equation with Scilab question

Posted: 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 ### Re: Differential equation with Scilab question

Posted: 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?

### Re: Differential equation with Scilab question

Posted: Thu Nov 09, 2017 2:17 pm
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.

### Re: Differential equation with Scilab question

Posted: 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.

### Re: Differential equation with Scilab question

Posted: Thu Nov 09, 2017 8:46 pm
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.

### Re: Differential equation with Scilab question

Posted: Fri Nov 10, 2017 2:59 pm
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 ### Re: Differential equation with Scilab question

Posted: Fri Nov 10, 2017 3:29 pm
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.