Why am I getting this Mathematica error - "Syntax: Incomplete expression more input is needed" - syntax-error

I'm running this on Wolfram cloud. Here's the code
ClearAll[s,l,L,L1,M1,Mt,m,M,vym,vxm,wp,J,Meff,theta,omega]
Rr = {{Cos[theta],-Sin[theta],0},{Sin[theta],Cos[theta],0},{0,0,1}};
Wm = {0,0,omega};
This is obviously part of a larger code, but just this much is enough to create the error. If I remove any line, the error disappears. I can't for the life of me figure out where a syntax error could be in here!

Related

TI-84 Plus Syntax Error in resistance program

I'm writing a program for my circuit analysis class that calculates the total resistance in parallel resistors given a list of the Ohms of each resistor. My code is as follows:
DelVar ⌊RL
Input "R List: ",⌊RL
0→RT
For(X,1,dim(⌊RL))
RT+(⌊RL(X))→RT
End
RT→Ans
Disp RT
The code looks fine to me. The little square in there is actually a ^-1 in the calculator. But I get a syntax error when I run this code, which for whatever reason points me to the line 0→RT.
Figured it out, apparently most models of the TI-84 don't allow more than 1 letter variable names for number vars. Also yes I noticed a couple mistakes with the calculation in my code, and have fixed it:
DelVar ⌊RL
Input "R List: ",⌊RL
0→R
For(X,1,dim(⌊RL))
R+(⌊RL(X))→R
End
Disp R

implementing components of a computer processor using .hdl and the Hardware Simulator (nand2tetris)

I'm having trouble getting my .hdl files to loads in the HardwareSimulator. So far I have implemented FullAdder.hdl and Add16.hdl.
The error message I'm recieving is
line 22, zab has no source pin
Here is the relevant code for the Add16:
CHIP Add16 {
IN x[16], y[16];
OUT out[16];
PARTS:
HalfAdder(x=x[0],y=y[0],sum=out[0],carry=c);
FullAdder(x=x[1],y=y[1],c=c,sum=out[1],carry=d);
FullAdder(x=x[2],y=y[2],c=d,sum=out[2],carry=e);
FullAdder(x=x[3],y=y[3],c=e,sum=out[3],carry=f);
FullAdder(x=x[4],y=y[4],c=f,sum=out[4],carry=g);
FullAdder(x=x[5],y=y[5],c=g,sum=out[5],carry=h);
FullAdder(x=x[6],y=y[6],c=h,sum=out[6],carry=i);
FullAdder(x=x[7],y=y[7],c=i,sum=out[7],carry=j);
FullAdder(x=x[8],y=y[8],c=j,sum=out[8],carry=k);
FullAdder(x=x[9],y=y[9],c=k,sum=out[9],carry=l);
FullAdder(x=x[10],y=y[10],c=l,sum=out[10],carry=m);
FullAdder(x=x[11],y=y[11],c=m,sum=out[11],carry=n);
FullAdder(x=x[12],y=y[12],c=n,sum=out[12],carry=o);
FullAdder(x=x[13],y=y[13],c=o,sum=out[13],carry=p);
FullAdder(x=x[14],y=y[14],c=p,sum=out[14],carry=q);
FullAdder(x=x[15],y=y[15],c=q,sum=out[15],carry=drop);
}
I'm strugginling to find the error since I'm pretty sure I've implemented this chip in exactly the same way in the past and it worked fine.
As for the full adder, it's the same error message but for line 16.
I'll provide the relevant code for this part also:
CHIP FullAdder {
IN x, y, z; // 1-bit inputs
OUT sum, // Right bit of x + y + z
carry; // Left bit of x + y + z
PARTS:
HalfAdder(x=x,y=y,sum=xy,carry=zxy);
HalfAdder(x=z,y=xy,sum=sum,carry=s);
Or(x=zab,y=s,out=carry);
}
I can't wrap my mind around the error referring to line 16. That's way after the terminating bracket in FullAdder.
I've browsed the internet and as far as I can tell my implementation is perfectly correct. Any advice from anyone who are proficient in the Computer Processors area? This would definitely be useful for anyone else who are running into the same/similar problems.
Thanks
edit: According to this link Logic Gates my implementation looks more or less exactly the same. Could it be a faulty HardwareSim at my end? Although I doubt that since I've used it in the past and it was recommended to me by my University.
The problem is in the x input to your Or gate in the FullAdder. You are referring to a signal (pin) "zab" but no such signal is defined.
In future, please remember to post the entire files. It is hard to help you diagnose an error in line 16 when it is difficult to tell what line that actually is.

Is division by zero considered error or failure?

When my program stops working due to division by 0 then is it considered error or failure?
Error is called when a human action produces an incorrect result. Failure is when we get different result than expected. I'm just wondering if the unexpected stop from program is a error by human or failure of the program?
It is considere as an error. Or we can also called this an exception. And if u dont want to prevent this u can use exception handling.
Depending on the programming environment and the type of number (e.g. floating point, integer) being divided by zero, it may generate positive or negative infinity, generate an exception, generate an error message, cause the program to terminate.
It is a type of failure when it is in compile time but it is an error because usually this type of an error occur when the program is compiled and then executed

SciLab - Stack size exceeded

So, I have this project for school in which I have to write code in SciLab to solve a puzzle (Tents). The code is getting longer and longer as it gets better and better, but I suddenly got an error stating "stack size exceeded".
Error log:
!--error 17
stack size exceeded!
Use stacksize function to increase it.
Memory used for variables: 28875
Intermediate memory needed: 59987764
Total memory available: 10000000
I tried using this line
stacksize('max')
And this one
stacksize(1e8)
Neither of which works, all that happens is SciLab shutting itself down without any warning at all.
How did I exceed my stacksize? Is there a way to prevent this? How can I continue further?
I figured out myself how to solve this problem. Here's what I did wrong for people with the same problem:
Within a function I used the line
[m,n] = [x,y]
to save the coordinates of an object from a matrix. This was called within a loop using x and y to browse through the matrix.
Apparently this caused the stacksize exceeded error and here's how I wrote it afterwards:
m = x
n = y
I have no idea why this line caused this error, but this is how I've solved it.

MATLAB Genetic Algorithm "Subscripted assignment dimension mismatch" Error

When trying to use the Genetic Algorithm solver in MATLAB, I'm getting the following "Subscripted assignment dimension mismatch" error: Error Message Pastebin
Now, it says the error has to do with the fitness function at the end, but when I test my fitness function separately, it works without errors. I can also link the code for my fitness and constraint functions if that would help.
Thank you very much!
I think I see what is happening... Because one of the appendages to CDraft is inside the if, you don't always return the same length vector - i.e., you return a constraint vector the first time, it preallocates a matrix for your constraint output, then the next time round you give it back something that doesn't fit in this matrix, so you get the error.
The clue is in the error stack: at the top of the stack we have
Subscripted assignment dimension mismatch.
Error in C:\Program
Files\MATLAB\R2012b\toolbox\globaloptim\globaloptim\private\gaminlppenaltyfcn.p>i_convectorizer
(line 135)
Clearly this is not a function you've written, and inspecting your function there's nothing that should cause this error. The end of the error gives another clue
Caused by:
Failure in initial user-supplied fitness function evaluation. GA cannot continue.
The ga function is reporting an error in the bit of the code that handles user-supplied constraints. It is likely that this whole bit of code (the call to the user-supplied function and other associated lines) are all within one try...catch statement that returns this error. Something like this:
try
c = userConFun(x);
if isempty(cHistory)
cHistory = zeros(length(c), 1000); % or whatever
end
cHistory(:, currentIterationIndex) = c;
catch err
error('Failure in user-supplied fitness function blah blah blah');
end
Consequently, it looks like the error came from your function, even though it occurred after your function returned.