cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Problem with root function

M_U
9-Granite
9-Granite

Problem with root function

Hi, 

I'm starting in mathcad and can´t solve a simple problem. I have a function 

f(x) = 6.08 - 5.11*x + 1.04*X^2 and I have a matrix with many values of f(x). I would like to create a matrix whose rows are root of equation f(x). I will attached the matrix of f(x).

 

Thank you

 

 

8 REPLIES 8
rgunwaldsen
14-Alexandrite
(To:M_U)

Not sure what you are asking. f(x) is a quadratic so has exactly 2 roots. What is you table?

Hi,

I'm just guessing ... that 7_mathcad.TXT file contains f(x) values in its second column and OP wants to get x values related to them.


Martin Hanák

Why don't you post a Mathcad sheet!!!???

If Martins brave guess is correct, the attached could be a solution

Werner_E_0-1576140860581.png

 

M_U
9-Granite
9-Granite
(To:Werner_E)

Thank you rgunwaldsen and MartinHanak for the answers. My explanation was not clear but Werner_E

solve the problem. Werner_E , I didn't post a sheet because I try only for one value of f(x). I have a dought in your worksheet, I didn't understand the variable D.And I have other question, I have many datas to do the same thing, is it possibe to do a function for to this? In other words, the final result is a matrix that each row is a matrix table (of your worksheet)? 

Werner_E
24-Ruby V
(To:M_U)

D is only the formal argument of my functions g1 and g2. You can name it anything you like (on both sides of the definitions, of course). You can see D as one of the values in your data list - the ordinate value you would like to know the two abscissa values for. Each function returns one solution of the equation f(x)=D or f(x)-D=0. g1 returns a value to the right of the vertex of the parabola and g2 the solution to the left. In german vertex is "Scheitel", thats the reason I had chose S for the abscissa value of the vertex.

It was necessary to define those functions as its not possible to vectorize the root command itself.

 

What you demand for multiple data sets should be easy to achieve - as a first step you could turn "table" into a function by simply writing table(Data):=...

The you could call that function with any data you like table(Data2)=..., etc.

Its assumed that in each dataset only the second column contains relevant data.

 

How to construct the wished for vector of tables depends on how your various data sets would be defined, how they would be represented in Mathcad.

Furthermore, if f(x) changes for every data set, some minor modification had to be done, too.

As an afterthought:

Here is another approach using a numerical solve block:

Werner_E_0-1576157516064.png

 

And if your function always is a simple quadratic, its of course easy to solve it symbolically. So the most natural approach could be:

Werner_E_1-1576157682043.png

Explicit vectorization is not necessary in this approach, but its not a bad idea to apply it explicitly here, too, for clarity.

 

And here is a variant of the last approach which avoids calling g twice for each row:

Werner_E_0-1576165151582.png

 

ValeryOchkov
24-Ruby IV
(To:M_U)

May be so

A.png

Top Tags