Raybaudi Posted June 11, 2014 Share Posted June 11, 2014 Hi all I need to know if an algebraic equation is linear or fractional.( fractional equation: an equation containing the unknown in the denominator of one or more terms ) 3 * ( x - 1 ) + 5 = 0 // linear 3 / ( x - 1 ) + 5 = 0 // fractional How do you think to solve this problem with Filemaker? Link to comment Share on other sites More sharing options...
brian rich Posted June 11, 2014 Share Posted June 11, 2014 Assuming that the algebraic equation is being passed as text, you could write a custom function which would evaluate to TRUE if it were fractional, as follows: Fractional (myEquation) defined as Case(patterncount(myEquation;"/") > 0;True;False) However, I suspect the issue is more difficult than simply looking for the / character as the algebra gets more complicated? Brian Link to comment Share on other sites More sharing options...
Raybaudi Posted June 11, 2014 Author Share Posted June 11, 2014 Thanks, it seems simple but isn't. This one, for example, 1/2 + x = 0 contains the divisor symbol but isn't a fractional equation ( an equation containing the unknown in the denominator ) Link to comment Share on other sites More sharing options...
comment Posted June 11, 2014 Share Posted June 11, 2014 (edited) If there weren't any parentheses, then I would say that an equation is fractional if - and only if - it contains the pattern "/x". However, parsing an equation that may contain parentheses (esp. nested parentheses), using only Filemaker's text functions, is not something I would recommend. Note also: X^-1 Edited June 11, 2014 by comment Link to comment Share on other sites More sharing options...
jbante Posted June 11, 2014 Share Posted June 11, 2014 You could evaluate the equation for 3 values of x, calculate the line between the first 2 with two-point form, and check if the third point is on the same line. Then you'd just have to worry about avoiding values of x that might make the denominator zero — but if that does happen, you get a question mark for evaluating at that value, and you'd know that you have a fraction equation (or just a formula with a zero denominator). Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 You could evaluate the equation for 3 values of x, calculate the line between the first 2 with two-point form, and check if the third point is on the same line. This solution is really interesting! Recognizing if the equation is linear or fractional is in fact only a part of a bigger problem: finding the root (s) of an equation in one unknown with a planned custom function: Solve ( equation ) Link to comment Share on other sites More sharing options...
comment Posted June 12, 2014 Share Posted June 12, 2014 This solution is really interesting! I agree. However, the graph of: y = ( 3 * x ) / ( 2 * x ) could not be more linear - though it still meets your condition of containing the unknown in the denominator of one or more terms. Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 y = ( 3 * x ) / ( 2 * x ) this could be written: x = 3*a/2*a = 3/2 ( with a ≠ 0 ) the unknown ( x ) isn't in the denominator of any terms. Link to comment Share on other sites More sharing options...
comment Posted June 12, 2014 Share Posted June 12, 2014 Yes, it could be written that way - but it wasn't. I think you need to define some constraints on the input, otherwise this is just too wide. Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 Yes, the constraint on the input must be: whichever equation in one unknown ( x ) so that the CF will solve for x Link to comment Share on other sites More sharing options...
comment Posted June 12, 2014 Share Posted June 12, 2014 I am afraid we're not talking about the same thing. y = ( 3 * x + a ) / ( 2 * x - a ) is non-linear for all values of a, except a=0. If it's legitimate to write: y = ( 3 * x + 4 ) / ( 2 * x - 4 ) then: y = ( 3 * x + 0 ) / ( 2 * x - 0 ) is also a legitimate input. Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 May be I didn't explain well myself or I do not remember well my algebraic studies. y = ax + b isn't an equation in one unknown but a function of x: f(x) = ax + b where there is a result for each value of the unknown. The user must enter the equation in the format: ax + b = 0 or ax = - b or x = -b/a Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 An example: Solve ( "6000/(1+x)^(61/360)+7000/(1+x)^(103/360)=12702.2" ) result: x ≈ 0.105 Link to comment Share on other sites More sharing options...
comment Posted June 12, 2014 Share Posted June 12, 2014 I was referring to Jeremy's suggestion to calculate 3 different points for 3 values of x. You cannot calculate 3 different points using an equation. You must use a function f(x) to calculate 3 y results for 3 values of x. Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 Ah, ok. Now I understand you. BTW I'll post my "work in progress" custom function that use a "brute force" algorithm to search the root. Link to comment Share on other sites More sharing options...
jbante Posted June 12, 2014 Share Posted June 12, 2014 This solution is really interesting! Recognizing if the equation is linear or fractional is in fact only a part of a bigger problem: finding the root (s) of an equation in one unknown with a planned custom function: Solve ( equation ) If root finding is your goal, there are plenty of techniques for that that don't require knowing if the function is linear or "fractional." Link to comment Share on other sites More sharing options...
Raybaudi Posted June 12, 2014 Author Share Posted June 12, 2014 Great link. My algorithm is nearly the same as: Bisection method. But sometimes ( with fractional equation ) it fails to find two values with different signs. Don't you want to try to create that CF ? Link to comment Share on other sites More sharing options...
jbante Posted June 12, 2014 Share Posted June 12, 2014 I did a few years ago just for kicks, but I never had an application for it, so it's relegated to the dustbin. I used a combination of bisection, secant, and false position methods. Link to comment Share on other sites More sharing options...
Raybaudi Posted June 13, 2014 Author Share Posted June 13, 2014 Are you not going to publish it on Brian's site? Link to comment Share on other sites More sharing options...
jbante Posted June 15, 2014 Share Posted June 15, 2014 Are you not going to publish it on Brian's site? If I come across an application where I need it, I'm sure I'll refactor it to suit my current tastes and post it somewhere. That isn't right now. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 3596 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now