What is the meaning of mod in quadray of Pari software - numbers

I need a polynomial that defines the narrow Hilbert class field of the real quadratic field x^2-505. How quadray could do this? quadray(x^2-505,-1)? What is the meaning of Mod in output?
x^4 + Mod(-19*y - 207, y^2 - y - 126)*x^3 + Mod(305*y + 3277, y^2 - y - 126)*x^2 + Mod(-1523*y - 16351, y^2 - y - 126)*x + Mod(21732 - y - 126)

Mod(y, y^2 - y - 126) means "a root of y^2 - y - 126". What you obtained is an equation with coefficients in the quadratic field Q[y]/(y^2 - y - 126) which is isomorphic to Q(sqrt(505)) since the discriinant of y^2 - y - 126 is 505, i.e., a relative extension of degree 4 over that quadratic field.
However, this is not the answer you're looking for: quadray(505,-1) just computes the ordinary Hilbert class field, not the narrow one. (The -1 is the conductor ideal and (-1) = (1).) Indeed, bnfnarrow(bnfinit(y^2-505)) tells you that you're looking for a degree 8 extension, not 4 ! The quadray function is not suitable, use
bnrclassfield(bnrinit(bnfinit(y^2-505), [1,[1,1]]))
which yields
x^8 + 2*x^7 + (-y + 2)*x^6 + (3*y + 77)*x^5 + (55/2*y + 1317/2)*x^4 + (16*y + 380)*x^3 + (-255/2*y - 5685/2)*x^2 + (95*y + 2125)*x + (650*y + 14625)
This is again a relative extension of degree 8 over Q(sqrt(505)), except this time y = sqrt(505), since I specified the base by the explicit polynomial y^2 - 505.
What [1, [1,1]] means is : a modulus (in the sense of class field theory), where we allow ramification at no finite place (the initial 1), but at both places at infinity (the [1,1]).

Related

How to solve the following problem on MATLAB

a(x) here is a type of equation used in signal
Let
y(x) = x^3 + x^2 + x + 1
a(x) is inputed by the user so for example if user inputs
a(x) = D2 + D + 6
y(x)*a(x) = D2(x^3 + x^2 + x + 1) + D(x^3 + x^2 + x + 1) + 6(x^3 + x^2 + x + 1)
here D2(x^3 + x^2 + x + 1) = 6x + 2 and D(x^3 + x^2 + x + 1) = 3x^2 + 2x + 1
So D is differentiation and D2 is double differential
So i want to know how i would do something like this on MATLAB
Use Matlab symbolic computation toolbox https://www.mathworks.com/products/symbolic.html
Calculus
Evaluate exact analytical solutions for definite or indefinite integral,
calculate derivatives of symbolic expressions or functions,
and approximate functions using series expansions.

Using Matlab's Solve() with Symbolic Constants

I'm have a system of two questions with two unknown variables that I'm trying to use Matlab's solve() function to solve, but hitting errors that are almost surely on my end. I'm trying to solve The following two equations where r, lambda, and X are constants. To do so, I've been trying to run the following:
clear all;
syms VA VB r X L;
assumeAlso(VB <= VA);
assumeAlso(0 <= VB);
assumeAlso(0 < r <= 1);
assumeAlso(0 < L);
assumeAlso(0 < X);
assumeAlso(VA, 'real');
assumeAlso(VB, 'real');
assumeAlso(r, 'real');
assumeAlso(L, 'real');
assumeAlso(X, 'real');
eqns = [VA == ((r*VA + L*(VA-VB))^2)/(2*X*(r+2*L)) + (L*(VA+VB)*(r*VA+L*(VA-VB)))/(X*(r+2*L)) + ...
(((r^2/L+r)*VA + r*VB)^2 - (r*VA+L*(VA-VB))^2)/(2*X*(r+L)) + ...
(L*VB*((r+L)*VB - L*VA + r^2/L*VA))/(X*(r+L)) + ...
(X/(2*r)) - (((r^2/L+r)*VA+r*VB)^2)/(2*X*r) - VA*(1-1/X*((r^2/L+r)*VA+r*VB)), ...
...
VB == (L^2*VA^2 - L^2*VB^2 + r*VA*(L*VA+L*VB))/(X*(r+2*L)) + ...
(L*VA*(r^2/L*VA + r*VB - L*(VA-VB)))/(X*(r+L)) + ...
(VA*(X-((r^2/L+r)*VA + r*VB)))/X];
S = solve(eqns,[VA VB])
My goal is to solve for VA and VB in terms of r, X, and L, which seems like it should be possible. When I fill in values for r, L and X I am easily able to obtain a solution.
When I run this code, however, I get the message:
Warning: Explicit solution could not be found.
which normally I would interpret to mean that there is in fact no solution, but when I run
S = solve(eqns)
I do not get the same output, but:
(solvelib::cartesianPower(R_, 2) minus solvelib::VectorImageSet(matrix([[z], [0]]), z, C_)) intersect solvelib::VectorImageSet(matrix([[-(VA^4*x^5 - 2*L^5*VA*VB^3 - 2*L^5*VA^3*VB - L*VA^4*x^4 - 3*L^4*VA^4*x + L^4*VB^4*x + 4*L^5*VA^2*VB^2 - 5*L^2*VA^4*x^3 + 4*L^3*VA^4*x^2 + L^3*VB^4*x^2 + 4*L^2*VA^2*VB^2*x^3 - 5*L^3*VA^2*VB^2*x^2 + 4*L*VA^3*VB*x^4 + L^4*VA*VB^3*x + 9*L^4*VA^3*VB*x + L*VA^2*VB^2*x^4 + 2*L^2*VA*VB^3*x^3 + 2*L^3*VA*VB^3*x^2 - 8*L^3*VA^3*VB*x^2 - 8*L^4*VA^2*VB^2*x)/(L^4*VA^3 - L^4*VB^3 - L^4*VA*VB^2 + L^4*VA^2*VB)], [x]]), x, R_ intersect RootOf(z^6 + (z^5*(L*VA^4 + L*VA^2*VB^2 + 4*L*VA^3*VB))/VA^4 + (z^4*(- 7*L^2*VA^4 + 2*L^2*VA*VB^3 + 8*L^2*VA^3*VB + 6*L^2*VA^2*VB^2))/VA^4 + (z^3*(- 5*L^3*VA^4 + L^3*VB^4 + 6*L^3*VA*VB^3 - 6*L^3*VA^3*VB + 4*L^3*VA^2*VB^2))/VA^4 + (z^2*(7*L^4*VA^4 + 3*L^4*VB^4 + 6*L^4*VA*VB^3 - 2*L^4*VA^3*VB - 14*L^4*VA^2*VB^2))/VA^4 - (z*(6*L^5*VA^4 - 2*L^5*VB^4 - 16*L^5*VA^3*VB + 12*L^5*VA^2*VB^2))/VA^4 + (L^6*VA^4 + L^6*VB^4 - 4*L^6*VA*VB^3 - 4*L^6*VA^3*VB + 6*L^6*VA^2*VB^2)/VA^4, z)) intersect solvelib::VectorImageSet(matrix([[x], [y]]), [x, y], [Dom::Interval(0, Inf), Dom::Interval(0, [1])])
which does not have a solution for VA and VB.
Does anyone have an idea how I can get matlab's solve() to solve for [VA VB] in terms of r, L, and X?
Thank you!
Try using the ReturnConditions flag of the solve command. As in,
S = solve(eqns,[VA,VB],'ReturnConditions',true)
This will return a struct containing an array of solutions and required conditions for each.
I played around a bit with your example and hit the same roadblocks as you when making the same assumptions. If we start from zero assumptions, solve will find a set of solutions for the given equations. You could inspect the conditions for each of the given solutions and see what if any meet your original constraints?
The example given above yields results as long as VA and VB are not constrained to the Reals. Could there be a typo somewhere in your system of eqns?

How can I get MATLAB to numerically solve a particularly nasty system of equations?

I have four parameters, t1,t2, theta1, and theta2. I want to find a solution (there can potentially be infinitely many) to the following system of equations:
t1*cos(theta1) + t2*cos(theta2) + 2*t1*t2*sin(theta1 + theta2) = t1*sin(theta1) + t2*sin(theta2) + 2*t1*t2*cos(theta1 + theta2) + 1
t1*cos(theta1) + t2*cos(theta2) + t1*sin(theta1) + t2*sin(theta2) = 2*t1*t2*sin(theta1 + theta2) + 2*t1*t2*cos(theta1 + theta2) + 1
2*t1^2*t2^2 + sin(theta1)*t1*t2^2 + sin(theta1 + theta2)*t1*t2 + 1 = sin(theta2)*t1^2*t2 + t1^2 + sin(theta1)*t1 + t2^2
Since there are more parameters than equations, we have to impose further restrictions to identify a specific solution to this system. Right now I don't really care which solution is picked, as long as it isn't trivial (like all the variables equaling zero).
My current method is to set the third equation to 0.5, solving for t1 and t2 in terms of theta1 and theta2, and substituting these expressions into the first two equations to solve for theta1 and theta2. However, MATLAB is trying to do this symbolically, which is extremely time-consuming. Is there a way I can get some approximate solutions to this system? I can't exactly plot the surfaces represented by these equations and look at their intersection, because each side of the equations involves more than two parameters, which means it can't be visualized in three dimensions.
You can use fsolve to do this.
First, you need to create anonymous functions for the residuals of the three equations. I'm going to create a vector x where x = [t1; t2; theta1; theta2]. That makes the residuals:
r1 = #(x) x(1)*cos(x(3)) + x(2)*cos(x(4)) + 2*x(1)*x(2)*sin(x(3) + x(4)) - (x(1)*sin(x(3)) + x(2)*sin(x(4)) + 2*x(1)*x(2)*cos(x(3) + x(4)) + 1);
r2 = #(x) x(1)*cos(x(3)) + x(2)*cos(x(4)) + x(1)*sin(x(3)) + x(2)*sin(x(4)) - (2*x(1)*x(2)*sin(x(3) + x(4)) + 2*x(1)*x(2)*cos(x(3) + x(4)) + 1);
r3 = #(x) 2*x(1)^2*x(2)^2 + sin(x(3))*x(1)*x(2)^2 + sin(x(3) + x(4))*x(1)*x(2) + 1 - (sin(x(4))*x(1)^2*x(2) + x(1)^2 + sin(x(3))*x(1) + x(2)^2);
Then, we need to make a single function that is a vector of those three residuals, since fsolve tries to get this vector to be zero:
r = #(x) [r1(x); r2(x); r3(x)]
Now, we call fsolve. I picked an arbitrary starting point:
>> [x, fval, exitflag] = fsolve(r, [0.5,0.5,pi/4,pi/4])
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
> In fsolve at 287
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
x =
0.9654 0.5182 0.7363 0.7344
fval =
1.0e-10 *
-0.0090
0.2743
-0.0181
exitflag =
1
You can ignore the warning. x is the four values you were looking for. fval is the value of the residuals. exitFlag == 1 means we found a root.

How to shorten this symbolic expression?

The symbolic expression below is the answer of some problem:
syms x y;
F = (6006059164170857*x^4)/36028797018963968 ...
- (3741993627723215*x^3*y)/144115188075855872 ...
- (3786059161694655*x^3)/576460752303423488 ...
+ (2057823154876729*x^2*y^2)/9007199254740992 ...
+ (7804706423002791*x^2*y)/36028797018963968 ...
- (1579656551431947*x^2)/4503599627370496 ...
- (5176864966130107*x*y^3)/576460752303423488 ...
- (3350671128443929*x*y^2)/288230376151711744 ...
- (2340405747630269*x*y)/72057594037927936 ...
- (3122104315900301*x)/1152921504606846976 ...
+ (1757149312773205*y^4)/36028797018963968 ...
- (5692299995057083*y^3)/576460752303423488 ...
+ (4054023049400589*y^2)/144115188075855872 ...
- (434917661837037*y)/2251799813685248 ...
- 2254148116991025/18014398509481984;
As you can see, it's too long to read, how could I shorten it to read easily?
vpa will do the numeric calculations as far as possible and returns the result with the precision defined by digits.
See also latex for latex representation of you symbolic expression,
digits(2) % Two digits precision
latex(vpa(F))
0.17\, x^4 - 0.026\, x^3\, y - \left(6.6\cdot 10^{-3}\right)\, x^3 + 0.23\, x^2\, y^2 + 0.22\, x^2\, y - 0.35\, x^2 - \left(9.0\cdot 10^{-3}\right)\, x\, y^3 - 0.012\, x\, y^2 - 0.032\, x\, y - \left(2.7\cdot 10^{-3}\right)\, x + 0.049\, y^4 - \left(9.9\cdot 10^{-3}\right)\, y^3 + 0.028\, y^2 - 0.19\, y - 0.13
and pretty for nicer presentation in command window.
pretty(vpa(F))
3 3 3
4 3 6.6 x 2 2 2 2 9.0 x y 2 2.7 x 4 9.9 y 2
0.17 x - 0.026 x y - ------ + 0.23 x y + 0.22 x y - 0.35 x - -------- - 0.012 x y - 0.032 x y - ----- + 0.049 y - ------ + 0.028 y - 0.19 y - 0.13
3 3 3 3
10 10 10 10
You may have ended up with long integer like thin in the first place because you didn't create your symbolic equation in the best way. Compare the output of
sym(exp(pi))
to
exp(sym(pi))
Generally if you have any numeric constants in your symbolic equation that get transformed in complex ways (e.g., taking the exponential of them), you'll want to define them explicitly. If the constant is multiplied or added to a symbolic variable before being passed to the function then this may not be needed.
Additionally, you can use the simple and simplify functions to try to nicer versions of expressions. In your case:
G = simple(F)
returns
(192193893253467424*x^4 - 29935949021785720*x^3*y ...
- 7572118323389310*x^3 + 263401363824221312*x^2*y^2 ...
+ 249750605536089312*x^2*y - 404392077166578432*x^2 ...
- 10353729932260214*x*y^3 - 13402684513775716*x*y^2 ...
- 37446491962084304*x*y - 3122104315900301*x ...
+ 56228778008742560*y^4 - 11384599990114166*y^3 ...
+ 32432184395204712*y^2 - 222677842860562944*y ...
- 144265479487425600)/1152921504606846976
which is slightly shorter (it may be a lot nice if you do what I suggest above). You can then go from there to #pm89's excellent suggestions if needed.

using quad to integrate function with respect to just one variable

is there any way i can integrate function of two variable, say
f=#(x) x^2 + x*y
over just x
tried quad(f, a, b)
but doesn't work, looking for alternative solution
Looks like you want something like this:
y = 100; % whatever y is
a = 0;
b = 2;
% you'll need to vectorize the integrand function
f = #(x) x.*x + x.*y
val = quad(f, a, b);
However, if you are looking for an algebraic answer, you'll need to use the Symbolic Toolbox, or some other software, or your calculus book. :-)
The whole "vectorize" thing comes from the Mathworks quad documentation that says:
The function y = fun(x) should accept a vector argument x and return a vector result y, the integrand evaluated at each element of x.
Sorry, but quad does not solve symbolic problems. It does only numerical integration.
syms x y
int(x^2 + x*y,x)
ans =
(x^2*(2*x + 3*y))/6
The natural way to solve a symbolic problem is to use a symbolic tool.
From the followup, Anya wants something in-between. To steal the words of an old rock star named Mick, "You can't always get what you want."
Again, quad can't be used if you wish to integrate ONLY over x, as quad is an adaptive tool.
In SOME SIMPLE cases, you can use a simple tool like Simpson's rule to do the work. For example, suppose you wanted to solve the above problem, with x integrated over the interval [0 1]. For purposes of comparison, I'll do it symbolically first.
syms x y
res = int(x^2 + x*y,x);
subs(res,x,1) - subs(res,0)
ans =
y/2 + 1/3
Now, lets try it using a numerical integration on x.
syms y
x = 0:.01:1;
coef = mod((0:100)',2)*2 + 2;
coef([1 end]) = 1;
coef = 0.01*coef/3;
(x.^2 + x.*y)*coef
ans =
y/2 + 1/3
So in this very SIMPLE case, it did work. How about something a little more complicated? Integrate x*exp(x*y) over the interval [-1 1]. Again, a known form is accessible symbolically.
syms x y
res = int(x*exp(x*y),x);
res = subs(res,x,1) - subs(res,-1)
res =
(exp(-y)*(y + 1))/y^2 + (exp(y)*(y - 1))/y^2
To test it out later, what value does this take on at y = 1/2?
vpa(subs(res,y,1/2))
ans =
0.34174141687554424792549563431876
Lets try the same trick, using Simpson's rule.
syms y
x = -1:.01:1;
coef = mod((-100:100)',2)*2 + 2;
coef([1 end]) = 1;
coef = 0.01*coef/3;
res = (x.*exp(x*y))*coef
res =
exp(y/2)/300 - exp(-y/2)/300 - exp(-y)/300 - exp(-y/4)/300 + exp(y/4)/300 - exp(-y/5)/750 + exp(y/5)/750 - exp(-(3*y)/4)/100 - exp(-(2*y)/5)/375 + exp((2*y)/5)/375 + exp((3*y)/4)/100 - exp(-(3*y)/5)/250 + exp((3*y)/5)/250 - (2*exp(-(4*y)/5))/375 + (2*exp((4*y)/5))/375 - exp(-y/10)/1500 + exp(y/10)/1500 - exp(-(3*y)/10)/500 + exp((3*y)/10)/500 - (7*exp(-(7*y)/10))/1500 + (7*exp((7*y)/10))/1500 - (3*exp(-(9*y)/10))/500 + (3*exp((9*y)/10))/500 - exp(-y/20)/1500 + exp(y/20)/1500 - exp(-(3*y)/20)/500 + exp((3*y)/20)/500 - exp(-y/25)/3750 + exp(y/25)/3750 - (7*exp(-(7*y)/20))/1500 - exp(-(2*y)/25)/1875 + exp((2*y)/25)/1875 + (7*exp((7*y)/20))/1500 - exp(-(3*y)/25)/1250 + exp((3*y)/25)/1250 - (3*exp(-(9*y)/20))/500 - (2*exp(-(4*y)/25))/1875 + (2*exp((4*y)/25))/1875 + (3*exp((9*y)/20))/500 - (11*exp(-(11*y)/20))/1500 - exp(-(6*y)/25)/625 + exp((6*y)/25)/625 + (11*exp((11*y)/20))/1500 - (7*exp(-(7*y)/25))/3750 + (7*exp((7*y)/25))/3750 - (13*exp(-(13*y)/20))/1500 - (4*exp(-(8*y)/25))/1875 + (4*exp((8*y)/25))/1875 + (13*exp((13*y)/20))/1500 - (3*exp(-(9*y)/25))/1250 + (3*exp((9*y)/25))/1250 - (11*exp(-(11*y)/25))/3750 + (11*exp((11*y)/25))/3750 - (17*exp(-(17*y)/20))/1500 - (2*exp(-(12*y)/25))/625 + (2*exp((12*y)/25))/625 + (17*exp((17*y)/20))/1500 - (13*exp(-(13*y)/25))/3750 + (13*exp((13*y)/25))/3750 - (19*exp(-(19*y)/20))/1500 - (7*exp(-(14*y)/25))/1875 + (7*exp((14*y)/25))/1875 + (19*exp((19*y)/20))/1500 - (8*exp(-(16*y)/25))/1875 + (8*exp((16*y)/25))/1875 - (17*exp(-(17*y)/25))/3750 + (17*exp((17*y)/25))/3750 - (3*exp(-(18*y)/25))/625 + (3*exp((18*y)/25))/625 - (19*exp(-(19*y)/25))/3750 + (19*exp((19*y)/25))/3750 - (7*exp(-(21*y)/25))/1250 + (7*exp((21*y)/25))/1250 - (11*exp(-(22*y)/25))/1875 + (11*exp((22*y)/25))/1875 - (23*exp(-(23*y)/25))/3750 + (23*exp((23*y)/25))/3750 - (4*exp(-(24*y)/25))/625 + (4*exp((24*y)/25))/625 - exp(-y/50)/7500 + exp(y/50)/7500 - exp(-(3*y)/50)/2500 + exp((3*y)/50)/2500 - (7*exp(-(7*y)/50))/7500 + (7*exp((7*y)/50))/7500 - (3*exp(-(9*y)/50))/2500 + (3*exp((9*y)/50))/2500 - (11*exp(-(11*y)/50))/7500 + (11*exp((11*y)/50))/7500 - (13*exp(-(13*y)/50))/7500 + (13*exp((13*y)/50))/7500 - (17*exp(-(17*y)/50))/7500 + (17*exp((17*y)/50))/7500 - (19*exp(-(19*y)/50))/7500 + (19*exp((19*y)/50))/7500 - (7*exp(-(21*y)/50))/2500 + (7*exp((21*y)/50))/2500 - (23*exp(-(23*y)/50))/7500 + (23*exp((23*y)/50))/7500 - (9*exp(-(27*y)/50))/2500 + (9*exp((27*y)/50))/2500 - (29*exp(-(29*y)/50))/7500 + (29*exp((29*y)/50))/7500 - (31*exp(-(31*y)/50))/7500 + (31*exp((31*y)/50))/7500 - (11*exp(-(33*y)/50))/2500 + (11*exp((33*y)/50))/2500 - (37*exp(-(37*y)/50))/7500 + (37*exp((37*y)/50))/7500 - (13*exp(-(39*y)/50))/2500 + (13*exp((39*y)/50))/2500 - (41*exp(-(41*y)/50))/7500 + (41*exp((41*y)/50))/7500 - (43*exp(-(43*y)/50))/7500 + (43*exp((43*y)/50))/7500 - (47*exp(-(47*y)/50))/7500 + (47*exp((47*y)/50))/7500 - (49*exp(-(49*y)/50))/7500 + (49*exp((49*y)/50))/7500 - exp(-y/100)/7500 + exp(y/100)/7500 - exp(-(3*y)/100)/2500 + exp((3*y)/100)/2500 - (7*exp(-(7*y)/100))/7500 + (7*exp((7*y)/100))/7500 - (3*exp(-(9*y)/100))/2500 + (3*exp((9*y)/100))/2500 - (11*exp(-(11*y)/100))/7500 + (11*exp((11*y)/100))/7500 - (13*exp(-(13*y)/100))/7500 + (13*exp((13*y)/100))/7500 - (17*exp(-(17*y)/100))/7500 + (17*exp((17*y)/100))/7500 - (19*exp(-(19*y)/100))/7500 + (19*exp((19*y)/100))/7500 - (7*exp(-(21*y)/100))/2500 + (7*exp((21*y)/100))/2500 - (23*exp(-(23*y)/100))/7500 + (23*exp((23*y)/100))/7500 - (9*exp(-(27*y)/100))/2500 + (9*exp((27*y)/100))/2500 - (29*exp(-(29*y)/100))/7500 + (29*exp((29*y)/100))/7500 - (31*exp(-(31*y)/100))/7500 + (31*exp((31*y)/100))/7500 - (11*exp(-(33*y)/100))/2500 + (11*exp((33*y)/100))/2500 - (37*exp(-(37*y)/100))/7500 + (37*exp((37*y)/100))/7500 - (13*exp(-(39*y)/100))/2500 + (13*exp((39*y)/100))/2500 - (41*exp(-(41*y)/100))/7500 + (41*exp((41*y)/100))/7500 - (43*exp(-(43*y)/100))/7500 + (43*exp((43*y)/100))/7500 - (47*exp(-(47*y)/100))/7500 + (47*exp((47*y)/100))/7500 - (49*exp(-(49*y)/100))/7500 + (49*exp((49*y)/100))/7500 - (17*exp(-(51*y)/100))/2500 + (17*exp((51*y)/100))/2500 - (53*exp(-(53*y)/100))/7500 + (53*exp((53*y)/100))/7500 - (19*exp(-(57*y)/100))/2500 + (19*exp((57*y)/100))/2500 - (59*exp(-(59*y)/100))/7500 + (59*exp((59*y)/100))/7500 - (61*exp(-(61*y)/100))/7500 + (61*exp((61*y)/100))/7500 - (21*exp(-(63*y)/100))/2500 + (21*exp((63*y)/100))/2500 - (67*exp(-(67*y)/100))/7500 + (67*exp((67*y)/100))/7500 - (23*exp(-(69*y)/100))/2500 + (23*exp((69*y)/100))/2500 - (71*exp(-(71*y)/100))/7500 + (71*exp((71*y)/100))/7500 - (73*exp(-(73*y)/100))/7500 + (73*exp((73*y)/100))/7500 - (77*exp(-(77*y)/100))/7500 + (77*exp((77*y)/100))/7500 - (79*exp(-(79*y)/100))/7500 + (79*exp((79*y)/100))/7500 - (27*exp(-(81*y)/100))/2500 + (27*exp((81*y)/100))/2500 - (83*exp(-(83*y)/100))/7500 + (83*exp((83*y)/100))/7500 - (29*exp(-(87*y)/100))/2500 + (29*exp((87*y)/100))/2500 - (89*exp(-(89*y)/100))/7500 + (89*exp((89*y)/100))/7500 - (91*exp(-(91*y)/100))/7500 + (91*exp((91*y)/100))/7500 - (31*exp(-(93*y)/100))/2500 + (31*exp((93*y)/100))/2500 - (97*exp(-(97*y)/100))/7500 + (97*exp((97*y)/100))/7500 - (33*exp(-(99*y)/100))/2500 + (33*exp((99*y)/100))/2500 + exp(y)/300
So I got a result, but its not the analytical one I wanted, and a bit of a nasty mess. Is it correct?
vpa(subs(res,y,1/2))
ans =
0.34174141693463006644516447861307
I'll copy the analytical result from above so we can compare...
0.34174141687554424792549563431876
As you can see, Simpson's rule, at a step size of 0.01 over [-1,1], did reasonably well, agreeing out to about 9 decimal digits.
There is no assurance that this technique will work as well on any more general kernel, but it might give you what you desire.