Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Derivative of regression line

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
02:53 AM

01-19-2020
02:53 AM

I have used a regression line to find a curve fitting my datapoints.

Now I want to know the lowest point on my curve and I am trying to find that by finding the point where the derivative of the regression line is 0.

So I made a formula g(a) using the results from the regress function (by refering to entries in the regress solution matrix). I can use this function correctly to plot the curve and to calculate results for different values of a.

However when I want to get the derivative it gives me a formula including the regress function. Solving the derivative for 0 is impossible.

To check if I use the correct functions I also made a formula h(a). Basically the same as g(a), but now I have manually typed the results from the regress function in the formula, instead of linking to the regress solution matrix.

Now I can get the derivative and solve for equal to 0.

However this is not convenient if my datapoints change, because I have to manually update h(a) each time.

Is what I want possible and how to solve this? In other words, what am I doing wrong?

Attached a mathcad 15 file with an example.

Thanks in advance for your replies.

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
06:56 AM

01-19-2020
06:56 AM

Incidentally, If all your polynomes are 3rd order and like the one given, the (positive) zero always occurs at

And instead of symbolically solving this, you could also use a numeric solver, which can happily work with the output of the interp function:

Success!

Luc

7 REPLIES 7

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
05:06 AM

01-19-2020
05:06 AM

Re: Derivative of regression line

Hi

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
06:40 AM

01-19-2020
06:40 AM

Re: Derivative of regression line

Try this

then:

Success!

Luc

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
06:52 AM

01-19-2020
06:52 AM

Re: Derivative of regression line

Mathcad has done the differentiation!

If you look at the error message it says the result is too big to display. However, you can still use the result.

Alan

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
06:56 AM

01-19-2020
06:56 AM

Incidentally, If all your polynomes are 3rd order and like the one given, the (positive) zero always occurs at

And instead of symbolically solving this, you could also use a numeric solver, which can happily work with the output of the interp function:

Success!

Luc

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
11:46 AM

01-19-2020
11:46 AM

Re: Derivative of regression line

Rather than "regress" you might try "polyfit." Polyfit returns a function so you don't have to extract the coefficients from a vector.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-19-2020
11:56 AM

01-19-2020
11:56 AM

Re: Derivative of regression line

Hello !,

you simply have to reset the symbolic variables

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-21-2020
02:30 AM

01-21-2020
02:30 AM

Re: Derivative of regression line

Thanks all for your replies.

My datasets are a result of a longwinding calculation, which I want to perform using tabulated input for multiple sets if input parameters. As I need to put all calculations into a program and repeat that program for all rows of the input tables, it is must useful if I can determine derivative=0 by simple formula. This is also easy because the output/result I want is the a value for all different inputs in a table to be able to calculate average a and so on.

As I am sure a is always between 0 and 1 (actually being 0 to 100%) I used the root function because it is the easiest solution for my problem.