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

FIND command with limited variable range

SOLVED
MaxGomes
1-Newbie

FIND command with limited variable range

Hello everyone,

I'm here again to ask for your kindly help!

I need to find a variable of an equation but this variable must be in a range.

For example:

x:=10..20

Given

2x²+3x=30

I mean, x must be between 10 and 20.

Is there anyway to do this?

Thank!!

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby IV
(To:MaxGomes)

Get rid of the symbolic evaluation of rebits_x (or at least change the 0 to something else, look at the error message) so you file will calculate without error.

That's why I was using the "given find" function, to figure the best answer.

And thats the point - which question?? Not in terms of your application but in terms of math expressions and functions. What is a constant value, what should be changed (and how), which quantitity is dependend on which changing variable (make it a function), what is the goal, the equation you want to be fulfilled at the end.

View solution in original post

15 REPLIES 15
Werner_E
24-Ruby IV
(To:MaxGomes)

You can add a constraint in the solve block like 10<x<20.

But "find()" will fail as both solutions of your equation are outside that region.

25.02.png

There is problem yet:

Take a look, I found passo_x.

Capture.PNG

________________________________

Then limited the range:

Capture.PNG

It doesn't accept, what is the right way to declare it?

Thanks!

Werner_E
24-Ruby IV
(To:MaxGomes)

Why not use the normal numeric evaluation instead of the symbolic one?

We just had a thread where again a constraint like yours made problems with symbolic evaluation.

I don't see from your pics how the various variables are derived, but the symbolics will nut simply take the saved values but will follow their definitions. Did tyou traced back the error?

Anyway, numerics should be good enough in that case, I think. If for some reason you need symbolics (from what I see I coudn't image why) you may try the symbolic "solve" in combination with the appropriate "assume".

Ok, I will try.

Werner_E
24-Ruby IV
(To:MaxGomes)

OK. But I don't see any reason why you would like to limit your result. With the equation you use, you get exactly 1 solution (if rebits_x is not equal to zero), so you don't have a couple of solutions to chose from. Why not simply calculate the solution and compare it to the range afterwards?

The reason is that I want to adjust the rebits_x to that range and vary the doubler_x, which depends on rebits_x.

But when I replace the doubler_x by its equation, it still doesn't work.

So, by now, I was trying to figure how is the correct way to define the range.

I've attached the file.

Thanks.

Werner_E
24-Ruby IV
(To:MaxGomes)

1) get rid of all symbolic evaluations and provide guess values for the variables you want to change

2) why do you solve for passo_x when in reality you want to solve for rebits_x AND doubler_x???

Ok.

I made a mistake, I meant I want to adjust passo_x to the range varying doubler_x. Sorry.

Werner_E
24-Ruby IV
(To:MaxGomes)

So it looks to me that you have to solve for doubler_x (which is the variable you have to vary) and not passo_x.

I am confused about your equations and not sure what the dependencies should be and if you are trying to setup some kind of iteration algorithm. For an iteration you would need to either write a program to do the job or formulate a set of functions (dependend on the variable(s) you want to change) to be able to use a solve block.

I looked at your sheet; there are some basic problems:

First, Werner is right. Mathcad is primarily a numeric solver. Where possible you should seek numeric solutions. (Stay away from the symbolic arrow sign evaluation.

Second, you begin by defining values of variable names: "borda_x := 9, d_reb :=3.2"

Great! So why is your next line "borda_x := borda_x -d_reb/2 ??

Why not just define borda_x := 7.4 to begin?

I believe you need to spend a bit more time reading about functions, and how Mathcad works.

Good luck!

Agreed. Same thing with (rebits_x.f - rebits_x). Why not replace it by -1?

If I interprete the calculations before the solve block as an attaempt ob the first step of an iteration, I come up with the attached. But that iteration jumps quickly over the desired range for passo_x and is in no way converging.

It happens because borda_x is an entry parameter.

d_reb is the diameter of a fastener.

I'm trying to automate fasteners distribution in a doubler.

Like this:

Capture.PNG

I know it doesn't make sense without knowing the intention.

I've corrected some mistakes, take a look at the attachment (there are changes to be done yet).

Depending on the case, when I try to figure out how much rebits (fasteners) fits the doubler at the full row, a bit of passo_x (step_x) rest.

For example, it fits 4,2 fasteners... 0,2*step_x (mm) of the doubler rests.

I can't distribute it at the step_x (space between the fasteners) because the doubler depends on it.

And the step_x repends on the fastener diamater (d_reb).

That's why I was using the "given find" function, to figure the best answer.

Thanks!

Werner_E
24-Ruby IV
(To:MaxGomes)

Get rid of the symbolic evaluation of rebits_x (or at least change the 0 to something else, look at the error message) so you file will calculate without error.

That's why I was using the "given find" function, to figure the best answer.

And thats the point - which question?? Not in terms of your application but in terms of math expressions and functions. What is a constant value, what should be changed (and how), which quantitity is dependend on which changing variable (make it a function), what is the goal, the equation you want to be fulfilled at the end.

View solution in original post

Maybe a place to start:

I would like to thank everyone for the help!

I could do what I was trying to.

Now, I just insert how many lines and columms of fasteners I want and the diameter of the dammage, and it calculates the step and how many fasteners can fit the cutout area, and afterwards, plot it.

Capture.PNG

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."