# John D'Errico

### Retired

DON'T contact me. I won't answer questions. PERIOD. I don't do your homework. I won't do consulting. A retired mathematician, numerical analyst, woodworker, bridge player.

**Statistics**

RANK**10**

of 242,546

REPUTATION**16,131**

CONTRIBUTIONS

**8** Questions

**5,676** Answers

ANSWER ACCEPTANCE **
50.0%
**

VOTES RECEIVED**3,448**

RANK**4** of 16,998

REPUTATION**60,508**

AVERAGE RATING**4.80**

CONTRIBUTIONS**57** Files

DOWNLOADS **1174**

ALL TIME DOWNLOADS**544933**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Unique values for each sequence

Hint: What does diff give you? TRY IT! x = [1 1 1 1 2 2 1 1 1 3 3 3 2]; diff(x) What would happen if we tried find on that re...

4 hours ago | 1

Hi Guys.. I need to print X values from intlinprog output from all 24 iterations as a matrix, when am trying to assign the values to A matrix its not happening. PLz help

Of course, we cannot answer your question in more depth, since you have not provided your data. But if we look at the screenshot...

4 hours ago | 1

normpdf is taking zeros

No. At least, not in double precision. The "exact" value there is impossible to represent in a double precision number. The nor...

1 day ago | 0

| accepted

How to reduce computation time with 8 nested for loop

This is why there are optimization tools provided. Use them, instead of brute force search. But really, this is a combinatorial...

1 day ago | 0

How to put vector components into one single matrix and instead having them appear as two separate arrays

A very confusing question. But what about this does not do as you want? syms x y A = [2*x 1; 2 x*y] Admittedly, that is as sh...

1 day ago | 1

How to find the exact answer of an exponential equation?

syms t real Eqn = exp(-0.04*t)+exp(-0.12*t) - 1; Write it like that. I did so because now we can plot it. See that I specified...

2 days ago | 0

Increase arithmetic precision in using Cardano formula

Either use roots to solve for the roots of the quartic, or be forced to use symbolic form for the solutions. Note that roots wil...

3 days ago | 0

Chosing the step between lower bound and upper bound in genetic algorithm

Actually, this is simple. even trivial. Can you force a variable to take on integer valiues in GA? (yes) In the help for GA, I...

3 days ago | 0

how to find the root of function?

Or do this: alpha=0.74; g =0.5; gamma=1.2; sigma=1; phi=0.8; epsilon_1=1.5; w_r= (epsilon_1-1)/epsilon_1; syms n_h a ...

6 days ago | 0

Optimizing 1 equation with 7 variables

You do understand this is likely impossible to do? If there are ANY solutions which satisfy the given equality, then there are ...

6 days ago | 1

| accepted

Collatz Conjecture using for loop

Your code is close to a working algorithm. There are some issues truly good code would worry about. Could you ever have an over...

9 days ago | 2

| accepted

Hi everyone, i want to ask about curve fitting problem,

Invariably the data will vary by multiple orders of magnitude in such a problem. And that tends to imply the noise in your data ...

9 days ago | 1

Use a while loop to determine how many Fibonacci numbers are less than 100000.

What does your test do? That is... while x < 100000 Answer it tells when the INDEX of the Fibonacci number is less than 100000...

10 days ago | 0

I have a Matrix , and I want to multiply this Matrix with something so I can get zeros

Please stop posting answers when you are making only comments. In what you claim to have tried: A=[-3 6 -1 1 7;1 -2 2 3 -1;2 -...

10 days ago | 0

How to solve an equation system using a interp1-variable

interp1 is incompatible with symbolic parameters. You CANNOT use interp1 with solve. Period. So wherever you found that snippet ...

10 days ago | 0

| accepted

I have the following code to calculate d/dx sin(0.5)) using first derivative principle and compare it with the real value. Why does err starts increasing again?

What are you doing? You used a simple forward difference to compute the derivative, as an approximation to the derivative of sin...

11 days ago | 1

| accepted

The running time of binary integer linear programming and linear programming

Why is there something "wrong"? It is unexpected for you. But this just comes down to two different problems, solved by differen...

13 days ago | 0

| accepted

Matlab only calculates values for only certain inputs in a matrix.

Except that is not how to use a loop. You want to compute the inverse of each value in the array. function convof= inverseof(x)...

13 days ago | 0

| accepted

Am I understanding this correctly?

Yes. Colors that you would describe as red all have high values in the red channel, and small values in the green and blue chann...

13 days ago | 0

How to make constant to 1 in power function in curve fitting toolbox

Before you EVER make any fit to data, PLOT IT!!!!!!!! Plot your data. Then plot it in another way, until you have drained all th...

13 days ago | 0

fsolve doesn't find a solution when the value of the objective function is obtained through a Montecarlo simulation

Is your objective function a differentiable result of the parameters? If not, then fsolve cannot solve the problem. Fsol ve requ...

14 days ago | 0

How to create a vector of symbolic variables with specific labeling

The simple direct way seems easiest. v = sym('v',[1 29]); v = v([1 2 3 5 7 9 10 12 18 29])

14 days ago | 0

Unable to plot exponential graphs properly

What do you reasonably expect to happen? t varies over the interval -10 and 400. What is exp(-10)? If you don't know, then try ...

14 days ago | 0

| accepted

Plot graph of polynomials

That is not a polynomial. You have a sqrt root in there. And an absolute value. So learn how to use functions like abs, and sqr...

17 days ago | 1

| accepted

Can someone explain to me why I'm getting "Not enough input arguments" in line 2

For the simple reason that you named a function named size. Don't do this. Type this at the command line: which size -all If i...

18 days ago | 0

Solving a system of equations with arbitrary Parameter value

Look carefullly at what is returned. solution = solve(eqn_final, variable_final, "ReturnConditions", true); solution solution...

18 days ago | 0

| accepted

why PSI values are diffrent when nlmefit using ode45 solver compared to when it uses analytical solution?

There can sometimes be problems when you try to apply a nonlinear estimation scheme on top of an ODE solver. The nonlinear fitti...

19 days ago | 0

I don't know how to call my function

What language are you using here? Possibly not MATLAB. :) s = s + L*(i)^2; Do you think that squares the number i, and then mu...

19 days ago | 0

How efficient is it to use (end+1) to add a value to an array?

Increasing the size of an array incrementally is a TERRIBLE thing to do. WHY? Every time you add a new element to the end of t...

19 days ago | 1

How to use ~= operator as constraint function?

For which solver? This is a 1-variable problem. If you want help, it does help if you explain more than you have done. Note tha...

19 days ago | 1