roman_pearce

Mr. Roman Pearce

1678 Reputation

19 Badges

19 years, 145 days
CECM/SFU
Research Associate
Abbotsford, British Columbia, Canada

I am a research associate at Simon Fraser University and a member of the Computer Algebra Group at the CECM.

MaplePrimes Activity


These are answers submitted by roman_pearce

f := 4*(x-1)^2+(y-2)^2 = 5; g := x^2+4*y^2 = 1; solve({f,g}, {x,y}); Or if you prefer a numerical result fsolve({f,g},{x,y}); By "turning point" I assume you mean a point where the derivative is zero. f := x*cos(x^2)/(1+x^2); df := diff(f,x); solve(df=0, x); # exact fsolve(df=0, x); # numeric
First note that sin/cos/tan/etc expect radians, so sin(90) and such is probably not what you intend it to be. Otherwise, RootOf is used to express solutions to equations when Maple is unable to express the solution in an elementary way. For example, the roots of x^5+x+3 can not be expressed using radicals, so solve(x^5+x+3) returns RootOfs. These RootOfs correspond to the real solutions, as you can see from the example below: f := x^5 + x + 3; S := [solve(f,x)]; evalf(S); By default solve will express polynomials of degree 3 or less in terms of radicals, but not polynomials of degree 4 (the result is usually a mess). You can use the allvalues command to get radicals when possible. f := x^4 - 2*x^3 + 2; S := [solve(f, x)]; allvalues(S); In your case, replacing 90 with Pi/2 and using solve still gives a RootOf, and using allvalues gives you a giant mess.
Use "Save as Classic Worksheet" to produce an .mws file. You should be able to open it in older versions of Maple.
Put the solutions in a list, ie: solutions := [fsolve(equation,t)]; and use nops(solutions); to compute the number of them.
PLOT(CURVES([[-2,-4],[1,3],[2,-2],[-2,-4]]));
eval(cos(x), x=Pi/8);
> Is there any built-in test/check in Maple to see if there exists > a solution to an equation without having to solve the equation? Generally no, but there are heuristic methods you can use for some types of problems. What are your equations ?
Solve f-g=0 using fsolve.
People in the company have said they're working on it. There is a thread in the Maple usenet newsgroup: http://groups.google.ca/group/comp.soft-sys.math.maple/browse_thread/thread/841e554baefcad11/7328a896eb0de8f6
This is not a homework help site, it is a Maple site. Ask your professor or your classmates.
Polynomials are not sorted so you may get 1/(-x+1), but if you really want it: makenice := proc(f) local a,b,s; a,b := numer(f),denom(f); s := sign(a); a,b := s*a, s*b; a/b end proc: f := -1/(x-1); makenice(f);
This is a very odd question. You can apply sin to each entry in the matrix using the map command, for example: map(sin, A); where A is a matrix. I hope that is what you meant.

Try making one that works with just polynomials first and not rational expressions. Also, it will help to make sure that everything is specified, ie: either an input to the procedure or a local variable.

replacecofs := proc(expr, vars, a::name, eqns::name)
local C, M, A, i; 
C, M := [coeffs(expr, vars, 'M')], [M]; # gives list of coeffs and list of monomials
A := [seq(a[i], i=1..nops(C))]; 
if nargs > 3 then 
  eqns := zip(`=`, A, C); # assign list of a[i]=C[i] to optional 4th argument
end if; 
add(A[i]*M[i], i=1..nops(C)); 
end: 
f := randpoly([x,y,z]); 
g := replacecofs(f, {x,y,z}, a, 'S'); 
subs(S, g); 
If you have objects with thousands of terms then faster things are possible.
The variables which came from your program are local variables which you have allowed to escape. This is typically not good for exactly the reasons you point out. You can do one the following: - Change your program to make 'c' and 'v' global variables. This has the downside that your program might not run correctly if you change 'c' and 'v' (for example, assign c := 2). - Make the variables 'c' and 'v' input to your program. This is better than using globals, but then you can't assign to them in your procedure. - Fix your program so it does not need to output names. This is usually the best option, because it tends to produce simpler programs which are easier to debug. If you have a long program, break it in to pieces where each piece performs a simple function. It takes a lot of practice, but it's really the only way to manage more complicated programs.
Norm computes the infinity norm (ie: max absolute value) by default. Norm(A,2) should give you the desired result.
First 14 15 16 17 18 19 Page 16 of 19