Is there a way to solve this irrational equation in wxMaxima? - maxima

it seems that wxMaxima normally can't solve this simple irrational equation: 10=x-2*sqrt(x)
Here's my input and output:
(%i1) f1(x):= x-2*sqrt(x)$
(%i1) solve(f1(x)=10, x);
(%o1) x=2sqrt(x)+10
I've also tried other ways of solving this but with no luck. And I can't plot this function in Maxima as well.
It's possible to solve and plot it in Wolfram Alpha so maybe there is a way to do it in wxMaxima. Do you know such workaround?
In some very old mailing list archive I came across a hint to use:
part(fundef(f1),2)
and substitute the result back to the original expression but I'm not sure how to do it. Someone also shared a code that can be used to solve irrational equations in Maxima but ufortunately this code is not attached to his reply anymore.

Related

Z3 solver outputs CUT 2

I am working on a complex mapping problem. To get all Pareto-optimal solutions I used Pareto mod of Z3. Some wired things happened when I deleted some constraints which should be no effect on solutions, but the solutions were one less. When the last one should be found Z3 output "CUT 2" and didn't find the last solution.
So what means of "CUT 2"? Does it have anything to do with solution missing?

Calculate list of first derivative of function in Maxima for selected interval

I am facing a simple problem in Maxima: I want to calculate list of first derivatives of function / expression in various points. I know how to calculate list of "points" for normal expression:
float(makelist((x^2/sin(x-x/2),x,1,1000))
but when I run the expression through diff it changes expression to function and I don't know how to work with functions. I tried:
float(makelist(diff(x^2/sin(x-x/2)),x,1,1000))
which "zeroed" on me. Then I tried this:
float(makelist(''(diff(x^2)),x,1,1000))
which gives you right answer, but the result is not a number anymore. It's a list of something like:
[2.0 del(1.0), 4.0 del(2.0), 6.0 del(3.0), 8.0 del(4.0), ...
Would someone care to enlighten me about Maxima functions and numeric evaluation?
I know that this is a silly beginner's question, but I have never worked with Maxima before.
I think you want float(makelist(''(diff(x^2, x)),x,1,1000)) i.e. you need to write diff(expression, variable) instead of just diff(expression).

Does ctx-solver-simplify (and similar tactics) produce equivalent formulas, or just SAT-equivalent, or am I doing things completely wrong?

I'm trying to make z3 (I'm using z3py) to simplify some formulas for me (so that I can have more or less human-readable output). Using ctx-solver-simplify tactic seemed a good choice for me since in a couple of passes it would produce nice compact formulas. But soon I've run into a situation when the output of ctx-solver-simplify does not seem to be equivalent to the original formula (it looks more like being satisfiability-equivalent or so). Also, it might be the case that I'm not dealing with tactics correctly.
Here's what I was trying to do: http://rise4fun.com/Z3Py/g5sX. So, I construct a formula Set2 (everything before the definition of Set2 is just a setup needed to define it) which has a particular satisfying assignment. After applying ctx-solver-simplify, I get a single formula (as a goal) for which this assignment is not satisfying. So what am I dong wrong?
Am I wrong assuming that ctx-solver-simplify would produce an equivalent formula?
Am I handling the tactics and their output in the wrong way?
Anything else?
Thanks.
I have been looking into this, but have so far been unable to reproduce the bug directly
with our current branch. A bug in the context simplifier was fixed a little while ago, and it could
be manifesting itself with the online version of Z3.
There are still a few things I can do to double check if we can reproduce the bug
and I will update this post with what I find.

Maxima gives crazy answer for integrate(exp(x^2))

I'm trying to learn how to use Maxima. Something goes wrong with integrate :
(%i) integrate(exp(x^3),x,1,2);
(%o) (gamma_incomplete(1/3,-8)-gamma_incomplete(1/3,-1))/3
(%i) float(%);
(%o) .3333333333333333 (- 715.7985328824436 %i - 413.26647564521807)
(%i) expand(%);
(%o) - 238.59951096081454 %i - 137.75549188173935
What do you think?
Comparing Maxima's result to Wolfram Alpha, looks like Maxima has assumed that -x/((-x^3)^(1/3)) = 1. After debugging this for a bit, I can't tell if that term was originally in the result and it got simplified away, or if it was never there. With that term in place, and using the principal branch for the cube root, I get 275.510983 + (epsilon)*%i which agrees with a numerical result, namely quad_qags(exp(x^3), x, 1, 2) => 275.510983.
For the record, this integral is handled as "Type 1a" in maxima/src/sin.lisp, in the function INTEGRATE-EXP-SPECIAL.
Mathematically, I don't think there's anything fundamentally wrong with a complex answer to an exponential integration. In general, If you integrate e^(x^n) you're going to run into strange functions like the incomplete gamma function etc, because the answer isn't expressible in conventional functions, so has no conventional real analytic solution.
However, I think that there's definitely some inaccuracy here. Mathematica gives a different answer, much closer to a real answer, and as I ask for more accuracy, the real part appears to tend to zero, as you would expect.
If you want to numerically integrate (and it sounds like you do), you'll could use a different function. integrate is for analytical integration, which is why it gave you a formula rather than a number. Look up quad_qags and its friends for some really clever numerical integration functions.

Matplotlib mathtext does not understand basic delimiters with right/left

When using \left and \right in matplotlib with mathtext parsing, it doesn't recognize useful delimiters. In particular, brace and square bracket are errors:
ylabel(r'$\left\{ \frac{a}{b} \right\}$')
ylabel(r'$\left[ \frac{a}{b} \right]$')
In both cases I get something like
ParseFatalException: Expected a delimiter
$\left\{ \frac{a}{b} \right\}$ (at char 0), (line:1, col:1)
On the other hand \left{ (incorrectly leaving off the backslash) does actually work. I can't find any way to make the square bracket work, though.
I couldn't find any bug reports on this, but maybe I'm looking in the wrong place. Any ideas what's going on?
(matplotlib.__version__ = '1.1.0')
Just to be able to put this question to bed, this was just a bug, and will be fixed in a future release.

Resources