Daniel Dalton <daniel.dalton47 at gmail.com> writes:
> Hi all,
>
> I'm a final year high school student in Australia and have my final
> exams coming up in about 2 weeks. I use maxima since I'm blind and can't
> use the standard CAS calculator systems.
> I've got a couple of last minute problems that I was hoping to get some
> advice about.
>
> 1. I use the %solve command from package to_poly_solve. It works well
> providing me with the general solutions. However, my class mates can
> specify a domain where the solutions could be provided for and they get
> these listed.
> It seems a bit tedious with maxima as I have to set up the two general
> solutions as separate functions and sub the various integers in that
> domain, check all the solutions are in the domain and keep track of
> everything. Is there any possible way to automate this process somehow
> with lisp perhaps in the maxima-init.mac file? If anyone has any
> pointers where I can start that would be really helpful.
Hi Daniel,
Here is a solution using the solve command. Basically, what we need to
do is create a function that describe a domain for us, then use this to
winnow out the miscreant solutions.
/* indomain takes a list of predicates decribing the domain
and returns a function that checks those predicates */
indomain(d) ::= buildq([d:d], lambda([x],every(is,d)));
/* solve_in_domain is like solve, but we can pass a list of predicates
or a predicate function that describes the domain */
solve_in_domain(eq,var,d) := block([f,s,sols],
f:if listp(d) then apply(indomain,[d]) else d,
s:apply(solve,[eq,var]),
sols:[],
for t in s do (if f(rhs(t)) then sols:append([t],sols)),
sols);
/* Examples: */
solve_in_domain((x-2)*(x+1),x,[x<3,x>0]);
is(%=[x=2]);
solve_in_domain((x-2)*(x+1),x,lambda([x],is((x<0 and x>=-1) or (x<=3 and x>=0))));
is(%=[x=2,x=-1]);
If you want to use %solve, then you replace
s:apply(solve,[eq,var]),
with
s:flatten(args(apply(%solve,[eq,var]))),
in the above.
HTH,
Leo
>
> 2. I've had a problem with simplification. The function f(x)=log(x) has
> been defined.
> Then I must set up the equation:
> 2*f(u)=f(2*v)+f(3*v)
> Then solve in terms of u:
> solve(2*f(u)=f(2*v)+f(3*v),u);
> [u = %e^(log(3*v)/2+log(2*v)/2)]
> I ratsimp (%) this, but it remains the same.
> Shouldn't it simplify down to sqrt(6)v?
> If so is there any way to avoid future problems like this, or are there
> just particular cases to be aware of?
>
> 3. I have two integrals, which must equal 3 and 2 respectively. So I
> assign the integrated equation to f(x) in maxima and attempt to solve
> for the two integrals like this simultaneously:
> f(x):=7*log(x);
>
> (%o3) f(x):=7*log(x)
> (%i4) solve([f(m*n)-f(1)=3, f(m/n)-f(1)=2],[m,n]);
> (%o4) []
>
> How do I find the solution to this? (I need an exact value)
>
> Here is the question exactly:
>
> Find the exact value of m and n such that
> \int _1^{mn} (f(x)) dx = 3 and
> \int _1^{\frac{m}{n}} f(x) dx = 2
> f(x)= \frac{7}{x}
>
> 4. My last question! I have a function h(x) = sin(x/2)+tan(x/2)+2.
> I must solve h'(x)=0.
> So I differentiate with diff() and attempt to solve the resultant
> equation with %solve:
> %solve(sec(x/2)^2/2+cos(x/2)/2=0,x);
>
> Nonalgebraic argument given to 'to_poly'
> unable to solve
> (%o12) %solve([sec(x/2)^2/2+cos(x/2)/2 = 0],[x])
>
> It seems solve () works a bit better:
> solve(h(x)=0,x);
>
> solve: using arc-trig functions to get a solution.
> Some solutions will be lost.
> (%o13) [x = 2*%pi-2*acos(sqrt(3)*%i/2-1/2),x = 2*acos(sqrt(3)*%i/2+1/2),x
> = 2
> *%pi]
>
> But how can I then find the rest of the solutions? the domain is (-%pi,
> %pi) union (%pi, 3*%pi)
>
> If anyone can help with any of this stuff I would be very appreciative.
>
> Thank you very much.
>
> Daniel
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
--
Leo Butler <l_butler at users.sourceforge.net>
SDF Public Access UNIX System - http://sdf.lonestar.org