Group Abstract Group Abstract

Message Boards Message Boards

solve a problem with two equations and x[i+1]-x[i] , RecurrenceTable?

Posted 9 years ago

Hi!

I am stuck trying to solve a problem with two equations and two unknowns, where:

x[i]=T-Constant and
x[i+1]-x[i]=a very large equation with T and i as the only variables.
I want to evaluate the equations for i=1 to imax.
Finally, I want to plot T as a function of i.

I was thinking that I would use Do[], like the following:

Do[x[i]==T-Constant; x[i+1]-x[i]==a very large equation,{i,imax}] 

When I use Do, I get the following errors:
Do::itraw: Raw object 1 cannot be used as an iterator. >>
General::stop: Further output of Solve::nsmet will be suppressed during this calculation. >>

Or should I use a solver function to find T? For Loop?
Any ideas?

Thanks for your time reading my question. I would appreciate any helpful comments, and I apologize if this is a trivial question as I am new to Wolfram language and programming in general.

Thanks,

Matt

POSTED BY: Matthew Doyon
2 Replies

You can define x[i] this way:

x[1] = whatever;
x[i_] := x[i] = x[i - 1] + largeEquation;

I don't quite understand what you want to do with it.

POSTED BY: Gianluca Gorni
Posted 9 years ago

Hi I apologize the question was not really clear. I was eventually able to figure it out. Mathematica has a handy built in function RSolve for recurrence equations. Because I need to plot the data, I ended up using RecurrenceTable[], like the following:

RecurrenceTable[ { (x[i + 1] - x[i] == ... ...

ListPlot[%, PlotRange -> All]

POSTED BY: Matthew Doyon
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard