Reputation: 468
I am trying to optimize expressions symbolically. I need to find out the maximum value possible for a variable(s), so that the expression still have a valid solution.
For Example:
expr := (a-b)/b-(a^3) # a=(0,10), b= (0,10)
In this eypression b=a^3 is the only case where undefined solution is possible. for a given interval of variables
This looks fine for simple expression. But in reality there are complex equations to solve with more than 2 varibles.
1) First thing is to find out all values of a variable resulting in undefined output
2) assign a symbolic value to the variable so that the undefined result can be eliminated.
I need to optimize the given expression so that it does not have any undefined cases when solving. I understood that when optimizing there always be a condition on variables(in this case variable max is the condition, maximum value the variable can take). output of an expression is always a real value
OptimizedExpr:=a-b[max]/b[max]-a[3] --> b[max]>a^3 or b[max]<a^3
(it is easy to to say b[max] <> to a^3 and a^3 is the limiting value. in some case it is more reasonable to just ignore other part of limiting value. Hence, I would like to solve for greater than or less than of limiting value)
I would be very glad, how can I find Optimized expressions. I tried using the solve function but observed that expressions are equalled to zero and solving. which is completely opposite to what I was looking. I really do not know is there any way to find out undefined cases in expressions and on what varibale at which value.
I tried to explain the situation at my best and I welcome for any suggested edits or furthur information required.
Upvotes: 2
Views: 90
Reputation: 7271
You wrote, "b=a^3 is the only case where undefined solution is possible."
Hence it looks like you made a typo with your brackets, and intended the expression to instead be,
expr := (a-b)/(b-a^3);
The discont
command handles that example.
discont(expr, b);
/ 3\
{ a }
\ /
If you have more involved expressions then please show them (and constraints on other parameters such as a
would not hurt to know, if you have such).
It's difficult to answer properly if you don't show your actual example, explicitly and in full.
[edit] Ok, you posted a more involved example elsewhere. You can use the discont
or the singular
commands.
expr2 := tan(a*(b+log(1+(epsilon*a*r)/(c*s)))/2):
ans := [singular(expr2, {c, b})]:
ans := map[2](remove,u->lhs(u)=rhs(u), ans):
lprint(%);
[{c = 0}, {c = -epsilon*a*r/s},
{b = - (-2*_Z1*Pi+a*ln((a*epsilon*r+c*s)/(c*s))-Pi)/a}]
eval(expr2, ans[1]);
Error, numeric exception: division by zero
eval(expr2, ans[2]);
Error, (in ln) numeric exception: division by zero
eval(expr2, ans[3]):
simplify(%);
Error, (in tan) numeric exception: division by zero
ans1 := map[2](`=`,c,discont(expr2, c)):
lprint(%);
{c = 0, c = epsilon*a*r/(s*(exp((2*Pi*_Z2-a*b+Pi)/a)-1)),
c = -epsilon*a*r/s}
ans2 := map[2](`=`,b,discont(expr2, b)):
lprint(%);
{b = -(a*ln((a*epsilon*r+c*s)/(c*s))-2*Pi*_Z3-Pi)/a}
eval(expr2, ans1[1]);
Error, numeric exception: division by zero
eval(expr2, ans1[2]):
simplify(%) assuming real:
Error, (in assuming) when calling 'cot'. Received: 'numeric exception: division by zero'
eval(expr2, ans1[3]);
Error, (in ln) numeric exception: division by zero
eval(expr2, ans2[1]):
simplify(%) assuming real;
Error, (in assuming) when calling 'cot'. Received: 'numeric exception: division by zero'
Upvotes: 1