JK829055@pucal.bitnet (Jim Karczewski, Programmer -- TTR Development, Inc.) (12/24/90)
If anyone has any code in c that will give you a solution to a Problem like the following PLEASE Mail it to Me!!! 3(8*3(cos(4)*7-9)/43+3)+32) I have some I was working on, But I have not had time to figure out what was wrong with it... Thanks! Jim Karczewski InterNet: JK829055@PUCAL.BITNET BITNET: JK829055@PUCAL
lphillips@lpami.wimsey.bc.ca (Larry Phillips) (12/24/90)
In <39919@nigel.ee.udel.edu>, JK829055@pucal.bitnet (Jim Karczewski, Programmer -- TTR Development, Inc.) writes: > If anyone has any code in c that will give you a solution to a >Problem like the following PLEASE Mail it to Me!!! > > 3(8*3(cos(4)*7-9)/43+3)+32) > > I have some I was working on, But I have not had time to figure out >what was wrong with it... Thanks! Assuming you have the parentheses right, the code would read something like: x = 3(8*3(cos(4)*7-9)/43+3)+32); What sort of problem were you having with it? ----------------------- While I'm here, to all net.folks: Have a happy winter solstice celebration, and be careful out there. -larry -- The best way to accelerate an MsDos machine is at 32 ft/sec/sec. +-----------------------------------------------------------------------+ | // Larry Phillips | | \X/ lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips | | COMPUSERVE: 76703,4322 -or- 76703.4322@compuserve.com | +-----------------------------------------------------------------------+
thad@cup.portal.com (Thad P Floryan) (12/24/90)
JK829055@pucal.bitnet (Jim Karczewski, Programmer -- TTR Development, Inc.) in <39919@nigel.ee.udel.edu> writes: If anyone has any code in c that will give you a solution to a Problem like the following PLEASE Mail it to Me!!! 3(8*3(cos(4)*7-9)/43+3)+32) I have some I was working on, But I have not had time to figure out what was wrong with it... Thanks! Sheesh. If ANYONE has "C" code to solve that, their compiler is broken! :-) Let's look at your formula more closely: 3(8*3(cos(4)*7-9)/43+3)+32) ^ ^ ^ ^ ^ ^ ^ | | | | | | | | | | +----+-----+---+--- 4 ")" | | | +---+---+---------------------3 "(" Do you wanna try it again? And don't forget "extern double cos();" and to either declare or typecast your variables (and constants) as "double". Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]
hb136@leah.albany.edu (Herb Brown) (12/24/90)
In article <39919@nigel.ee.udel.edu> "Jim Karczewski, Programmer -- TTR Development, Inc." <JK829055@pucal.bitnet> writes: > > If anyone has any code in c that will give you a solution to a >Problem like the following PLEASE Mail it to Me!!! > > 3(8*3(cos(4)*7-9)/43+3)+32) > > I have some I was working on, But I have not had time to figure out >what was wrong with it... Thanks! > > Jim Karczewski > >InterNet: JK829055@PUCAL.BITNET > BITNET: JK829055@PUCAL I am able to count four right parenthesis and only three left parenthesis. That means 'something is wrong in Denmark!' This would make a nice entry for comp.puzzles (??) My choice is to add a fourth left parenthesis before the second four (counting from the left); on the other hand, perhaps a second left parenthesis before the seven might be a better choice; or, ........... I knew this was going to be difficult! Herb -- ---------------------------------------------------------------------------- Herb Brown Math Dept The Univ at Albany Albany, NY 12222 (518) 442-4640 hibrown@leah.albany.edu or hibrown@cs.albany.edu or hb136@ALBNYVMS.BITNET ----------------------------------------------------------------------------
pm0@springs.cis.ufl.edu (Patrick Martin) (12/25/90)
In article <39919@nigel.ee.udel.edu> JK829055@pucal.bitnet (Jim Karczewski, Programmer -- TTR Development, Inc.) writes: > > If anyone has any code in c that will give you a solution to a >Problem like the following PLEASE Mail it to Me!!! > > 3(8*3(cos(4)*7-9)/43+3)+32) > > I have some I was working on, But I have not had time to figure out >what was wrong with it... Thanks! > Why not just take the Taylor's Series of the Cosine function then do the rest of the function as you normally would? Maybe I don't understand your problem fully but if you are getting bad results from the trigonometric functions in the C library then just use a Taylor's series to approximate the Cosine function. cos(x) ~ 1 - (x^2/2!) + (x^5/5!) - (x^7/7!) + ... Hope that's what you were looking for... Pat
rg20+@andrew.cmu.edu (Rick Francis Golembiewski) (12/25/90)
> If anyone has any code in c that will give you a solution to a >Problem like the following PLEASE Mail it to Me!!! > 3(8*3(cos(4)*7-9)/43+3)+32) I assume you want code that will take a string with the above equation and parse it out to a numerical answer? If so I have some code that will do it, but be warned it is UGLY, but it does work (at least the last time I compiled it [a year or so ago]). Let me know if you haven't found anything and still need it... // Rick Golembiewski rg20+@andrew.cmu.edu \\ \\ #include stddisclaimer.h // \\ "I never respected a man who could spell" // \\ -M. Twain //
jep@mtiame.mtia.oz (Jesper Peterson) (12/27/90)
In article <39919@nigel.ee.udel.edu> JK829055@pucal.bitnet (Jim Karczewski, Programmer -- TTR Development, Inc.) writes: | If anyone has any code in c that will give you a solution to a |Problem like the following PLEASE Mail it to Me!!! | | 3(8*3(cos(4)*7-9)/43+3)+32) | | I have some I was working on, But I have not had time to figure out |what was wrong with it... Thanks! Do you mean an interactive calulator utility like "bc" or "dc"? I'm not aware of any PD ones for the Amiga (perhaps someone could rev up Aquarium?) However, the "hoc" utility described in the book "The Unix Programming Environment" by Kernighan & Pike (Prentice-Hall 1984) should suit. The source listing is in the book. It requires a "yacc" ("bison" will do) but is other- wise very portable. To the people going on about the unbalanced parens: lighten up! Jesper. -- ------------------------------------------------------------------------------ USEnet: jep@mtiame.mtia.oz.au UUCP: ...!uunet!munnari!mtiame.oz!jep [...] I had to leave out reality to keep the post clean and to the point. - jeremy@milton.u.washington.edu (Jeremy York) in rec.music.misc