Rev 539 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 539 | bpr | 1 | !goto $wims_read_parm |
| 2 | |||
| 3 | :def |
||
| 4 | title=Parametric to implicit surface |
||
| 5 | synonyme=implicite equation 3d, 3d implicite equation, parametric to implicit 3D, implicit equation of a space surface |
||
| 6 | input=list |
||
| 7 | !exit |
||
| 8 | |||
| 9 | :proc |
||
| 10 | wims_rawmath_variables=u,v |
||
| 11 | formula=!nonempty item $formula |
||
| 12 | formula=!rawmath $formula |
||
| 13 | cnt=!itemcnt $formula |
||
| 14 | !if $cnt!=3 |
||
| 15 | error=bad_formula |
||
| 16 | !exit |
||
| 17 | !endif |
||
| 18 | v1=!varlist nofn $formula |
||
| 19 | v2=!varlist $formula |
||
| 20 | n1=!itemcnt $v1 |
||
| 21 | n2=!itemcnt $v2 |
||
| 22 | !if $n2>$n1 or . isin $formula |
||
| 23 | result=not_polynomial |
||
| 24 | !exit |
||
| 25 | !endif |
||
| 26 | !if $n1<1 |
||
| 27 | result=no_parameter |
||
| 28 | !exit |
||
| 29 | !endif |
||
| 30 | v1=!sort nocase items $v1 |
||
| 31 | w1=!item 1 of $v1 |
||
| 32 | w2=!item 2 of $v1 |
||
| 33 | fml=$formula |
||
| 34 | |||
| 35 | !distribute items $fml into fx,fy,fz |
||
| 36 | !distribute items $formula into Fx,Fy,Fz |
||
| 37 | m2_header=implicit3d = (f1,f2,f3) -> (\ |
||
| 38 | -- f1 and f2 should be polynomials over QQ in a variable\ |
||
| 39 | -- t. A string representation of the polynomial\ |
||
| 40 | -- F(x,y) is returned, where F(f1,f2) = 0.\ |
||
| 41 | R = QQ[$w1,$w2,x,y,z,h,MonomialSize=>16,MonomialOrder=>Eliminate 2];\ |
||
| 42 | f = value f1;\ |
||
| 43 | g = value f2;\ |
||
| 44 | k = value f3;\ |
||
| 45 | J = ideal(x-f,y-g,z-k);\ |
||
| 46 | Jh = homogenize(J,h);\ |
||
| 47 | M = selectInSubring(1,gens gb Jh);\ |
||
| 48 | toString substitute(M_(0,0), {h=>1})) |
||
| 49 | |||
| 50 | result=!exec m2 implicit3d("$fx","$fy","$fz") |
||
| 51 | result=!translate # to $\ |
||
| 52 | $ in $result |
||
| 3898 | bpr | 53 | |
| 539 | bpr | 54 | # Here I just discard the first two words of the result |
| 55 | result=!word 3 to -1 of $result |
||
| 56 | !exit |
||
| 57 | |||
| 58 | :output |
||
| 59 | |||
| 60 | !if $result=not_polynomial |
||
| 61 | Sorry, we can only compute equations when the parametric functions are |
||
| 62 | polynomials of rational coefficients. |
||
| 63 | !exit |
||
| 64 | !endif |
||
| 65 | !if $result=no_parameter |
||
| 66 | Sorry, but are you sure that you have entered two polynomials of parameter |
||
| 67 | t as the parametric coordinate functions? |
||
| 68 | !exit |
||
| 69 | !endif |
||
| 70 | |||
| 71 | The space surface defined by the parametric equations |
||
| 72 | <p><center> |
||
| 73 | !htmlmath x = $Fx , y = $Fy , z = $Fz |
||
| 74 | <p></center> |
||
| 75 | satisfies the implicit equation |
||
| 76 | <p><center> |
||
| 77 | !insmath $result = 0 . |
||
| 78 | </center> <p> |
||
| 79 | <small>Computation done by Macaulay 2</small> |
||
| 80 | |||
| 81 | !exit |
||
| 82 |