1st program with problems "Euler Method"
|
12-26-2019, 12:21 AM
Post: #1
|
|||
|
|||
1st program with problems "Euler Method"
I was told that an Euler's method program would be easy to make... On this forum? Somewhere... anyway that doesn't matter. I think it should be an easy program.
I'm getting an Invalid Input error and I think it has something to do with passing a function. I have this 'slopefield' app that someone wrote and I tried to pass the function the same way he did it... But it doesn't work for me in this instance. By the way... I'm just learning about differentials AND programming. So maybe I'm doing something all wrong. Obviously there would be a return or a print of s after the loop finishes. I didn't get that far in programming yet. While previewing the post, I just had a thought... 'maybe I'm doing the matrix wrong.' Code:
sample input Code:
|
|||
12-26-2019, 07:04 PM
Post: #2
|
|||
|
|||
RE: 1st program with problems "Euler Method"
For the first three lines of your program, I think this is what you want:
Code: EXPORT eulerm(funct,X0,Y0,ch,times) With those changes, eulerm("(3-y)*(y+1)",0,4,1,5) will return (y+1)*(-y+3) Nothing after the return statement will be executed. -road |
|||
12-26-2019, 08:44 PM
Post: #3
|
|||
|
|||
RE: 1st program with problems "Euler Method"
Quote:For the first three lines of your program, I think this is what you want: Thank You roadrunner. I was able to get the program to run properly with your help. Then finding the debug softkey I was able to find out the matrices were incorrect too as they don't start with position [0,0]. The resulting display is good enough for me. But I would like to figure out a way to make it more user friendly. And maybe add in some functionality that allows the change to be negative. Something to tool around with in between quarters at school. The program operates fine on my physical device... But I'm getting a syntax error at s(a,2):=y+(f(x,y))*ch; right after 'f' on the PC emulated HP Prime. Like the variable isn't defined yet or something... i'm not sure. Here is the proof of concept version of the Euler's Method program: funct = the given equation X0=initial x value Y0=inital y value ch=change in x times = number of times the method is executed Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)