dharr

Dr. David Harrington

8215 Reputation

22 Badges

20 years, 339 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@Alfred_F It's only difficult if you want Maple to do everything, which was my objective. Because a polygon with a symbolic number of sides wasn't possible, I had to do it at least partly by hand. I had to input only the fact that the angle subtended by a side at the centre is 2*Pi/n, which I decided was the most obvious fact.

Your solution requires inputting the formula for the interior angle, the cosine rule, and dividing by two to find the midpoint.

A problem with the geometry package is that you can't add new information as you go. For example, the first side-angle-side triangle (which essentially finds the cosine rule) is floating, without reference to any coordinates. So once I found the side length, I wanted to anchor that side at o=(0,0) and X=(r,0), but I had to make a new triangle by rotating point X.

At one point I was thinking of making an angle-side-angle triangle, but Maple doesn't have that. Another attempt involved rotating the line segment OX, but I couldn't then programmatically find the endpoints of the rotated segment. So in the end it is an ugly solution.

The geometry package can at least deal with objects that are not fully specified by coordinates, and it worked well for the tangent problem, where it found lengths and positions of altitudes, for which I don't remember the formulas. On the other hand the geom3d package requires everything fixed, so was useless for the cube problem. Both these packages are great when things are fixed, and I have found them very useful. But for simple problems I usually just apply formulas I know outside these packages.

I generally want Maple to help me with math I don't know, not just verifying things I could do on paper. Of course it is also useful for verifying, especially catching dropped signs.

Nice challenge. It seemed to me that it should be possible to set up the geometry that @vv used, with point P at symbolic coordinates [x,y,z] inside a cube, construct the pyramids with each face and P as apex, find their volumes and use isolve to find integer solutions.
But making a pyramid with a symbolic vertex and finding its volume seems to be impossible in Maple as far as I can see.

 

@salim-barzani see the p.s. in my answer above. Then you have an error, but you can choose a subset of the variables to solve for. If you have something like {a=3,srqt(...)=sqrt(...)}, you can remove it with remove(has,...,sqrt).

@salim-barzani I put colons at all places where the message occurred. I may also have put it on lines where the output was many pages long, and inconvenient to scroll through.

The notation doesn't make much sense. I can't think of any interpretation that would bring B12 outside the exp. If you understand that, please give a few more examples of expected output.

Emding with ":" will remove this message, and does for the cases in your worksheet. (I didn't wait for the last solve to complete.)

limit.mw

@acer I had a copy in my downloads folder that I have uploaded. (I didn't remove it.)

@FZ The one with the ic works if you remove the hint.

@studentX369 Sorry, you're right; I always use the startup code region and assumed the regular code edit regions can be expanded to work the same way. I use the startup region to define all my procedures, and it has the features I was listing. (I'm using 2024).

For programming, the startup region uses enter for a new line (with automatic indenting) and has other nice features for programming.

Edit: my earlier recollection that the regular code edit regions can work the same way is incorrect.

@paulmcquad To get a line segment you can use the line command in the plottools package. If you also want the endpoints, you can add pointplot commands for them. You are, however, moving away from the simplifying features of Student:-Precalculus, which means you will have to learn many of the other commands if you want things in a very specific way. For example if you want labels for the points you will need the textplot command.

How-to-plot-distance-midpoint.mw

@nilswe 

restart

Paste as 2-D

`&||` := proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, R)))) end procNULL

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, R)))) end proc

Doesn't work, even in 1-D

R1 &|| R2;
lprint(%);

R1*R2

R1*R2

Paste as 1-D

`&||`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

Works in 1-D

R1 &|| R2

1/(1/R1+1/R2)

Doesn't work in 2-D

"R1&||R2;"

Error, mismatched or missing bracket/operator

"R1&||R2;"

Solution 1 - rename to &p

`&p`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

`&p`(R1, R2)NULL

1/(1/R1+1/R2)

Solution 2 - if you want to use a symbol from the Operators palette, e.g., (ironically the not-parallel symbol, but some others will work)

`∦`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

`∦`(R1, R2)

1/(1/R1+1/R2)

`†`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

`†`(R1, R2)

1/(1/R1+1/R2)

NULL

Download resistor.mw

 

@salim-barzani My answer above is for the syntax error in your post above. There was no indication of any other questions you had. You separately posted about the xt problem, but that post is now gone, and @janhardo's answers are about that. @Kitonum gave an answer for that, that is more general and someone suggested algsubs.

Your problem in the replacing worksheet is that in eq6 you have x*t (as @janhardo pointed out), but in your eval you have xt=Y and not x*t=Y. But here if you are going to collect x and t and solve their coefficients you don't need this substitution at all. If you really want to substitute x*t here, you need to first substitute x^2 and t^2, then (now that there are no x^2 left) substitute x=Y/t and simplify (@Kitonum's solution IIRC). In general, eval (and subs) do not work well with expressions on the left-hand side (I managed to get away with it on your earlier examples). Algsubs only works for simple cases. In the general case where you want to do substitution in the arguments of trig function you may have more difficulty.

restart

L := ((2*k[1]*n[1]+2*k[2]*n[2])*(k[1]^2+k[2]^2)-(2*k[1]^2+2*k[2]^2)*(2*k[1]*n[1]+2*k[2]*n[2]))*x^2-(2*k[1]^2+2*k[2]^2)*(2*n[1]^2+2*n[2]^2)*x*t+((2*k[1]*n[1]+2*k[2]*n[2])*(n[1]^2+n[2]^2)-(2*k[1]*n[1]+2*k[2]*n[2])*(2*n[1]^2+2*n[2]^2))*t^2+(2*k[1]*n[1]+2*k[2]*n[2])*a[0]+3*(2*k[1]^2+2*k[2]^2)^2 = 0

((2*k[1]*n[1]+2*k[2]*n[2])*(k[1]^2+k[2]^2)-(2*k[1]^2+2*k[2]^2)*(2*k[1]*n[1]+2*k[2]*n[2]))*x^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*k[2]^2*n[1]^2-4*Y*k[2]^2*n[2]^2-2*Z*k[1]*n[1]^3-2*Z*k[1]*n[1]*n[2]^2-2*Z*k[2]*n[1]^2*n[2]-2*Z*k[2]*n[2]^3+12*k[1]^4+24*k[1]^2*k[2]^2+12*k[2]^4+2*a[0]*k[1]*n[1]+2*a[0]*k[2]*n[2] = 0

{X, Y, Z, a[0], k[1], k[2], n[1], n[2]}

 

NULL

Download replacing.mw

@salim-barzani Many commands, such as simplify, work with equations, but some do not (like coeffs here). For this reason, I usually do not have the =0 at the end of everything; then I don't get stuck like this.  Almost all Maple commands, such as solve, dsolve etc interpret an expression without =0 as though the =0 was present. Learn from this.

N-soliton1.mw

@salim-barzani Well, that is what the solve(identity,...) would have given for that set of equations and unknowns if it had worked, so it is the direct answer to your question. It also has nothing to do with the fact that there are two parameters x and t. If it doesn't work for you then you should reformulate the problem into the correct form first.

First 11 12 13 14 15 16 17 Last Page 13 of 85