Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Solving equation problem 2

Status
Not open for further replies.

NosferatuWampir

Mechanical
Jan 11, 2010
7
Hi. I would like to calculate an equation with variables in range of values (in Given - Find block), but I have problem with that. Let me explain on example what I'm talking about. I write:

y=1..4 (range of values for variable y)
Given
x(y)=1 (initial guess)
x(y)=2*x(y)+1 (logical equation)
r(y)=Find(x(y))

When i type "r(y)=" Mathcad report a problem: "initial guess must consist of numbers and matrices". I don't know how exactly i should change the initial guess. Any idea ? Thanks for help.
 
Replies continue below

Recommended for you

Initial guess has to be outside the given/find block. Put it just above the given statement and it should work.

Steve
 
It doesn't matter where the initial guess is placed in, it can be above or in the Given - Find block, but I try that and it is still not working. But thanks for interesting :) Some new suggestions ?
 
Ah..your right. I have always be under the impression that guess values had to be outside the solve block.. Learned something new today.

Back to your problem though, could the issue be that your guess value is apparently a function x(y)=1.
 
Indeed, on mathematical point of view guess value of x shouldn't be a function of variable y, You're right. But when I write x=1, r(y) becomes red ("This variable is undefined"), so the problem is still unsolved. Steve, could You type this to mathcad and take a closer look ? Peter.
 
How do you evalute a function like that where its output depends on using the function as the input?
 
Read my last post. It was mistake, I changed that, so now initial value of x isn't a function of y. Program still doesn't work.
 
Your construct makes no sense; replace x(y) with blah

blah = 2*blah+1 blah = -1 always



TTFN

FAQ731-376
 
Sorry, mistake in rewriting from mathcad. The program is:

y=1..4 (range of values for variable y)
Given
x=1 (initial guess)
y(x)=2*x(y)+1 (logical equation)
r(y)=Find(x(y))

How about that ?
 
Damn, another error. Correct form:

y=1..4 (range of values for variable y)
Given
x=1 (initial guess)
y=2*x(y)+1 (logical equation)
r(y)=Find(x(y))

Somebody know what is wrong with this ?
 
> Initial guess MUST be outside of the given-find block
> You cannot place an undefined function on the right hand side of ANY definition or constraint
> In your specific example x(y) should simply be x
> However, our construct has a closed form solution of the apparent function inversion that you appear to be looking for, so a given-find is a rather tedious way of finding the answer, and will not give you the functional relationship, in any case:

x = (y-1)/2

This is the type of problem that you could the symbolic functionality of Mathcad, as opposed to the numerical functionality.

TTFN

FAQ731-376
 
OK, but the program that I typed is only the simplest example with what I have a problem. I'm solving more complicated engineering problem, with one variable, multiple equations and multiple unknowns, moreover it requires sequential iteration technique. The variable range of values is also larger. I'm trying to write the simlpest analogical programe that works, and rely on this I'll make a changes in the proper one. Essence is the same. I hope You understand me. Sorry for any possible syntax errors, I'm not an englishman.
 
That's probably not the form you want. You appear to be using x as both a function and a scalar, from a Mathcad perspective. Try


Given
y:=1 (initial guess - y)
x:=1 (initial guess - x)
y=2*x+1 (logical equation) (relation)
r(y)=Find(x)

then

y:=1..4 (range of values for variable y)
r(y)=
 
The problem doesn't make sense as stated. r(y) is known at four locations then the coefficients for a 3rd order polynomial can be found. The general form of the function r(y) still needs to be known.

What does x have to do with this?

Peter Nachtwey
Delta Computer Systems
 
I think excognito has it figured out. You could eliminate the guess values altogether and get a symbolic solution by typing [Ctrl][.] after the Find(x) to get the symbolic result

r(y) = y/2 - 1/2

See Quicksheets Solving Equations, Symbolic Solutions of Equations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor