» Goto page 1, 2  Next

Code:
```For(W,1,dim(⌊OVER1 If C:Goto 10 If For(W,1,dim(⌊OVER1 If C:Goto 10 If (prod(⌊JONL1(W)-⌊TEMP4(W): End```

I am trying to get this code running. As an example I show the following.

JONL1 holds {1 7} and TEMP4 holds {1 3 5 7} so I want the result of this code

Code:
`(prod(⌊JONL1(W)-⌊TEMP4(W)`

to be {3 5}

Then new code after the ":"

Which will result with TEMP6 holding {1 0 0 7}
Try this:

Code:
```{1,3,5,7→∟TEMP4 {1,7→∟JONL1 SetUpEditorT8 0→dim(∟T8 For(N,1,dim(∟TEMP4 prod(seq(∟JONL1(X)≠∟TEMP4(N),X,1,dim(∟JONL1→∟T8(N End ∟TEMP4*∟T8→∟T8 SortD(∟T8 sum(∟T8≠0)→∟dim(∟T8 SortA(∟T8```

It's a variation of the solution to the other thread, and it dumps the solution to list T8 instead of T7.

Code:
```{1,3,5,7→⌊TEMP4 {1,7→⌊JONL1 SetUpEditor⌊T8 0→dim(⌊T8 (1+dim(⌊TEMP4)→C For(N,1,dim(⌊TEMP4 If C:Goto 10 prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→T8(N End ⌊TEMP4*⌊T8→⌊T8 SortD(⌊T8 sum(⌊T8≠0)→⌊dim(⌊T8 SortA(⌊T8 Output(1,1,⌊T8 Lbl 10```

Here is my code. The use of "C" is to provide a universal escape criterion. I get no output from the output statement and when checking T8 on the screen I get an invalid dim error.

I was going to work on this last night but It was late when I got your post and I have a very bad cough, so I put it off till this AM.
Since the dimension of a list can be zero at the least, this line sets C to something that is at least one.

Code:
`(1+dim(⌊TEMP4)→C`

If C is always at least one, this line will always be true.

Code:
`If C:Goto 10`

The reason you're not getting anything is because the program is skipping to Label 10, which skips the output command, the sort commands, the code in the For loop, and everything.
Previously I have used If J=5 when I knew That the Dim(LIST was 4.

How is this different?

In this case isn't C 5?

Code:
`If C:Goto 10`

Since C is always going to be 5, this will always be true, and it will always skip to Label 10, at the end of the program.
I modified the code as shown with a STOP command. That says 4 passes of N then stop, correct?

Code:
```{1,3,5,7→⌊TEMP4 {1,7→⌊JONL1 SetUpEditor⌊T8 0→dim(⌊T8 (1+dim(⌊TEMP4)→C For(N,1,dim(⌊TEMP4 If C:Stop prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→T8(N End ⌊TEMP4*⌊T8→⌊T8 SortD(⌊T8 sum(⌊T8≠0)→⌊dim(⌊T8 SortA(⌊T8 Output(1,1,⌊T8 ```

But T8 still returns an invalid dim error.
If you want it to stop after four passes of N, stick the Stop command after the For loop.
I have good news & bad news with the attached code which I will discuss

Code:
```{1,3,5,7→⌊TEMP4 {1,7→⌊JONL1 SetUpEditor⌊T8 0→dim(⌊T8 For(N,1,dim(⌊TEMP4 prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→⌊T8(N End ClrHome Output(1,1,"N Output(1,5,N Output(2,1,"T8 Output(2,8,⌊T8 Output(3,1,"T4 Output(3,8,⌊TEMP4 Output(4,1,"OV Output(4,5,⌊OVER1 Pause ClrHome (⌊TEMP4*⌊T8)→⌊T8 Output(2,1,"T8 Output(2,8,⌊T8 Pause ClrHome SortD(⌊T8 sum(⌊T8≠0)→dim(⌊T8 SortA(⌊T8 Output(1,1,⌊T8```

Code:
`prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→⌊T8(N`

originally looked like this

Code:
`prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→T8(N`

Thus the loop never ran. With that fix the loop ran. In this list of output statements I display the results

Code:
```Output(1,1,"N Output(1,5,N// 5 Output(2,1,"T8 Output(2,8,⌊T8//{0,1,1,0} Output(3,1,"T4 Output(3,8,⌊TEMP4//{1,3,5,7} Output(4,1,"OV Output(4,5,⌊OVER1//{1,7}```

Now the results of the second Output statements

Code:
```Output(2,1,"T8 Output(2,8,⌊T8 //{0,3,5,0}```

the final line of code produced this

Code:
`Output(1,1,⌊T8 // {3,5} instead of {1,0,0,7}`
Kerm,

Code:
`prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→⌊T8(N `

From my previous post you can see that it produced {0,1,1,0}

This morning I wrote this little test

Code:
```{1,3,5,7}→⌊TEMP4 {1,0,0,1}→⌊T8 (⌊TEMP4*⌊T8)→⌊T8 Output(2,1,"T8 Output(2,10,⌊T8 Pause ClrHome Output(1,1,⌊T8```

It works fine.

So how do we fix the code below

Code:
`prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→⌊T8(N `
Oh snap, I could have sworn there weren't any new posts here the last time I stopped by.

Code:
```{1,3,5,7→⌊TEMP4 {1,7→⌊JONL1 SetUpEditor⌊T8 0→dim(⌊T8 For(N,1,dim(⌊TEMP4 prod(seq(⌊JONL1(X)≠⌊TEMP4(N),X,1,dim(⌊JONL1→⌊T8(N End ClrHome Output(1,1,"N Output(1,5,N Output(2,1,"T8 Output(2,8,⌊T8 Output(3,1,"T4 Output(3,8,⌊TEMP4 Output(4,1,"OV Output(4,5,⌊OVER1 Pause ClrHome (⌊TEMP4*⌊T8)→⌊T8 Output(2,1,"T8 Output(2,8,⌊T8 Pause ClrHome SortD(⌊T8 sum(⌊T8≠0)→dim(⌊T8 SortA(⌊T8 Output(1,1,⌊T8```

Uh, what exactly is wrong with this? When I run it it works fine, and I get {3,5} stored into list T8.

Regarding the second post before this, list T8 is equal to {0,1,1,0} because it hasn't multiplied that by list TEMP4 yet.
I guess you forgot that T8 wants to be {1,0,0,7}

Code:
``` Not(lT8)*lTEMP4->lT8 ```
I thought that the whole point of the other thread was getting {1,0,0,7}...

I'm assuming you still need the zeros. Try this, it's smaller because rthprog made it.

Code:
```{1,3,5,7→⌊TEMP4 {1,7→⌊JONL1 SetUpEditor⌊T8 0→dim(⌊T8 dim(⌊TEMP4→dim(⌊T8 For(N,1,dim(⌊TEMP4 If not(prod(⌊JONL1-⌊TEMP4(N ⌊TEMP4(N→⌊T8(N End ```
John, could you explain exactly what the problem is? As far as I can tell, we've given you all the code that you need...

@EmperorWiggy

There's no need for

Code:
`SetUpEditor⌊T8 `
Oh yeah, that's true. I like overusing SetUpEditor and Unarchive commands when I'm working with lists.

I'll go see if I can optimize the code I... borrowed from you any further.
EmperorWiggy wrote:
Oh yeah, that's true. I like overusing SetUpEditor and Unarchive commands when I'm working with lists.

It's good to be safe
To all my senior programmers, I salute you.

I think we are done for a while. I have a lot of testing to do.

I presently do not know how we deal with these two boundary conditions?

1. How to we decide when the regression process is complete?
2. What do we do when there are no correct answers in a particular regression.

I have played with different ways to solve the 1) above. It is very clear we would be done then OVER1 held all "0s" like this

Code:
`{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}`

I do not know how to recognize the above condition. If we did, then we could do this:

Code:
```If (Your way of recognizing the above condition) Then other code goes here End```

I eagerly await some more of that senior programmer smarts.
KermMartian wrote:

Your code works under the assumption that all elements are nonnegative. Though it really doesn't make a difference to John, another way to check if all elements are 0 would be

Code:
`If prod(not(LOVER1`

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» Goto page 1, 2  Next
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum