How can I fix the sign issue in my NDSolve command in Mathematica?

  • Mathematica
  • Thread starter burcuugur
  • Start date
  • Tags
    Mathematica
In summary, the speaker is seeking help with modeling a process using NDSolve and is having issues with reaching the maximum number of steps. They have found a solution by changing a sign in the NDSolve command, but are unsure if it is the correct approach. They have attached a Mathematica file and would appreciate assistance in simplifying the problem.
  • #1
burcuugur
2
0
Hi,

I'm trying to model a process by making mass and energy balances using the NDSolve. It reaches the maximum number of steps

It is working when I put "-" sign in front of this [Rho]p*(1 - ec)*\[CapitalDelta]H*D[q[z, t], t] (in 3rd equation) in the NDSolve command. But it should be "+" sign.

I attached the mathematica file.

I would really appreciate some help. This is really important for me.
 

Attachments

  • Mathematica Original.nb
    55.3 KB · Views: 396
Last edited:
Physics news on Phys.org
  • #2
burcuugur said:
I attached the mathematica file.

I don't see the attached notebook. Perhaps something didn't get clicked on. Perhaps there is some restriction involved.

If you could simplify your problem down enough that you could just scrape your NDSolve[] expression, paste it into your post and then edit it to make certain that it was all readable then that might be enough.

If you scrape and paste then carefully check it after you complete the post and edit as necessary to make certain it is all there and readable.
 
  • #3
Sorry for that. I attached it now.
 
  • #4
MaxSteps->more?
 
  • #5


Hello,

Thank you for reaching out for help with your NDSolve in Mathematica. It seems like you are experiencing some issues with the sign in your third equation. Have you tried double-checking your calculations and equations to make sure that the sign is indeed supposed to be a "+" sign? It's possible that there may be a mistake in your calculations that is causing the issue.

Additionally, I would recommend reaching out to the Mathematica community or forums for more specific and detailed help with your code. There are many experienced users who may be able to provide insight and assistance in troubleshooting your NDSolve. Good luck with your modeling process!
 

FAQ: How can I fix the sign issue in my NDSolve command in Mathematica?

How do I use NDSolve in Mathematica to solve a differential equation?

To use NDSolve in Mathematica, you need to define the differential equation using the syntax eqn = y'[x] == f[x,y[x]] and then use the command NDSolve[eqn, y, {x,x0,xmax}] where y is the dependent variable, x is the independent variable, and {x0,xmax} specifies the range of values for x.

How do I input initial conditions in NDSolve?

To input initial conditions in NDSolve, you can add the option y[x0] == y0 to the NDSolve command, where x0 is the initial value of x and y0 is the initial value of y.

How can I plot the solution obtained from NDSolve in Mathematica?

To plot the solution obtained from NDSolve, you can use the command Plot[y[x] /. sol, {x,x0,xmax}] where sol is the output of the NDSolve command and {x0,xmax} specifies the range of values for x.

Can I use NDSolve in Mathematica to solve a system of differential equations?

Yes, you can use NDSolve in Mathematica to solve a system of differential equations by defining the equations using the syntax eqns = {y1'[x] == f1[x,y1[x],y2[x]], y2'[x] == f2[x,y1[x],y2[x]]} and then using the command NDSolve[eqns, {y1,y2}, {x,x0,xmax}] where y1 and y2 are the dependent variables and {x0,xmax} specifies the range of values for x.

How do I specify boundary conditions in NDSolve?

To specify boundary conditions in NDSolve, you can add the options y[x0] == y0 and y[xmax] == ymax to the NDSolve command, where x0 and xmax are the boundary values of x and y0 and ymax are the corresponding boundary values of y.

Similar threads

Replies
6
Views
3K
Replies
1
Views
2K
Replies
2
Views
3K
Replies
4
Views
8K
Replies
2
Views
2K
Back
Top