Two problems

• Subject: Two problems
• From: Dallas_Burtraw at um.cc.umich.edu
• Date: Wed, 21 Jun 89 00:35:34 -0500
• Apparently-to: mathgroup-out at yoda.ncsa.uiuc.edu

```Greetings.  I am in the Economics Dept at Michigan and have been using
Mathematica for a little while.  Two questions have surfaced that we
have not been able to resolve.  Can you help?
First, I want to attach a penalty in a function within a program, so
for example, I always want x > xo. The number x is a real.  I want to write
((x - xo)^2)^(.5) - (x - xo) which is 0 for x nonnegative and greater than
0 for x negative.  The problem is Mathematica automatically simplifies this
algebra.  Is there a way to prevent that?
The second, more substantial question is the reason the first came up.
It seems Mathematica can not use its problem solving techniques, either
Solve or FindRoot, over conditional statements.  For example,
f(x) = x if ....
f(x) = x^2 otherwise.
Writing such a conditional with If or Which, then FindRoot can not
solve because it can not compute the derivatives.  Is there a way around
this other than calculating maximization conditions separately and then
rewriting a new conditional?  It seems like an easy fix within the
program if it truly is a bug.
The real issue on this second question is the construction of a constrained
maximization or Lagrangian problem.  It seems clumsy, but I have had to
solve each f(x) = x, etc. and then test the "if" statement.  This wastes
time and I lose any numerical value for the Lagrangian weight on the
constraint.  Do you have suggestions?

Regards, Dallas Burtraw
Dallas_Burtraw at um.cc.umich.edu

```

• Prev by Date: Re: Mathematica Problem
• Next by Date: Quaternions in Mathematica?
• Previous by thread: Re: Mathematica Problem
• Next by thread: Two problems