17,895 reputation
12160
bio website
location
age
visits member for 2 years, 3 months
seen 10 hours ago

2d
comment What is wrong with this code compilation?
If you post the code, maybe someone will be able to help.
2d
comment What is wrong with this code compilation?
change = to == ? Or just remove = altogether. I do not know why you have it there. You can't assign to a polynomial.
2d
comment Mathematica Implementation of Householder’s Method
For the Sum::write: Tag Set in k=j+1 is error, simply change k= to k,. Now Alist is generated. I do not know if it is correct or not.
2d
comment Mathematica Implementation of Householder’s Method
I see now. The Householder matrix is one step used in the Householder method. The code you linked to only generates the Householder matrix, it does not implement the full transformation. Here is a Mathematica implementaion I found: mathfaculty.fullerton.edu/mathews/n2003/HouseholderMod.html
2d
comment Mathematica Implementation of Householder’s Method
@Amzoti I have not looked at the paper result. I verified it using Maple. Same matrix resulted from same input. Will try to look at the paper. May be the paper is using different definition or has a bug :)
2d
comment Mathematica Implementation of Householder’s Method
Sorry, but this is bad code :) zeroVector = {}; For[i = 1, i <= n, zeroVector = Append[zeroVector, {0}]; i++]; can be replaced by one Table[] command. I see you copied it from the paper/article. But papers are full of bad code as well. Looks like written by an ex-Fortran programmer.
2d
comment Getting messages Rest::norest and Divide::indet from ContourPlot3D
I Just added == 0 and no such error now. ContourPlot3D[Cos[2*Pi*z] + Cos[2*Pi*y] + Cos[2*Pi*x] == 0, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}] gives !Mathematica graphics
2d
comment Trouble combining planet orbits and positions in Graphics3D and Show
I keep getting $Aborted when running the code. V 9.01 on windows 7.!Mathematica graphics restarted kernel few times. did not make difference. May be it is internet issue reading the data from WRI server
2d
comment Evaluating an expression assuming a value for a variable only in the local context
compare x = 5; With[{q = x}, q = 1; q] with x = 5; Block[{q = x}, q = 1; q] in the first case, M gives error Set::setraw: Cannot assign to raw object 5. >> but not in the second case. This is because with With now q is constant 1, and can't be assigned to.
2d
comment Evaluating an expression assuming a value for a variable only in the local context
This has summary: stackoverflow.com/questions/6661393/… For me, I also think of With as making all the variables being withed as constants during the evaluation of the code inside With. So less chance of an error if you do not need to modify the withed variable, such as q in this case. Mathematica in this case, changes q to x in all the expressions inside With right away, then evaluates the expression. You can't do q=1 for example in this case, inside With later on, since q now is constant.
2d
comment Evaluating an expression assuming a value for a variable only in the local context
With[{q = x}, NIntegrate[x^2*q, {x, 0, 100}] ] works also
2d
comment Replace every Minus to Plus in Expression
Do you really mean every minus? So given this input expr = a - b + Sqrt[-x]; which can be complex depending on x, you want the output to become real (depending on x)? as in expr = a + b + Sqrt[x];
2d
comment Sum does not converge, but I think it should
You can also see this more clearly like this Sum[Boole[Not[IntegerQ[x]]], {x, 1, k}] which gives k. So let k to any value, say Infinity, and you see the problem. It is all due to evaluation of !IntegerQ[x] before the sum even starts. Since you are summing to Infinity, I am not sure how else M will handle this, as the function needs to be analytical for M to figure the sum.
2d
comment Sum does not converge, but I think it should
What seems to happen is that !IntegerQ[x] gets evaluated right away to True, this is before the sum takes hold. Hence the result becomes Boole[True] which is 1 and the whole sum becomes just Sum[1, {x, 1, Infinity}] which diverges. You can see this more clearly like this: !Mathematica graphics need to find a way to tell M to delay this evaluation.
Apr
13
comment How to calculate an expression to a specified number of significant digits
@cs2014 your question was about how to do the calculations using 4 significant digits. If all what you want is to display numbers with 3 digits after the decimal point, then simply use PrintPrecision. I'll update the answer with an example.
Apr
12
comment predator prey model with prey refuge
Are these V 10 plots? They look different from V9 screen shot: !Mathematica graphics The lines are thicker also.
Apr
12
comment In LineLegend, how do I force the legend entries to appear in a single column?
f[pairs_] := Grid[pairs]; LineLegend[colors, names, LegendLayout -> f, LabelStyle -> {20, FontFamily -> "Arial"}] gives !Mathematica graphics
Apr
12
comment Mathematica quits calculation automatically
@user3513537 no crash here with the new piece of code you posted. it works. Screen shot: !Mathematica graphics using V 9.01 on windows 7, 64 bit
Apr
12
comment I don't understand ListCorrelate!
can you try pasting the code again? It is has syntax errors. !Mathematica graphics
Apr
12
comment How can I modify my code so the result of my final calculation is acceptable to Simplify?
You have a typo. Change g_list to g_List and while you are at it, you might want to change things to start with lowerCaseLetter.