## 1555 Reputation

19 years, 226 days

## Lookup ?LeastSquares...

in Student[LinearAlgebra] package or the LinearAlgebra package.

You must convert every datapoint [x,y,f1(x,y),f2(x,y)] into the pair of equations. Compute the union of all these equations and submit to LeastSquares with {a1, a2, a3, a4, a5, b1, b2, b3} as second parameter.

Perhaps your variables a, x were already assigned(?). If not then you can always try with typematch:

 typematch(Heaviside(x),'Heaviside(a::algebraic)');

## You should segment this curve to avoid d...

 epsilon:=0.01;display(seq(spacecurve([cot(phi)/sin(phi), 1.61, phi], phi = r, numpoints = 3000, axes = normal, coords = spherical, color = red, axes = boxed),r=(-Pi+epsilon .. -epsilon,epsilon..Pi-epsilon)));

## Would this be sufficient...

 simplify([f0,f1,f2],{a*b},[a,b]);#simplify(simplify([f0,f1,f2],{a^2-q1,b^2-q2,a*b},[a,b,q1,q2]),{a^2-q1,b^2-q2,a*b},[q2,q1,b,a]);#subs(q1=a^2,q2=b^2,map(limit,simplify([f0,f1,f2],{a^2-q1,b^2-q2,a*b-r},[a,b,q1,q2,r]),r=0));

for rational expressions?
Thumb it if you like.

## Examples....

This is not precisely the answer you seek, but these two examples might interest you:

Edited per Carl Love's pointer:

 x||(1..4)||y||(1..4);``||(a,b,c,d)||(1..4);#old syntax#x.(1..4).y.(1..4);#``.(a,b,c,d).(1..4);

## Option: power....

The following is excessive, but it does achieve the goal:

 e:= g^((2*(-sigma+k+1))/(-1+sigma))-tau^2;`@`(factor, x -> combine(x, power), factor, expand)(e);

## Coefficients of elements typed function....

This appears to be a frequent question. This is a link to my previous response:
http://www.mapleprimes.com/questions/207267-Coefficients-Of-Differential-Polynomial#comment223370

 function_coeffs := proc(A, v::set(name))local S, T;   S := indets(A, {function});   S := select(has, S, v);   T := {Non(map(identical, S))};   frontend(proc(A, S) local V; [coeffs](collect(A, S, distributed), S, 'V'), [V] end proc, [A, S union v], [T, {}])end proc;fec:=(A,f,t)->frontend(function_coeffs,[A,f],[{Non(t)},{}]);A:=diff(g(z),x)*g(z)^3+diff(g(z),z,z)*g(z)^4+diff(g(z),z,z,z)*g(z)^5+diff(g(z),z)/g(z)^2;function_coeffs(A,{g});fec(A,{g},specfunc(anything,diff));

## Substitution....

Try this substitution. Does it produce a different outcome?

 restart;assume(U,complex,V,complex,x,complex);S := {b = U*(1+V^2)/V, a = U*(V-1)*(V+1)/V};A:=diff(y(x),x)=a*cos(y(x))+b;B:=subs(S,A);dsolve(B,y(x));

Radical and multivariable algebraic statements are opportune to cause obstruction, so perhaps you should prepare your constants.

## Some choices....

I have aligned the grid with t and t+x. Perhaps this configuration is to your liking:

## -1/32*(-1)^(1/8)*2^(1/4)*(2*(-1)^(1/4)-3...

Considering this is a residue of a rational polynomial with coefficients in Q, at a singular point.

Edited:
corrected use of roots
replaced evala@residue with evala@coeff@series

 C0 := rationalize(expand(2^(1/4)*exp(3/8*I*Pi)));P := z^2 / (z^4 + 2*z^2 + 2)^2;Pf := numer(P) / (evala@AFactor)(denom(P),z);Pfs := select(`@`(evalb, 0 = evalc, evala, Norm, `+`), map2(op, 1, (roots@denom)(Pf)), -C0);   QRatpolyResidue := proc(Pf, z, Pfs, C0)local ANS, R, X, Y, Z, W, Wn, A, k, d, i;    _EnvExplicit := false;    A := NULL;    for R in Pfs do        #ANS := evala(residue(Pf, z = R));        ANS := evala(coeff(series(Pf, z = R, 1 + degree(numer(Pf), z) + degree(denom(Pf), z)), z - R, -1));         #print(R, Residue, ANS);        X := R - k;        Y := X;        W := NULL;        Wn := NULL;        while hastype(Y, RootOf) do                        Z := `evala/toprof`(Y);            d := frontend(degree, [op(1, Z), _Z], [{Non}(function), {}]);            W := W, seq((evala@Expand)(Y*Z^i), i = 0 .. d - 1);            Wn := Wn, Z;            Y := (evala@Norm)(Y, {Z}, indets(Y, RootOf) minus {Z})        end do;        ANS := frontend(factor@simplify, [ANS, [W], [Wn, k]],            [({Non}@map)(identical, {Wn}), {}]);        A := A, map(evalc@rationalize, subs(k = C0, ANS))    end do;    Aend proc:   ANS := {QRatpolyResidue}(Pf, z, Pfs, C0);ANS2 := {QRatpolyResidue}(Pf, z, Pfs, k), k = C0;

returns:

C0 := 2^(1/4)*(-1)^(3/8)
P := z^2/(z^4+2*z^2+2)^2
Pf := z^2/(z+RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2))^2/(RootOf(_Z^4+2*_Z^2+2)+
z)^2/(z-RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2))^2/(z-RootOf(_Z^4+2*_Z^2+2))^2
Pfs := [RootOf(_Z^4+2*_Z^2+2), RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2), -RootOf
(_Z^4+2*_Z^2+2), -RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2)]

ANS := {(1/32-3/32*I)*2^(1/4)*(1/2*(2-2^(1/2))^(1/2)+1/2*I*(2+2^(1/2))^(1/2))}
ANS2 := {-1/32*k*(2+3*k^2)}, k = 2^(1/4)*(-1)^(3/8)

## Simplify....

But for the RootOfs, simplify/mod2 would have been sufficient, so I suggest use frontend and simplify, which are meant for this task.

 cmod2:=`@`(f -> collect(f mod 2, RootOf),(f, n) -> `if`(n = [], f, frontend(simplify, [f, map(x -> x^2 - x, n), n], [{Non}(function), {}])),f -> (f, [op](select(type, frontend(indets, [f], [{Non}(function), {}]), name))),f -> Expand(f) mod 2):alias(alpha = RootOf(x^4 + x + 1));z := add(a[i] * alpha^i, i = 0 .. 3);seq(cmod2(z^i), i = 0 .. 15);

Counterexamples ?

## GB....

@Carl Love There is no GB? I am certain there would be an equivalent. It is grobner basis modulo p.

 with(share); readshare(GB,'`mod`');#readshare( `mod/GB` ):L := 1+X+X^6+X^7+X^8, (X^3+X+1)*Q+Q^3+(X^7+X^6+X^4+1)*Q^2+X^7+X^6+X^4+X^3+X^2+X+1;GB([L], [X, Q], plex) mod 2;

Results:

[X+Q^22+Q^21+Q^19+Q^17+Q^16+Q^15+Q^14+Q^9+Q^7+Q^6+Q^5+Q^2+Q, Q^19+1+Q^5+Q^21+Q^8+Q^10+Q^9+Q^12+Q^14+Q^24+Q^23+Q^13+Q^6+Q^16+Q^3+Q+Q^22]

## Selector....

The operator D is indexed.(and not parameterized) meaning it is a selector.

Consider:

 D[1](f):=g;D[1](g):=h;D[1,1](f):=z;

and

 (D[1]@@2=D[1,1])(f);

is a new statement altogether and not a simplification.

## Expecting....

 A:=(-(1/2)*ib-(1/2)*ia+ic)*vc+(-(1/2)*ia-(1/2)*ic+ib)*vb+(-(1/2)*ic-(1/2)*ib+ia)*va;B:=va+vb+vc:C:=ia+ib+ic:collect(A+1/2*B*C,indets(C));

## Trial...

I've just inputted this command and the return was NULL response:

 isolve({x>3/2,x<5/2},{x});

Reading from the help file "The procedure isolve solves the equations in eqns over the integers. It solves for all of the indeterminates occurring in the equations."

 First 16 17 18 19 20 21 Page 18 of 21
﻿