Let's discuss Mathematics

In general, a Jacobian matrix is defined for a function whose domain lies in n-dimensional real space and whose range is in m-dimensional real space. The Jacobian is an nxm matrix. For your function, m = n = 1, so the Jacobian is essentially the derivative, dy/dx.
 
In general, a Jacobian matrix is defined for a function whose domain lies in n-dimensional real space and whose range is in m-dimensional real space. The Jacobian is an nxm matrix. For your function, m = n = 1, so the Jacobian is essentially the derivative, dy/dx.

I apperitiate that I am asking for complicated help with my work, and I am sorry if this is coming across wrong somehow, so feel free to ignore.

I am trying to work out how to fit a curve to data, using the example here. They are fitting data to y = ax^2 + bx + c, as shown by:

Code:
values[i] = (variables[0] * x.get(i) + variables[1]) * x.get(i) + variables[2];

They calculate the jacobian with

Code:
            jacobian[i][0] = x.get(i) * x.get(i);
            jacobian[i][1] = x.get(i);
            jacobian[i][2] = 1.0;

This does not look slightly like a derivative, which would be dy/dx = 2ax + b?

BTW, I have managed to fit a roughly body weight shaped curve using root function y = ax^0.5 + bx + c but I would really like to figure out how to do others:
Code:
            values[i] = variables[0] * Math.pow(x.get(i), 0.5) + variables[1] * x.get(i) + variables[2];
...
            jacobian[i][0] = Math.pow(x.get(i), 0.5);
            jacobian[i][1] = x.get(i);
            jacobian[i][2] = 1.0;
 
OK, I see from your link that they are treating the parameters a, b and c of the quadratic y = ax2 + bx + c as the variables. So dy/da = x2, dy/db = x and dy/dc = 1. Note that in the section of your link labeled MultivariateMatrixFunction jacobian(), they reference the same Wikipedia article about the Jacobian that I did.

So, for y = loga(x) + b, the variables are a and b. We need to compute dy/da and dy/db. dy/db = 1 is easy. To compute dy/da, I used Wolfram|Alpha:

dy/da = -(ln(x)/a ln(ln(x))

where ln(x) is the natural log of x. You now can set up an array similar to the one in your linked article by taking appropriate values of x and plugging in the corresponding values of dy/da and dy/db. Hope this helps.
 
y = ln(x)/ln(a) + b

dy / da = ln(x) d( 1/ln(a)) /da = -ln(x) / (ln(a))^2 dln(a)/da = -ln(x)/ln(a)^2 * 1/a
 
OK, I see from your link that they are treating the parameters a, b and c of the quadratic y = ax2 + bx + c as the variables. So dy/da = x2, dy/db = x and dy/dc = 1. Note that in the section of your link labeled MultivariateMatrixFunction jacobian(), they reference the same Wikipedia article about the Jacobian that I did.
Yeah, I noticed that but I am afraid it lost me a bit.
So, for y = loga(x) + b, the variables are a and b. We need to compute dy/da and dy/db. dy/db = 1 is easy. To compute dy/da, I used Wolfram|Alpha:

dy/da = -(ln(x)/a ln(ln(x))

where ln(x) is the natural log of x. You now can set up an array similar to the one in your linked article by taking appropriate values of x and plugging in the corresponding values of dy/da and dy/db. Hope this helps.

Do you mean this link at Wolfram|Alpha?

I would read that as dy/da = -(ln(x)/a ln(ln(a)).

I have tried both those, and the curve fitting algorithm does not converge within 100 evaluations, which either means I have made a mistake or the curve does not match the data:
Code:
// dy/da = -(ln(x)/a ln(ln(a))
jacobian[i][0] = 0.0 - (Math.log(x.get(i)) / (variables[0] * Math.log(Math.log(variables[0]))));
// dy/da = -(ln(x)/a ln(ln(x))
jacobian[i][0] = 0.0 - (Math.log(x.get(i)) / (variables[0] * Math.log(Math.log(x.get(i)))));
...
values[i] = Math.log(x.get(i)) / Math.log(variables[0]) + variables[1];

I really appreciate the support, it really is helping me to understand what I am doing even if I cannot make it work exactly like I want.
 
log^2(x) = (log(x))^2, not log(log(x))
 
My mistake. dutchfire is correct that the derivative of loga(x) + b with respect to a is

-ln(x)/(a(ln(a))2)

That agrees with Samson's link to WolframAlpha.
 
I need to curve fit a large number of growth curves
@Samson: Would it be easier to do it in Excel using Solver? I don't know what your particular situation is but if you just have a bunch of data for y and x and want to fit it to y=loga(x)+b then I would definitely use Excel. But then, I use Excel for everything, so...
 
I thought I would give an update to this. Thanks to all the help I received here I got the y=a*ln(x) + b formula working. However I could not get others working (like y=a*x^0.5 +a) and I found R does this very easily, with lm(formula = y ~ log(x)) or lm(formula = y ~ sqrt(x)).

Thanks again.

Oh, and I cannot use excel because I need to do this on about 20,000 different sets of points, and if it works it shall have to run every few hours for the next few years.
 
Are the standard syntax programming languages really just one big mathematical formula? Think about it.
 
Are the standard syntax programming languages really just one big mathematical formula? Think about it.
Yeah, it all boils down to lambda calculus.

Being able to reason about programs as formula is useful for proofs of correctness, but for most programs that's not practical.
 
Are the standard syntax programming languages really just one big mathematical formula? Think about it.

Make perfect sense since the processor of a computer is really just a Boolean algebra engine.
 
Hi, i have a general question:

Anyone know where to look (some math site) for the issue of logarithms used in the context of (types of) a number series? (so as to compute, for example, what place a number will have in that series, if that number will exist in it at all, and so on).
 
Statistics question I've been thinking about...

Suppose you have a device that measures value with some error due to various factors. Say this error is ~1 unit. But suppose the device reports a value with a precision of a tenth of a unit.

Now according to my undergrad physics class, reporting that tenth of a unit is categorically wrong because it misleads us to believe we have higher precision, when in fact that last digit is meaningless.

But, I think that is wrong in at least this particular case I ran into. Suppose I'm comparing the values in two large samples, all I want to do is compare the sample means.

In this case will I get a more accurate sample mean by using the tenths (non-significant) digit?

I'm fairly sure the answer is yes, but I can feel my undergrad physics teacher glare at me and yell about significant figures every time I do.
 
I'd say you're right. Ideally, you know the distribution of the error and take that into account, but even if you don't know it I don't see why you'd want to increase the error of the measurements by rounding it to the nearest whole number before calculating the mean.
 
Well you can use as many digits as you want in calculations, but only report a result to the nearest significant figure. So if you have a device that is accurate to the nearest 1mm, but it gives readings to the nearest 0.1mm, then you can use the extra 0.1mm in your calculations behind the scenes, but give the overall mean to the nearest 1mm. I wouldn't throw away the extra digits, even though the manufacturer can only guarantee accuracy to 1mm. I mean your error should be stated as well alongside, so nobody will be in any doubt about how accurate your final number is.

I wouldn't consider the 0.1mm calculations to be "more accurate" than if you rounded to 1mm before doing the calculations. Unless you're literally measuring the same exact thing 100 times, neither answer is any more accurate than the other as your error margin is surely larger than the difference between them. I mean simply from the premise of the question, the difference between them is smaller than your ability to measure, so for all practical intents and purposes the two numbers are identical.
 
I hate to quickly change the subject, but I need someone to check to see if my work is right.

In Audacity, you can shorten a sound file to an appropriate length using percents. I have created a formula to help me find the percentage: ip=d; i being the initial length, p being the percentage, and d being the desired length. Is this formula correct?
 
Back
Top Bottom