text
stringlengths 0
3.34M
|
---|
function [airway_mapped_image, airway_tree_root] = PTKMapAirwayCentrelineToImage(centreline_results, airway_image)
% PTKMapAirwayCentrelineToImage.
%
%
%
%
% Licence
% -------
% Part of the TD Pulmonary Toolkit. https://github.com/tomdoel/pulmonarytoolkit
% Author: Tom Doel, 2014. www.tomdoel.com
% Distributed under the GNU GPL v3 licence. Please see website for details.
%
airway_mapped_image_raw = zeros(airway_image.ImageSize, 'uint16');
airway_mapped_image = airway_image.BlankCopy;
airway_tree_root = centreline_results.AirwayCentrelineTree;
centreline_bronchi_to_do = CoreStack(airway_tree_root);
bronchus_index = uint16(1);
number_of_branches = airway_tree_root.CountBranches;
parent_map = cell(number_of_branches, 1);
child_map = cell(number_of_branches, 1);
% Assign a label to each centreline bronchus, and mark the label
% image with that index at each centreline voxel
while ~centreline_bronchi_to_do.IsEmpty
next_centreline_bronchus = centreline_bronchi_to_do.Pop;
voxels = PTKTreeUtilities.GetCentrelineVoxelsForTheseBranches(next_centreline_bronchus, airway_image);
airway_mapped_image_raw(voxels) = bronchus_index;
next_centreline_bronchus.BronchusIndex = bronchus_index;
% Add parent index to this branch, and add this branch index to
% parent's child indices
if ~isempty(next_centreline_bronchus.Parent)
parent = next_centreline_bronchus.Parent;
parent_index = parent.BronchusIndex;
parent_map{bronchus_index} = parent_index;
child_map{parent_index} = [child_map{parent_index}, bronchus_index];
end
centreline_bronchi_to_do.Push(next_centreline_bronchus.Children);
bronchus_index = bronchus_index + 1;
end
% Find the nearest centreline point for every voxel in the airway
% segmentation, and assign every voxel to that label
[~, nearest_centreline_index] = bwdist(airway_mapped_image_raw > 0);
airway_mapped_image_raw(:) = airway_mapped_image_raw(nearest_centreline_index(:));
airway_mapped_image_raw(airway_image.RawImage ~= 1) = 0;
airway_mapped_image.ChangeRawImage(airway_mapped_image_raw);
airway_mapped_image.ChangeColorLabelParentChildMap(parent_map, child_map)
end
|
########################################################################
# Adapted from runDE.py in FLAIR
# https://github.com/BrooksLabUCSC/flair
# Original author: Cameron M. Soulette
# Updated by Alexis M. Thornton
########################################################################
import os, sys
import pandas as pd
import numpy as np
#supressing rpy2 warnings
import warnings
from rpy2.rinterface import RRuntimeWarning
warnings.filterwarnings("ignore", category=RRuntimeWarning)
from rpy2 import robjects
from rpy2.robjects import r,pandas2ri, Formula
from rpy2.robjects.lib import grid
pandas2ri.activate()
R = robjects.r
# main
def main(group1=None, group2=None, outDir=None, inDir=None, formula=None):
'''
main
'''
R.assign('inDir',inDir)
R.assign('outdir',outDir)
R.assign('group1',group1)
R.assign('group2',group2)
print("Running DeSeq2....")
print(group1 +" vs "+ group2)
# import
from rpy2.robjects.packages import importr
#kallisto processing libraries
tximportData = importr('tximportData')
tximport = importr('tximport')
ensembldb = importr('ensembldb')
EnsDb_Hsapiens_v86 = importr('EnsDb.Hsapiens.v86')
#deseq
methods = importr('methods')
deseq = importr('DESeq2')
#transcripts to gene, used in tximport
R('edb <- EnsDb.Hsapiens.v86')
R('tx2gene = transcripts(edb , columns=c("tx_id", "gene_name"),return.type="DataFrame")')
# import formula
formulaDF = pd.read_csv(formula,header=0, sep="\t")
samples = formulaDF.samples.tolist()
R.assign('samples',samples)
sampleTable = pandas2ri.py2ri(formulaDF)
R.assign('sampleTable',sampleTable)
#locate kallisto files
#would be faster to use kallito abundance.h5 files
R('files <- file.path(inDir, samples, "abundance.tsv")')
R('all(file.exists(files))')
#tximport conversion to gene
R('txi.kallisto <- tximport(files, type = "kallisto",tx2gene = tx2gene, txOut = FALSE,ignoreTxVersion=TRUE)')
R('rownames(sampleTable) <- samples')
#DESeq
R('dds <- DESeqDataSetFromTximport(txi.kallisto, sampleTable, ~condition)')
# R('colData(dds)$condition<-factor(colData(dds)$condition, levels=c(group1,group2))')
R('dds_<-DESeq(dds)')
R('res<-results(dds_)')
R('res<-res[order(res$padj),]')
# writing deseq2 results to a file
Out = os.path.join(outDir, "%s_v_%s_deseq2_results.csv" % (group1,group2))
R.assign('Out',Out)
R('write.csv(as.data.frame(res),file=Out)')
if __name__ == "__main__":
main()
|
import game.sets.sets_level05 -- hide
import tactic -- hide
namespace xena -- hide
variable X : Type
open_locale classical -- hide
/-
# Chapter 1 : Sets
## Level 6 : `sdiff` and `neg`
-/
/-
The set-theoretic difference `A \ B` satisfies the following property:
```
lemma mem_sdiff_iff : x ∈ A \ B ↔ x ∈ A ∧ x ∉ B
```
The complement `-A` of a set `A` (often denoted $A^c$ in textbooks)
is all the elements of `X` which are not in `A`:
```
lemma mem_neg_iff : x ∈ -A ↔ x ∉ A
```
In this lemma, you might get a shock. The `rw` tactic is aggressive
in the Real Number Game -- if after a rewrite the goal can be
solved by `refl`, then Lean will close the goal automatically.
-/
/- Axiom : mem_sdiff_iff :
x ∈ A \ B ↔ x ∈ A ∧ x ∉ B
-/
/- Axiom : mem_neg_iff :
x ∈ -A ↔ x ∉ A
-/
/- Lemma
If $A$ and $B$ are sets with elements of type $X$, then
$$(A \setminus B) = A \cap B^{c}.$$
-/
theorem setdiff_eq_intersect_comp (A B : set X) : A \ B = A ∩ Bᶜ :=
begin
rw ext_iff,
intro h,
rw mem_sdiff_iff,
rw mem_inter_iff,
rw mem_neg_iff,
end
end xena -- hide
/-
rw ext_iff,
intro x,
rw mem_sdiff_iff,
rw mem_inter_iff,
rw mem_neg_iff,
-/
|
lemmas scaleR_eq_0_iff = real_vector.scale_eq_0_iff |
import pandas
import numpy as np
import matplotlib.pyplot as plt
def get_from_pie_plot(df, minimum_emails=25):
df["from"].value_counts()
dict_values = np.array(list(df["from"].value_counts().to_dict().values()))
dict_keys = np.array(list(df["from"].value_counts().to_dict().keys()))
ind = dict_values > minimum_emails
dict_values_red = dict_values[ind].tolist()
dict_keys_red = dict_keys[ind].tolist()
dict_values_red.append(sum(dict_values[~ind]))
dict_keys_red.append("other")
fig1, ax1 = plt.subplots()
ax1.pie(dict_values_red, labels=dict_keys_red)
ax1.axis("equal")
plt.show()
def get_labels_pie_plot(gmail, df):
label_lst = []
for llst in df.labels.values:
for ll in llst:
label_lst.append(ll)
label_lst = list(set(label_lst))
label_lst = [label for label in label_lst if "Label_" in label]
label_count_lst = [
sum([True if label_select in label else False for label in df.labels])
for label_select in label_lst
]
convert_dict = {
v: k
for v, k in zip(
list(gmail._label_dict.values()), list(gmail._label_dict.keys())
)
}
label_convert_lst = [convert_dict[label] for label in label_lst]
ind = np.argsort(label_count_lst)
fig1, ax1 = plt.subplots()
ax1.pie(
np.array(label_count_lst)[ind][::-1],
labels=np.array(label_convert_lst)[ind][::-1],
)
ax1.axis("equal")
plt.show()
def get_number_of_email_plot(df, steps=8):
start_month = [d.year * 12 + d.month for d in pandas.to_datetime(df.date)]
plt.hist(start_month)
plt.xticks(
np.linspace(np.min(start_month), np.max(start_month), steps),
[
str(int(month // 12)) + "-" + str(int(month % 12))
for month in np.linspace(np.min(start_month), np.max(start_month), steps)
],
)
plt.xlabel("Date")
plt.ylabel("Number of Emails")
|
%default total
data MyBit = A | B
fullCoverage : MyBit -> Int
fullCoverage A = 1
fullCoverage B = 2
extraDefault : MyBit -> Int
extraDefault A = 1
extraDefault B = 2
extraDefault _ = 3
usefulDefault : MyBit -> Int
usefulDefault A = 1
usefulDefault _ = 2
earlyDefault : MyBit -> Int
earlyDefault _ = 1
earlyDefault A = 2
onlyDefault : MyBit -> Int
onlyDefault _ = 1
nestedFullCoverage : MyBit -> MyBit -> Int
nestedFullCoverage A A = 1
nestedFullCoverage A B = 2
nestedFullCoverage B A = 3
nestedFullCoverage B B = 4
nestedExtraDefault : MyBit -> MyBit -> Int
nestedExtraDefault A A = 1
nestedExtraDefault A B = 2
nestedExtraDefault B A = 3
nestedExtraDefault B B = 4
nestedExtraDefault _ _ = 5
nestedUsefulDefault : MyBit -> MyBit -> Int
nestedUsefulDefault A A = 1
nestedUsefulDefault A B = 2
nestedUsefulDefault B A = 3
nestedUsefulDefault _ _ = 4
nestedEarlyDefault : MyBit -> MyBit -> Int
nestedEarlyDefault A A = 1
nestedEarlyDefault A B = 2
nestedEarlyDefault B A = 3
nestedEarlyDefault _ _ = 4
nestedEarlyDefault B B = 5
|
#ifndef QDM_LOGL_H
#define QDM_LOGL_H 1
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
#include <qdm/tau.h>
int
qdm_find_tau(
double *result,
double v,
size_t spline_df,
const gsl_vector *knots,
const gsl_vector *mmm
);
int
qdm_logl(
double *log_likelihood,
double *tau,
double v,
size_t spline_df,
const gsl_vector *knots,
const gsl_vector *mmm,
double tau_low,
double tau_high,
double xi_low,
double xi_high
);
int
qdm_logl_2(
double *log_likelihood,
double *tau,
double x,
double y,
double tau_low,
double tau_high,
double xi_low,
double xi_high,
size_t spline_df,
const gsl_matrix *theta,
const gsl_vector *knots
);
void
qdm_logl_3(
double *log_likelihood,
double *tau,
double x,
double y,
const qdm_tau *t,
const gsl_vector *xi,
const gsl_matrix *theta
);
#endif /* QDM_LOGL_H */
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
import os
import random
import zipfile
import cPickle as pickle
import numpy as np
from six.moves import urllib
from six.moves import xrange # pylint: disable
from scipy.sparse import csr_matrix
import bisect
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf
import subprocess as sp
import argparse
def read_data(filename):
"""Extract the first file enclosed in a zip file as a list of words."""
with zipfile.ZipFile(filename) as f:
data = tf.compat.as_str(f.read(f.namelist()[0])).split()
return data
def build_dataset(words, n_words, with_UNK = True, shuffle = False, count = None):
"""Process raw inputs into a dataset."""
if count is None:
if with_UNK:
count = [['UNK', -1]]
count.extend(collections.Counter(words).most_common(n_words - 1))
else:
count = []
count.extend(collections.Counter(words).most_common(n_words))
if shuffle:
count = np.random.permutation(count)
else:
count = count
dictionary = dict()
for word, _ in count:
dictionary[word] = len(dictionary)
data = list()
unk_count = 0
for word in words:
if word in dictionary:
index = dictionary[word]
data.append(index)
else:
index = dictionary['UNK']
unk_count += 1
if with_UNK:
data.append(index)
if with_UNK:
count[dictionary['UNK']][1] = unk_count
reversed_dictionary = dict(zip(dictionary.values(), dictionary.keys()))
return data, count, dictionary, reversed_dictionary
def build_cooccurance_dict(data, count, dictionary, reverse_dictionary, skip_window):
cooccurance_count = collections.defaultdict(collections.Counter)
for idx, center_word in enumerate(data):
center_word_id = center_word
if idx >= skip_window - 1 and idx < len(data) - skip_window:
for i in range(skip_window):
cooccurance_count[center_word_id][data[idx-i-1]] += 1
cooccurance_count[center_word_id][data[idx+i+1]] += 1
elif idx < skip_window - 1:
for i in range(skip_window):
cooccurance_count[center_word_id][data[idx+i+1]] += 1
for i in range(idx):
cooccurance_count[center_word_id][data[i]] += 1
else:
for i in range(skip_window):
cooccurance_count[center_word_id][data[idx-i-1]] += 1
for i in range(idx+1, len(data)):
cooccurance_count[center_word_id][data[i]] += 1
return cooccurance_count
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='estimation of noise given a corpus')
parser.add_argument('--filename', required=True, type=str, help='vocabulary siz3')
parser.add_argument('--vocabulary_size', default=10000, type=int, help='vocabulary siz3')
parser.add_argument('--window_size', default=5, type=int, help='window size')
parser.add_argument('intrinsic_test', action='store_false')
args = parser.parse_args()
filename = args.filename
vocabulary_size = args.vocabulary_size
skip_window = args.window_size
save_path = 'dat_{}/'.format(vocabulary_size)
try:
with open(save_path + 'data.pkl', 'r') as f:
data = pickle.dump(f)
with open(save_path + 'data_test.pkl', 'r') as f:
data_test = pickle.load(f)
with open(save_path + 'count.pkl', 'r') as f:
count = pickle.load(f)
with open(save_path + 'dictionary.pkl', 'r') as f:
dictionary = pickle.load(f)
with open(save_path + 'reverse_dictionary.pkl', 'r') as f:
reverse_dictionary = pickle.load(f)
with open(save_path + 'count_test.pkl', 'r') as f:
count_test = pickle.load(f)
with open(save_path + 'dictionary_test.pkl', 'r') as f:
dictionary_test = pickle.load(f)
with open(save_path + 'reverse_dictionary_test.pkl', 'r') as f:
reverse_dictionary_test = pickle.load(f)
except:
# Read the data into a list of strings.
vocabulary = read_data(filename)
vocabulary_size = args.vocabulary_size
splits = len(vocabulary) // 1000
train_set, test_set = [], []
for i in range(500):
train_set += vocabulary[(2*i)*splits:(2*i+1)*splits]
test_set += vocabulary[(2*i+1)*splits:(2*i+2)*splits]
del vocabulary
data, count, dictionary, reverse_dictionary = build_dataset(train_set,
vocabulary_size)
data_test, count_test, dictionary_test, reverse_dictionary_test = build_dataset(
test_set, vocabulary_size, shuffle = False, count = count)
vocabulary_size = min(vocabulary_size, len(count))
# save data
sp.check_output('mkdir -p {}'.format(save_path), shell=True)
with open(save_path + 'data.pkl', 'w') as f:
pickle.dump(data, f)
with open(save_path + 'data_test.pkl', 'w') as f:
pickle.dump(data_test, f)
with open(save_path + 'count.pkl', 'w') as f:
pickle.dump(count, f)
with open(save_path + 'dictionary.pkl', 'w') as f:
pickle.dump(dictionary, f)
with open(save_path + 'reverse_dictionary.pkl', 'w') as f:
pickle.dump(reverse_dictionary, f)
with open(save_path + 'count_test.pkl', 'w') as f:
pickle.dump(count_test, f)
with open(save_path + 'dictionary_test.pkl', 'w') as f:
pickle.dump(dictionary_test, f)
with open(save_path + 'reverse_dictionary_test.pkl', 'w') as f:
pickle.dump(reverse_dictionary_test, f)
count = count[:vocabulary_size]
skip_window = args.window_size
try:
with open(save_path + 'cooccur.pkl', 'r') as f:
cooccur = pickle.load(f)
with open(save_path + 'cooccur_test.pkl', 'r') as f:
cooccur_test = pickle.load(f)
with open(save_path + 'cooccur_matrix.pkl', 'r') as f:
cooccur_matrix = pickle.load(f)
cooccur_test_matrix = np.zeros([vocabulary_size, vocabulary_size])
with open(save_path + 'cooccur_matrix_test.pkl', 'r') as f:
cooccur_test_matrix = pickle.load(f)
del data
del data_test
except:
cooccur = build_cooccurance_dict(data, count, dictionary, reverse_dictionary, skip_window)
with open(save_path + 'cooccur.pkl', 'w') as f:
pickle.dump(cooccur, f)
#---------------------------build for second part of data---------------------
cooccur_test = build_cooccurance_dict(data_test, count_test,
dictionary_test, reverse_dictionary_test, skip_window)
with open(save_path + 'cooccur_test.pkl', 'w') as f:
pickle.dump(cooccur_test, f)
cooccur_matrix = np.zeros([vocabulary_size, vocabulary_size])
for k1, v1 in cooccur.iteritems():
for k2, v2 in v1.iteritems():
cooccur_matrix[k1, k2] = v2
del data
with open(save_path + 'cooccur_matrix.pkl', 'w') as f:
pickle.dump(cooccur_matrix, f)
cooccur_test_matrix = np.zeros([vocabulary_size, vocabulary_size])
for k1, v1 in cooccur_test.iteritems():
for k2, v2 in v1.iteritems():
cooccur_test_matrix[k1, k2] = v2
del data_test
with open(save_path + 'cooccur_matrix_test.pkl', 'w') as f:
pickle.dump(cooccur_test_matrix, f)
Nij = np.zeros([vocabulary_size, vocabulary_size])
for i in range(vocabulary_size):
for j in range(vocabulary_size):
Nij[i,j] += cooccur[i][j]
Ni = np.zeros(vocabulary_size)
for item in count:
Ni[dictionary[item[0]]] = item[1]
tot = np.sum(Nij)
print(tot)
print(np.sum(Ni))
Pij = Nij / tot
Pi = Ni / np.sum(Ni)
print(np.sum(Pij))
print(np.sum(Pi))
PMI = np.zeros([vocabulary_size, vocabulary_size])
for i in range(vocabulary_size):
for j in range(vocabulary_size):
if Pi[i] * Pi[j] > 0 and Pij[i, j] > 0:
PMI[i,j] = np.log(Pij[i,j] / (Pi[i] * Pi[j]))
Nij_test = np.zeros([vocabulary_size, vocabulary_size])
for i in range(vocabulary_size):
for j in range(vocabulary_size):
Nij_test[i,j] += cooccur_test[i][j]
Ni_test = np.zeros(vocabulary_size)
for item in count_test:
Ni_test[dictionary[item[0]]] = item[1]
tot = np.sum(Nij_test)
print(tot)
print(np.sum(Ni_test))
Pij_test = Nij_test / tot
Pi_test = Ni_test / np.sum(Ni_test)
print(np.sum(Pij_test))
print(np.sum(Pi_test))
PMI_test = np.zeros([vocabulary_size, vocabulary_size])
for i in range(vocabulary_size):
for j in range(vocabulary_size):
if Pi_test[i] * Pi_test[j] > 0 and Pij_test[i, j] > 0:
PMI_test[i,j] = np.log(Pij_test[i,j] / (Pi_test[i] * Pi_test[j]))
diff = PMI - PMI_test
print("mean is {}".format(np.mean(diff)))
print("est std is {}".format(0.5 * np.std(diff)))
with open("param.yml", "w") as f:
f.write("sigma: {}\n".format(0.5 * np.std(diff)))
f.write("alpha: {}\n".format(0.5)) #symmetric factorization
f.write("data: {}".format("text8_pmi"))
|
using Rubin
using Tests
using Elliptic
using HypergeometricFunctions
using Polylogarithms
using SpecialFunctions
@test integrate(1, x) == :(x)
@test integrate(5, x) == :(5x)
@test integrate(-2, x) == :(-2x)
@test integrate(-3//2, x) == :(-3//2*x)
@test integrate(pi, x) == :(pi*x)
@test integrate(a, x) == :(a*x)
@test integrate(3a, x) == :(3*a*x)
@test integrate(pi*(16+-1*exp(2))^-1//2, x) == :(pi*x*(16+-1*exp(2))^-1//2)
@test integrate(x^100, x) == :(1//101*x^101)
@test integrate(x^3, x) == :(1//4*x^4)
@test integrate(x^2, x) == :(1//3*x^3)
@test integrate(x, x) == :((1/2)*x^2)
@test integrate(1, x) == :(x)
@test integrate(x^-1, x) == :(log(x))
@test integrate(x^-2, x) == :(-1*x^-1)
@test integrate(x^-3, x) == :(-1//2*x^-2)
@test integrate(x^-4, x) == :(-1//3*x^-3)
@test integrate(x^-100, x) == :(-1//99*x^-99)
@test integrate(x^5//2, x) == :(2//7*x^7//2)
@test integrate(x^3//2, x) == :(2//5*x^5//2)
@test integrate(x^(1/2), x) == :(2//3*x^3//2)
@test integrate(x^-1//2, x) == :(2*x^(1/2))
@test integrate(x^-3//2, x) == :(-2*x^-1//2)
@test integrate(x^-5//2, x) == :(-2//3*x^-3//2)
@test integrate(x^5//3, x) == :(3//8*x^8//3)
@test integrate(x^4//3, x) == :(3//7*x^7//3)
@test integrate(x^2//3, x) == :(3//5*x^5//3)
@test integrate(x^1//3, x) == :(3//4*x^4//3)
@test integrate(x^-1//3, x) == :(3//2*x^2//3)
@test integrate(x^-2//3, x) == :(3*x^1//3)
@test integrate(x^-4//3, x) == :(-3*x^-1//3)
@test integrate(x^-5//3, x) == :(-3//2*x^-2//3)
@test integrate(x^n, x) == :(x^(1+n)*(1+n)^-1)
@test integrate((b*x)^n, x) == :(b^-1*(b*x)^(1+n)*(1+n)^-1)
@test integrate(((-1a)^(1/2)+e*(c+d*x))^-1, x) == :(d^-1*e^-1*log((-1a)^(1/2)+c*e+d*e*x))
@test integrate((c+d*(a+b*x))^5//2, x) == :(2//7*b^-1*d^-1*(c+d*(a+b*x))^7//2)
@test integrate((c+d*(a+b*x))^3//2, x) == :(2//5*b^-1*d^-1*(c+d*(a+b*x))^5//2)
@test integrate((c+d*(a+b*x))^(1/2), x) == :(2//3*b^-1*d^-1*(c+d*(a+b*x))^3//2)
@test integrate((c+d*(a+b*x))^-1//2, x) == :(2*b^-1*d^-1*(c+d*(a+b*x))^(1/2))
@test integrate((c+d*(a+b*x))^-3//2, x) == :(-2*b^-1*d^-1*(c+d*(a+b*x))^-1//2)
@test integrate((c+d*(a+b*x))^-5//2, x) == :(-2//3*b^-1*d^-1*(c+d*(a+b*x))^-3//2)
@test integrate(x^3*(a+b*x), x) == :(1//4*a*x^4+1//5*b*x^5)
@test integrate(x^2*(a+b*x), x) == :(1//3*a*x^3+1//4*b*x^4)
@test integrate(x*(a+b*x), x) == :((1/2)*a*x^2+1//3*b*x^3)
@test integrate(a+b*x, x) == :(a*x+(1/2)*b*x^2)
@test integrate(x^-1*(a+b*x), x) == :(a*log(x)+b*x)
@test integrate(x^-2*(a+b*x), x) == :(b*log(x)+-1*a*x^-1)
@test integrate(x^-3*(a+b*x), x) == :(-1//2*a^-1*x^-2*(a+b*x)^2)
@test integrate(x^-4*(a+b*x), x) == :(-1//2*b*x^-2+-1//3*a*x^-3)
@test integrate(x^-5*(a+b*x), x) == :(-1//3*b*x^-3+-1//4*a*x^-4)
@test integrate(x^3*(a+b*x)^2, x) == :(1//4*a^2*x^4+1//6*b^2*x^6+2//5*a*b*x^5)
@test integrate(x^2*(a+b*x)^2, x) == :(1//3*a^2*x^3+1//5*b^2*x^5+(1/2)*a*b*x^4)
@test integrate(x*(a+b*x)^2, x) == :((1/2)*a^2*x^2+1//4*b^2*x^4+2//3*a*b*x^3)
@test integrate((a+b*x)^2, x) == :(1//3*b^-1*(a+b*x)^3)
@test integrate(x^-1*(a+b*x)^2, x) == :(a^2*log(x)+(1/2)*b^2*x^2+2*a*b*x)
@test integrate(x^-2*(a+b*x)^2, x) == :(x*b^2+-1*a^2*x^-1+2*a*b*log(x))
@test integrate(x^-3*(a+b*x)^2, x) == :(b^2*log(x)+-1//2*a^2*x^-2+-2*a*b*x^-1)
@test integrate(x^-4*(a+b*x)^2, x) == :(-1//3*a^-1*x^-3*(a+b*x)^3)
@test integrate(x^-5*(a+b*x)^2, x) == :(-1//2*b^2*x^-2+-1//4*a^2*x^-4+-2//3*a*b*x^-3)
@test integrate(x^-6*(a+b*x)^2, x) == :(-1//3*b^2*x^-3+-1//5*a^2*x^-5+-1//2*a*b*x^-4)
@test integrate(x^-7*(a+b*x)^2, x) == :(-1//4*b^2*x^-4+-1//6*a^2*x^-6+-2//5*a*b*x^-5)
@test integrate(x^-8*(a+b*x)^2, x) == :(-1//5*b^2*x^-5+-1//7*a^2*x^-7+-1//3*a*b*x^-6)
@test integrate(x^4*(a+b*x)^3, x) == :(1//5*a^3*x^5+1//8*b^3*x^8+(1/2)*b*a^2*x^6+3//7*a*b^2*x^7)
@test integrate(x^3*(a+b*x)^3, x) == :(1//4*a^3*x^4+1//7*b^3*x^7+(1/2)*a*b^2*x^6+3//5*b*a^2*x^5)
@test integrate(x^2*(a+b*x)^3, x) == :(1//3*a^3*x^3+1//6*b^3*x^6+3//4*b*a^2*x^4+3//5*a*b^2*x^5)
@test integrate(x*(a+b*x)^3, x) == :(1//5*b^-2*(a+b*x)^5+-1//4*a*b^-2*(a+b*x)^4)
@test integrate((a+b*x)^3, x) == :(1//4*b^-1*(a+b*x)^4)
@test integrate(x^-1*(a+b*x)^3, x) == :(a^3*log(x)+1//3*b^3*x^3+3*b*x*a^2+3//2*a*b^2*x^2)
@test integrate(x^-2*(a+b*x)^3, x) == :((1/2)*b^3*x^2+-1*a^3*x^-1+3*a*x*b^2+3*b*a^2*log(x))
@test integrate(x^-3*(a+b*x)^3, x) == :(x*b^3+-1//2*a^3*x^-2+-3*b*a^2*x^-1+3*a*b^2*log(x))
@test integrate(x^-4*(a+b*x)^3, x) == :(b^3*log(x)+-1//3*a^3*x^-3+-3*a*b^2*x^-1+-3//2*b*a^2*x^-2)
@test integrate(x^-5*(a+b*x)^3, x) == :(-1//4*a^-1*x^-4*(a+b*x)^4)
@test integrate(x^-6*(a+b*x)^3, x) == :(-1//5*a^-1*x^-5*(a+b*x)^4+1//20*b*a^-2*x^-4*(a+b*x)^4)
@test integrate(x^-7*(a+b*x)^3, x) == :(-1//3*b^3*x^-3+-1//6*a^3*x^-6+-3//4*a*b^2*x^-4+-3//5*b*a^2*x^-5)
@test integrate(x^-8*(a+b*x)^3, x) == :(-1//4*b^3*x^-4+-1//7*a^3*x^-7+-3//5*a*b^2*x^-5+-1//2*b*a^2*x^-6)
@test integrate(x^6*(a+b*x)^5, x) == :(1//7*a^5*x^7+1//12*b^5*x^12+a^2*b^3*x^10+5//8*b*a^4*x^8+5//11*a*b^4*x^11+10//9*a^3*b^2*x^9)
@test integrate(x^5*(a+b*x)^5, x) == :(1//6*a^5*x^6+1//11*b^5*x^11+(1/2)*a*b^4*x^10+5//4*a^3*b^2*x^8+5//7*b*a^4*x^7+10//9*a^2*b^3*x^9)
@test integrate(x^4*(a+b*x)^5, x) == :(1//5*a^5*x^5+1//10*b^5*x^10+5//4*a^2*b^3*x^8+5//6*b*a^4*x^6+5//9*a*b^4*x^9+10//7*a^3*b^2*x^7)
@test integrate(x^3*(a+b*x)^5, x) == :(1//9*b^-4*(a+b*x)^9+-3//8*a*b^-4*(a+b*x)^8+-1//6*a^3*b^-4*(a+b*x)^6+3//7*a^2*b^-4*(a+b*x)^7)
@test integrate(x^2*(a+b*x)^5, x) == :(1//8*b^-3*(a+b*x)^8+-2//7*a*b^-3*(a+b*x)^7+1//6*a^2*b^-3*(a+b*x)^6)
@test integrate(x*(a+b*x)^5, x) == :(1//7*b^-2*(a+b*x)^7+-1//6*a*b^-2*(a+b*x)^6)
@test integrate((a+b*x)^5, x) == :(1//6*b^-1*(a+b*x)^6)
@test integrate(x^-1*(a+b*x)^5, x) == :(a^5*log(x)+1//5*b^5*x^5+5*b*x*a^4+5*a^3*b^2*x^2+5//4*a*b^4*x^4+10//3*a^2*b^3*x^3)
@test integrate(x^-2*(a+b*x)^5, x) == :(-1*a^5*x^-1+1//4*b^5*x^4+5*b*a^4*log(x)+5*a^2*b^3*x^2+10*x*a^3*b^2+5//3*a*b^4*x^3)
@test integrate(x^-3*(a+b*x)^5, x) == :(-1//2*a^5*x^-2+1//3*b^5*x^3+-5*b*a^4*x^-1+10*x*a^2*b^3+10*a^3*b^2*log(x)+5//2*a*b^4*x^2)
@test integrate(x^-4*(a+b*x)^5, x) == :((1/2)*b^5*x^2+-1//3*a^5*x^-3+-10*a^3*b^2*x^-1+5*a*x*b^4+10*a^2*b^3*log(x)+-5//2*b*a^4*x^-2)
@test integrate(x^-5*(a+b*x)^5, x) == :(x*b^5+-1//4*a^5*x^-4+-10*a^2*b^3*x^-1+-5*a^3*b^2*x^-2+5*a*b^4*log(x)+-5//3*b*a^4*x^-3)
@test integrate(x^-6*(a+b*x)^5, x) == :(b^5*log(x)+-1//5*a^5*x^-5+-5*a*b^4*x^-1+-5*a^2*b^3*x^-2+-10//3*a^3*b^2*x^-3+-5//4*b*a^4*x^-4)
@test integrate(x^-7*(a+b*x)^5, x) == :(-1//6*a^-1*x^-6*(a+b*x)^6)
@test integrate(x^-8*(a+b*x)^5, x) == :(-1//7*a^-1*x^-7*(a+b*x)^6+1//42*b*a^-2*x^-6*(a+b*x)^6)
@test integrate(x^-9*(a+b*x)^5, x) == :(-1//8*a^-1*x^-8*(a+b*x)^6+-1//168*a^-3*b^2*x^-6*(a+b*x)^6+1//28*b*a^-2*x^-7*(a+b*x)^6)
@test integrate(x^-10*(a+b*x)^5, x) == :(-1//4*b^5*x^-4+-1//9*a^5*x^-9+-1*a*b^4*x^-5+-10//7*a^3*b^2*x^-7+-5//3*a^2*b^3*x^-6+-5//8*b*a^4*x^-8)
@test integrate(x^-11*(a+b*x)^5, x) == :(-1//5*b^5*x^-5+-1//10*a^5*x^-10+-10//7*a^2*b^3*x^-7+-5//4*a^3*b^2*x^-8+-5//6*a*b^4*x^-6+-5//9*b*a^4*x^-9)
@test integrate(x^-12*(a+b*x)^5, x) == :(-1//6*b^5*x^-6+-1//11*a^5*x^-11+-10//9*a^3*b^2*x^-9+-5//4*a^2*b^3*x^-8+-5//7*a*b^4*x^-7+-1//2*b*a^4*x^-10)
@test integrate(x^-13*(a+b*x)^5, x) == :(-1//7*b^5*x^-7+-1//12*a^5*x^-12+-1*a^3*b^2*x^-10+-10//9*a^2*b^3*x^-9+-5//8*a*b^4*x^-8+-5//11*b*a^4*x^-11)
@test integrate(x^-14*(a+b*x)^5, x) == :(-1//8*b^5*x^-8+-1//13*a^5*x^-13+-1*a^2*b^3*x^-10+-10//11*a^3*b^2*x^-11+-5//9*a*b^4*x^-9+-5//12*b*a^4*x^-12)
@test integrate(x^8*(a+b*x)^7, x) == :(1//9*a^7*x^9+1//16*b^7*x^16+3//2*a^2*b^5*x^14+7//10*b*a^6*x^10+7//15*a*b^6*x^15+21//11*a^5*b^2*x^11+35//12*a^4*b^3*x^12+35//13*a^3*b^4*x^13)
@test integrate(x^7*(a+b*x)^7, x) == :(1//8*a^7*x^8+1//15*b^7*x^15+(1/2)*a*b^6*x^14+7//9*b*a^6*x^9+21//10*a^5*b^2*x^10+21//13*a^2*b^5*x^13+35//11*a^4*b^3*x^11+35//12*a^3*b^4*x^12)
@test integrate(x^6*(a+b*x)^7, x) == :(1//7*a^7*x^7+1//14*b^7*x^14+7//2*a^4*b^3*x^10+7//3*a^5*b^2*x^9+7//4*a^2*b^5*x^12+7//8*b*a^6*x^8+7//13*a*b^6*x^13+35//11*a^3*b^4*x^11)
@test integrate(x^5*(a+b*x)^7, x) == :(1//13*b^-6*(a+b*x)^13+-1*a^3*b^-6*(a+b*x)^10+-5//12*a*b^-6*(a+b*x)^12+-1//8*a^5*b^-6*(a+b*x)^8+5//9*a^4*b^-6*(a+b*x)^9+10//11*a^2*b^-6*(a+b*x)^11)
@test integrate(x^4*(a+b*x)^7, x) == :(1//12*b^-5*(a+b*x)^12+-4//9*a^3*b^-5*(a+b*x)^9+-4//11*a*b^-5*(a+b*x)^11+1//8*a^4*b^-5*(a+b*x)^8+3//5*a^2*b^-5*(a+b*x)^10)
@test integrate(x^3*(a+b*x)^7, x) == :(1//11*b^-4*(a+b*x)^11+-3//10*a*b^-4*(a+b*x)^10+-1//8*a^3*b^-4*(a+b*x)^8+1//3*a^2*b^-4*(a+b*x)^9)
@test integrate(x^2*(a+b*x)^7, x) == :(1//10*b^-3*(a+b*x)^10+-2//9*a*b^-3*(a+b*x)^9+1//8*a^2*b^-3*(a+b*x)^8)
@test integrate(x*(a+b*x)^7, x) == :(1//9*b^-2*(a+b*x)^9+-1//8*a*b^-2*(a+b*x)^8)
@test integrate((a+b*x)^7, x) == :(1//8*b^-1*(a+b*x)^8)
@test integrate(x^-1*(a+b*x)^7, x) == :(a^7*log(x)+1//7*b^7*x^7+7*b*x*a^6+7//6*a*b^6*x^6+21//2*a^5*b^2*x^2+21//5*a^2*b^5*x^5+35//3*a^4*b^3*x^3+35//4*a^3*b^4*x^4)
@test integrate(x^-2*(a+b*x)^7, x) == :(-1*a^7*x^-1+1//6*b^7*x^6+7*b*a^6*log(x)+21*x*a^5*b^2+7//5*a*b^6*x^5+21//4*a^2*b^5*x^4+35//2*a^4*b^3*x^2+35//3*a^3*b^4*x^3)
@test integrate(x^-3*(a+b*x)^7, x) == :(-1//2*a^7*x^-2+1//5*b^7*x^5+-7*b*a^6*x^-1+7*a^2*b^5*x^3+21*a^5*b^2*log(x)+35*x*a^4*b^3+7//4*a*b^6*x^4+35//2*a^3*b^4*x^2)
@test integrate(x^-4*(a+b*x)^7, x) == :(-1//3*a^7*x^-3+1//4*b^7*x^4+-21*a^5*b^2*x^-1+35*x*a^3*b^4+35*a^4*b^3*log(x)+-7//2*b*a^6*x^-2+7//3*a*b^6*x^3+21//2*a^2*b^5*x^2)
@test integrate(x^-5*(a+b*x)^7, x) == :(-1//4*a^7*x^-4+1//3*b^7*x^3+-35*a^4*b^3*x^-1+21*x*a^2*b^5+35*a^3*b^4*log(x)+-21//2*a^5*b^2*x^-2+-7//3*b*a^6*x^-3+7//2*a*b^6*x^2)
@test integrate(x^-6*(a+b*x)^7, x) == :((1/2)*b^7*x^2+-1//5*a^7*x^-5+-35*a^3*b^4*x^-1+-7*a^5*b^2*x^-3+7*a*x*b^6+21*a^2*b^5*log(x)+-35//2*a^4*b^3*x^-2+-7//4*b*a^6*x^-4)
@test integrate(x^-7*(a+b*x)^7, x) == :(x*b^7+-1//6*a^7*x^-6+-21*a^2*b^5*x^-1+7*a*b^6*log(x)+-35//2*a^3*b^4*x^-2+-35//3*a^4*b^3*x^-3+-21//4*a^5*b^2*x^-4+-7//5*b*a^6*x^-5)
@test integrate(x^-8*(a+b*x)^7, x) == :(b^7*log(x)+-1//7*a^7*x^-7+-7*a*b^6*x^-1+-35//3*a^3*b^4*x^-3+-35//4*a^4*b^3*x^-4+-21//2*a^2*b^5*x^-2+-21//5*a^5*b^2*x^-5+-7//6*b*a^6*x^-6)
@test integrate(x^-9*(a+b*x)^7, x) == :(-1//8*a^-1*x^-8*(a+b*x)^8)
@test integrate(x^-10*(a+b*x)^7, x) == :(-1//9*a^-1*x^-9*(a+b*x)^8+1//72*b*a^-2*x^-8*(a+b*x)^8)
@test integrate(x^-11*(a+b*x)^7, x) == :(-1//10*a^-1*x^-10*(a+b*x)^8+-1//360*a^-3*b^2*x^-8*(a+b*x)^8+1//45*b*a^-2*x^-9*(a+b*x)^8)
@test integrate(x^-12*(a+b*x)^7, x) == :(-1//11*a^-1*x^-11*(a+b*x)^8+-1//165*a^-3*b^2*x^-9*(a+b*x)^8+1//1320*a^-4*b^3*x^-8*(a+b*x)^8+3//110*b*a^-2*x^-10*(a+b*x)^8)
@test integrate(x^-13*(a+b*x)^7, x) == :(-1//12*a^-1*x^-12*(a+b*x)^8+-1//110*a^-3*b^2*x^-10*(a+b*x)^8+-1//3960*a^-5*b^4*x^-8*(a+b*x)^8+1//33*b*a^-2*x^-11*(a+b*x)^8+1//495*a^-4*b^3*x^-9*(a+b*x)^8)
@test integrate(x^-14*(a+b*x)^7, x) == :(-1//6*b^7*x^-6+-1//13*a^7*x^-13+-1*a*b^6*x^-7+-35//9*a^3*b^4*x^-9+-21//8*a^2*b^5*x^-8+-21//11*a^5*b^2*x^-11+-7//2*a^4*b^3*x^-10+-7//12*b*a^6*x^-12)
@test integrate(x^-15*(a+b*x)^7, x) == :(-1//7*b^7*x^-7+-1//14*a^7*x^-14+-35//11*a^4*b^3*x^-11+-7//2*a^3*b^4*x^-10+-7//3*a^2*b^5*x^-9+-7//4*a^5*b^2*x^-12+-7//8*a*b^6*x^-8+-7//13*b*a^6*x^-13)
@test integrate(x^-16*(a+b*x)^7, x) == :(-1//8*b^7*x^-8+-1//15*a^7*x^-15+-35//11*a^3*b^4*x^-11+-35//12*a^4*b^3*x^-12+-21//10*a^2*b^5*x^-10+-21//13*a^5*b^2*x^-13+-7//9*a*b^6*x^-9+-1//2*b*a^6*x^-14)
@test integrate(x^11*(a+b*x)^10, x) == :(1//12*a^10*x^12+1//22*b^10*x^22+8*a^7*b^3*x^15+9//4*a^2*b^8*x^20+10//13*b*a^9*x^13+10//21*a*b^9*x^21+35//3*a^4*b^6*x^18+45//14*a^8*b^2*x^14+105//8*a^6*b^4*x^16+120//19*a^3*b^7*x^19+252//17*a^5*b^5*x^17)
@test integrate(x^10*(a+b*x)^10, x) == :(1//11*a^10*x^11+1//21*b^10*x^21+(1/2)*a*b^9*x^20+14*a^6*b^4*x^15+5//6*b*a^9*x^12+20//3*a^3*b^7*x^18+45//13*a^8*b^2*x^13+45//19*a^2*b^8*x^19+60//7*a^7*b^3*x^14+63//4*a^5*b^5*x^16+210//17*a^4*b^6*x^17)
@test integrate(x^9*(a+b*x)^10, x) == :(1//10*a^10*x^10+1//20*b^10*x^20+15*a^6*b^4*x^14+5//2*a^2*b^8*x^18+10//11*b*a^9*x^11+10//19*a*b^9*x^19+15//4*a^8*b^2*x^12+84//5*a^5*b^5*x^15+105//8*a^4*b^6*x^16+120//13*a^7*b^3*x^13+120//17*a^3*b^7*x^17)
@test integrate(x^8*(a+b*x)^10, x) == :(1//19*b^-9*(a+b*x)^19+-4*a^5*b^-9*(a+b*x)^14+-7//2*a^3*b^-9*(a+b*x)^16+-4//9*a*b^-9*(a+b*x)^18+-2//3*a^7*b^-9*(a+b*x)^12+1//11*a^8*b^-9*(a+b*x)^11+14//3*a^4*b^-9*(a+b*x)^15+28//13*a^6*b^-9*(a+b*x)^13+28//17*a^2*b^-9*(a+b*x)^17)
@test integrate(x^7*(a+b*x)^10, x) == :(1//18*b^-8*(a+b*x)^18+-21//13*a^5*b^-8*(a+b*x)^13+-7//3*a^3*b^-8*(a+b*x)^15+-7//17*a*b^-8*(a+b*x)^17+-1//11*a^7*b^-8*(a+b*x)^11+5//2*a^4*b^-8*(a+b*x)^14+7//12*a^6*b^-8*(a+b*x)^12+21//16*a^2*b^-8*(a+b*x)^16)
@test integrate(x^6*(a+b*x)^10, x) == :(1//17*b^-7*(a+b*x)^17+a^2*b^-7*(a+b*x)^15+-10//7*a^3*b^-7*(a+b*x)^14+-3//8*a*b^-7*(a+b*x)^16+-1//2*a^5*b^-7*(a+b*x)^12+1//11*a^6*b^-7*(a+b*x)^11+15//13*a^4*b^-7*(a+b*x)^13)
@test integrate(x^5*(a+b*x)^10, x) == :(1//16*b^-6*(a+b*x)^16+-10//13*a^3*b^-6*(a+b*x)^13+-1//3*a*b^-6*(a+b*x)^15+-1//11*a^5*b^-6*(a+b*x)^11+5//7*a^2*b^-6*(a+b*x)^14+5//12*a^4*b^-6*(a+b*x)^12)
@test integrate(x^4*(a+b*x)^10, x) == :(1//15*b^-5*(a+b*x)^15+-2//7*a*b^-5*(a+b*x)^14+-1//3*a^3*b^-5*(a+b*x)^12+1//11*a^4*b^-5*(a+b*x)^11+6//13*a^2*b^-5*(a+b*x)^13)
@test integrate(x^3*(a+b*x)^10, x) == :(1//14*b^-4*(a+b*x)^14+-3//13*a*b^-4*(a+b*x)^13+-1//11*a^3*b^-4*(a+b*x)^11+1//4*a^2*b^-4*(a+b*x)^12)
@test integrate(x^2*(a+b*x)^10, x) == :(1//13*b^-3*(a+b*x)^13+-1//6*a*b^-3*(a+b*x)^12+1//11*a^2*b^-3*(a+b*x)^11)
@test integrate(x*(a+b*x)^10, x) == :(1//12*b^-2*(a+b*x)^12+-1//11*a*b^-2*(a+b*x)^11)
@test integrate((a+b*x)^10, x) == :(1//11*b^-1*(a+b*x)^11)
@test integrate(x^-1*(a+b*x)^10, x) == :(a^10*log(x)+1//10*b^10*x^10+10*b*x*a^9+35*a^4*b^6*x^6+40*a^7*b^3*x^3+10//9*a*b^9*x^9+45//2*a^8*b^2*x^2+45//8*a^2*b^8*x^8+105//2*a^6*b^4*x^4+120//7*a^3*b^7*x^7+252//5*a^5*b^5*x^5)
@test integrate(x^-2*(a+b*x)^10, x) == :(-1*a^10*x^-1+1//9*b^10*x^9+10*b*a^9*log(x)+20*a^3*b^7*x^6+42*a^4*b^6*x^5+45*x*a^8*b^2+60*a^7*b^3*x^2+63*a^5*b^5*x^4+70*a^6*b^4*x^3+5//4*a*b^9*x^8+45//7*a^2*b^8*x^7)
@test integrate(x^-3*(a+b*x)^10, x) == :(-1//2*a^10*x^-2+1//8*b^10*x^8+-10*b*a^9*x^-1+24*a^3*b^7*x^5+45*a^8*b^2*log(x)+84*a^5*b^5*x^3+105*a^6*b^4*x^2+120*x*a^7*b^3+10//7*a*b^9*x^7+15//2*a^2*b^8*x^6+105//2*a^4*b^6*x^4)
@test integrate(x^-4*(a+b*x)^10, x) == :(-1//3*a^10*x^-3+1//7*b^10*x^7+-45*a^8*b^2*x^-1+-5*b*a^9*x^-2+9*a^2*b^8*x^5+30*a^3*b^7*x^4+70*a^4*b^6*x^3+120*a^7*b^3*log(x)+126*a^5*b^5*x^2+210*x*a^6*b^4+5//3*a*b^9*x^6)
@test integrate(x^-5*(a+b*x)^10, x) == :(-1//4*a^10*x^-4+1//6*b^10*x^6+-120*a^7*b^3*x^-1+2*a*b^9*x^5+40*a^3*b^7*x^3+105*a^4*b^6*x^2+210*a^6*b^4*log(x)+252*x*a^5*b^5+-45//2*a^8*b^2*x^-2+-10//3*b*a^9*x^-3+45//4*a^2*b^8*x^4)
@test integrate(x^-6*(a+b*x)^10, x) == :(-1//5*a^10*x^-5+1//5*b^10*x^5+-210*a^6*b^4*x^-1+-60*a^7*b^3*x^-2+-15*a^8*b^2*x^-3+15*a^2*b^8*x^3+60*a^3*b^7*x^2+210*x*a^4*b^6+252*a^5*b^5*log(x)+-5//2*b*a^9*x^-4+5//2*a*b^9*x^4)
@test integrate(x^-7*(a+b*x)^10, x) == :(-1//6*a^10*x^-6+1//4*b^10*x^4+-252*a^5*b^5*x^-1+-105*a^6*b^4*x^-2+-40*a^7*b^3*x^-3+-2*b*a^9*x^-5+120*x*a^3*b^7+210*a^4*b^6*log(x)+-45//4*a^8*b^2*x^-4+10//3*a*b^9*x^3+45//2*a^2*b^8*x^2)
@test integrate(x^-8*(a+b*x)^10, x) == :(-1//7*a^10*x^-7+1//3*b^10*x^3+-210*a^4*b^6*x^-1+-126*a^5*b^5*x^-2+-70*a^6*b^4*x^-3+-30*a^7*b^3*x^-4+-9*a^8*b^2*x^-5+5*a*b^9*x^2+45*x*a^2*b^8+120*a^3*b^7*log(x)+-5//3*b*a^9*x^-6)
@test integrate(x^-9*(a+b*x)^10, x) == :((1/2)*b^10*x^2+-1//8*a^10*x^-8+-120*a^3*b^7*x^-1+-105*a^4*b^6*x^-2+-84*a^5*b^5*x^-3+-24*a^7*b^3*x^-5+10*a*x*b^9+45*a^2*b^8*log(x)+-105//2*a^6*b^4*x^-4+-15//2*a^8*b^2*x^-6+-10//7*b*a^9*x^-7)
@test integrate(x^-10*(a+b*x)^10, x) == :(x*b^10+-1//9*a^10*x^-9+-70*a^4*b^6*x^-3+-63*a^5*b^5*x^-4+-60*a^3*b^7*x^-2+-45*a^2*b^8*x^-1+-42*a^6*b^4*x^-5+-20*a^7*b^3*x^-6+10*a*b^9*log(x)+-45//7*a^8*b^2*x^-7+-5//4*b*a^9*x^-8)
@test integrate(x^-11*(a+b*x)^10, x) == :(b^10*log(x)+-1//10*a^10*x^-10+-40*a^3*b^7*x^-3+-35*a^6*b^4*x^-6+-10*a*b^9*x^-1+-252//5*a^5*b^5*x^-5+-120//7*a^7*b^3*x^-7+-105//2*a^4*b^6*x^-4+-45//2*a^2*b^8*x^-2+-45//8*a^8*b^2*x^-8+-10//9*b*a^9*x^-9)
@test integrate(x^-12*(a+b*x)^10, x) == :(-1//11*a^-1*x^-11*(a+b*x)^11)
@test integrate(x^-13*(a+b*x)^10, x) == :(-1//12*a^-1*x^-12*(a+b*x)^11+1//132*b*a^-2*x^-11*(a+b*x)^11)
@test integrate(x^-14*(a+b*x)^10, x) == :(-1//13*a^-1*x^-13*(a+b*x)^11+-1//858*a^-3*b^2*x^-11*(a+b*x)^11+1//78*b*a^-2*x^-12*(a+b*x)^11)
@test integrate(x^-15*(a+b*x)^10, x) == :(-1//14*a^-1*x^-14*(a+b*x)^11+-1//364*a^-3*b^2*x^-12*(a+b*x)^11+1//4004*a^-4*b^3*x^-11*(a+b*x)^11+3//182*b*a^-2*x^-13*(a+b*x)^11)
@test integrate(x^-16*(a+b*x)^10, x) == :(-1//15*a^-1*x^-15*(a+b*x)^11+-2//455*a^-3*b^2*x^-13*(a+b*x)^11+-1//15015*a^-5*b^4*x^-11*(a+b*x)^11+1//1365*a^-4*b^3*x^-12*(a+b*x)^11+2//105*b*a^-2*x^-14*(a+b*x)^11)
@test integrate(x^-17*(a+b*x)^10, x) == :(-1//16*a^-1*x^-16*(a+b*x)^11+-1//168*a^-3*b^2*x^-14*(a+b*x)^11+-1//4368*a^-5*b^4*x^-12*(a+b*x)^11+1//48*b*a^-2*x^-15*(a+b*x)^11+1//728*a^-4*b^3*x^-13*(a+b*x)^11+1//48048*a^-6*b^5*x^-11*(a+b*x)^11)
@test integrate(x^-18*(a+b*x)^10, x) == :(-1//17*a^-1*x^-17*(a+b*x)^11+-3//6188*a^-5*b^4*x^-13*(a+b*x)^11+-1//136*a^-3*b^2*x^-15*(a+b*x)^11+-1//136136*a^-7*b^6*x^-11*(a+b*x)^11+1//476*a^-4*b^3*x^-14*(a+b*x)^11+1//12376*a^-6*b^5*x^-12*(a+b*x)^11+3//136*b*a^-2*x^-16*(a+b*x)^11)
@test integrate(x^-19*(a+b*x)^10, x) == :(-1//8*b^10*x^-8+-1//18*a^10*x^-18+-15*a^6*b^4*x^-14+-8*a^7*b^3*x^-15+-252//13*a^5*b^5*x^-13+-120//11*a^3*b^7*x^-11+-45//16*a^8*b^2*x^-16+-35//2*a^4*b^6*x^-12+-10//9*a*b^9*x^-9+-10//17*b*a^9*x^-17+-9//2*a^2*b^8*x^-10)
@test integrate(x^-20*(a+b*x)^10, x) == :(-1//9*b^10*x^-9+-1//19*a^10*x^-19+-1*a*b^9*x^-10+-18*a^5*b^5*x^-14+-14*a^6*b^4*x^-15+-10*a^3*b^7*x^-12+-210//13*a^4*b^6*x^-13+-45//11*a^2*b^8*x^-11+-45//17*a^8*b^2*x^-17+-15//2*a^7*b^3*x^-16+-5//9*b*a^9*x^-18)
@test integrate(x^-32*(a+b*x)^20, x) == :(-1//31*a^-1*x^-31*(a+b*x)^21+-3//899*a^-3*b^2*x^-29*(a+b*x)^21+-2//8091*a^-5*b^4*x^-27*(a+b*x)^21+-2//175305*a^-7*b^6*x^-25*(a+b*x)^21+-1//4032015*a^-9*b^8*x^-23*(a+b*x)^21+-1//931395465*a^-11*b^10*x^-21*(a+b*x)^21+1//93*b*a^-2*x^-30*(a+b*x)^21+1//525915*a^-8*b^7*x^-24*(a+b*x)^21+1//44352165*a^-10*b^9*x^-22*(a+b*x)^21+2//35061*a^-6*b^5*x^-26*(a+b*x)^21+6//6293*a^-4*b^3*x^-28*(a+b*x)^21)
@test integrate(x^-33*(a+b*x)^20, x) == :(-1//32*a^-1*x^-32*(a+b*x)^21+-33//100688*a^-5*b^4*x^-28*(a+b*x)^21+-11//2976*a^-3*b^2*x^-30*(a+b*x)^21+-11//560976*a^-7*b^6*x^-26*(a+b*x)^21+-11//16829280*a^-9*b^8*x^-24*(a+b*x)^21+-1//129024480*a^-11*b^10*x^-22*(a+b*x)^21+1//2709514080*a^-12*b^11*x^-21*(a+b*x)^21+11//992*b*a^-2*x^-31*(a+b*x)^21+11//129456*a^-6*b^5*x^-27*(a+b*x)^21+11//2804880*a^-8*b^7*x^-25*(a+b*x)^21+11//129024480*a^-10*b^9*x^-23*(a+b*x)^21+33//28768*a^-4*b^3*x^-29*(a+b*x)^21)
@test integrate(x^-34*(a+b*x)^20, x) == :(-1//33*a^-1*x^-33*(a+b*x)^21+-3//7192*a^-5*b^4*x^-29*(a+b*x)^21+-1//248*a^-3*b^2*x^-31*(a+b*x)^21+-1//32364*a^-7*b^6*x^-27*(a+b*x)^21+-1//701220*a^-9*b^8*x^-25*(a+b*x)^21+-1//32256120*a^-11*b^10*x^-23*(a+b*x)^21+-1//7451163720*a^-13*b^12*x^-21*(a+b*x)^21+1//88*b*a^-2*x^-32*(a+b*x)^21+1//744*a^-4*b^3*x^-30*(a+b*x)^21+1//140244*a^-8*b^7*x^-26*(a+b*x)^21+1//4207320*a^-10*b^9*x^-24*(a+b*x)^21+1//354817320*a^-12*b^11*x^-22*(a+b*x)^21+3//25172*a^-6*b^5*x^-28*(a+b*x)^21)
@test integrate(x^-35*(a+b*x)^20, x) == :(-1//14*b^20*x^-14+-1//34*a^20*x^-34+-4845*a^12*b^8*x^-26+-1938*a^6*b^14*x^-20+-816*a^5*b^15*x^-19+-167960//23*a^9*b^11*x^-23+-62985//11*a^8*b^12*x^-22+-46189//6*a^10*b^10*x^-24+-33592//5*a^11*b^9*x^-25+-25840//7*a^7*b^13*x^-21+-25840//9*a^13*b^7*x^-27+-15504//29*a^15*b^5*x^-29+-9690//7*a^14*b^6*x^-28+-1615//6*a^4*b^16*x^-18+-1140//17*a^3*b^17*x^-17+-1140//31*a^17*b^3*x^-31+-323//2*a^16*b^4*x^-30+-95//8*a^2*b^18*x^-16+-95//16*a^18*b^2*x^-32+-20//33*b*a^19*x^-33+-4//3*a*b^19*x^-15)
@test integrate(x^-36*(a+b*x)^20, x) == :(-1//15*b^20*x^-15+-1//35*a^20*x^-35+-6460*a^11*b^9*x^-26+-255*a^4*b^16*x^-19+-184756//25*a^10*b^10*x^-25+-125970//23*a^8*b^12*x^-23+-41990//9*a^12*b^8*x^-27+-38760//11*a^7*b^13*x^-22+-38760//29*a^14*b^6*x^-29+-20995//3*a^9*b^11*x^-24+-19380//7*a^13*b^7*x^-28+-12920//7*a^6*b^14*x^-21+-4845//31*a^16*b^4*x^-31+-3876//5*a^5*b^15*x^-20+-2584//5*a^15*b^5*x^-30+-285//8*a^17*b^3*x^-32+-190//3*a^3*b^17*x^-18+-190//17*a^2*b^18*x^-17+-190//33*a^18*b^2*x^-33+-10//17*b*a^19*x^-34+-5//4*a*b^19*x^-16)
@test integrate(x^-37*(a+b*x)^20, x) == :(-1//16*b^20*x^-16+-1//36*a^20*x^-36+-7106*a^10*b^10*x^-26+-1292*a^14*b^6*x^-30+-60*a^3*b^17*x^-19+-167960//27*a^11*b^9*x^-27+-77520//23*a^7*b^13*x^-23+-77520//29*a^13*b^7*x^-29+-62985//14*a^12*b^8*x^-28+-33592//5*a^9*b^11*x^-25+-20995//4*a^8*b^12*x^-24+-19380//11*a^6*b^14*x^-22+-15504//31*a^15*b^5*x^-31+-5168//7*a^5*b^15*x^-21+-4845//32*a^16*b^4*x^-32+-969//4*a^4*b^16*x^-20+-380//11*a^17*b^3*x^-33+-95//9*a^2*b^18*x^-18+-95//17*a^18*b^2*x^-34+-20//17*a*b^19*x^-17+-4//7*b*a^19*x^-35)
@test integrate(c*(a+b*x), x) == :((1/2)*c*b^-1*(a+b*x)^2)
@test integrate(e^-1*(a+b*x)*(c+d), x) == :((1/2)*b^-1*e^-1*(a+b*x)^2*(c+d))
@test integrate(x^5*(a+b*x)^-1, x) == :(1//5*b^-1*x^5+x*a^4*b^-5+-1*a^5*b^-6*log(a+b*x)+-1//2*a^3*b^-4*x^2+-1//4*a*b^-2*x^4+1//3*a^2*b^-3*x^3)
@test integrate(x^4*(a+b*x)^-1, x) == :(1//4*b^-1*x^4+a^4*b^-5*log(a+b*x)+(1/2)*a^2*b^-3*x^2+-1*x*a^3*b^-4+-1//3*a*b^-2*x^3)
@test integrate(x^3*(a+b*x)^-1, x) == :(1//3*b^-1*x^3+x*a^2*b^-3+-1*a^3*b^-4*log(a+b*x)+-1//2*a*b^-2*x^2)
@test integrate(x^2*(a+b*x)^-1, x) == :((1/2)*b^-1*x^2+a^2*b^-3*log(a+b*x)+-1*a*x*b^-2)
@test integrate(x*(a+b*x)^-1, x) == :(x*b^-1+-1*a*b^-2*log(a+b*x))
@test integrate((a+b*x)^-1, x) == :(b^-1*log(a+b*x))
@test integrate(x^-1*(a+b*x)^-1, x) == :(a^-1*log(x)+-1*a^-1*log(a+b*x))
@test integrate(x^-2*(a+b*x)^-1, x) == :(-1*a^-1*x^-1+b*a^-2*log(a+b*x)+-1*b*a^-2*log(x))
@test integrate(x^-3*(a+b*x)^-1, x) == :(-1//2*a^-1*x^-2+b*a^-2*x^-1+a^-3*b^2*log(x)+-1*a^-3*b^2*log(a+b*x))
@test integrate(x^-4*(a+b*x)^-1, x) == :(-1//3*a^-1*x^-3+a^-4*b^3*log(a+b*x)+(1/2)*b*a^-2*x^-2+-1*a^-4*b^3*log(x)+-1*a^-3*b^2*x^-1)
@test integrate(x^-5*(a+b*x)^-1, x) == :(-1//4*a^-1*x^-4+a^-5*b^4*log(x)+a^-4*b^3*x^-1+-1*a^-5*b^4*log(a+b*x)+-1//2*a^-3*b^2*x^-2+1//3*b*a^-2*x^-3)
@test integrate(x^6*(a+b*x)^-2, x) == :(1//5*b^-2*x^5+a^2*b^-4*x^3+-1*a^6*b^-7*(a+b*x)^-1+-6*a^5*b^-7*log(a+b*x)+-2*a^3*b^-5*x^2+5*x*a^4*b^-6+-1//2*a*b^-3*x^4)
@test integrate(x^5*(a+b*x)^-2, x) == :(1//4*b^-2*x^4+a^5*b^-6*(a+b*x)^-1+-4*x*a^3*b^-5+5*a^4*b^-6*log(a+b*x)+-2//3*a*b^-3*x^3+3//2*a^2*b^-4*x^2)
@test integrate(x^4*(a+b*x)^-2, x) == :(1//3*b^-2*x^3+-1*a*b^-3*x^2+-1*a^4*b^-5*(a+b*x)^-1+-4*a^3*b^-5*log(a+b*x)+3*x*a^2*b^-4)
@test integrate(x^3*(a+b*x)^-2, x) == :((1/2)*b^-2*x^2+a^3*b^-4*(a+b*x)^-1+-2*a*x*b^-3+3*a^2*b^-4*log(a+b*x))
@test integrate(x^2*(a+b*x)^-2, x) == :(x*b^-2+-1*a^2*b^-3*(a+b*x)^-1+-2*a*b^-3*log(a+b*x))
@test integrate(x*(a+b*x)^-2, x) == :(b^-2*log(a+b*x)+a*b^-2*(a+b*x)^-1)
@test integrate((a+b*x)^-2, x) == :(-1*b^-1*(a+b*x)^-1)
@test integrate(x^-1*(a+b*x)^-2, x) == :(a^-1*(a+b*x)^-1+a^-2*log(x)+-1*a^-2*log(a+b*x))
@test integrate(x^-2*(a+b*x)^-2, x) == :(-1*a^-2*x^-1+-1*b*a^-2*(a+b*x)^-1+-2*b*a^-3*log(x)+2*b*a^-3*log(a+b*x))
@test integrate(x^-3*(a+b*x)^-2, x) == :(-1//2*a^-2*x^-2+a^-3*b^2*(a+b*x)^-1+-3*a^-4*b^2*log(a+b*x)+2*b*a^-3*x^-1+3*a^-4*b^2*log(x))
@test integrate(x^-4*(a+b*x)^-2, x) == :(-1//3*a^-2*x^-3+b*a^-3*x^-2+-1*a^-4*b^3*(a+b*x)^-1+-4*a^-5*b^3*log(x)+-3*a^-4*b^2*x^-1+4*a^-5*b^3*log(a+b*x))
@test integrate(x^-5*(a+b*x)^-2, x) == :(-1//4*a^-2*x^-4+a^-5*b^4*(a+b*x)^-1+-5*a^-6*b^4*log(a+b*x)+4*a^-5*b^3*x^-1+5*a^-6*b^4*log(x)+-3//2*a^-4*b^2*x^-2+2//3*b*a^-3*x^-3)
@test integrate(x^7*(a+b*x)^-3, x) == :(1//5*b^-3*x^5+(1/2)*a^7*b^-8*(a+b*x)^-2+-21*a^5*b^-8*log(a+b*x)+-7*a^6*b^-8*(a+b*x)^-1+-5*a^3*b^-6*x^2+2*a^2*b^-5*x^3+15*x*a^4*b^-7+-3//4*a*b^-4*x^4)
@test integrate(x^6*(a+b*x)^-3, x) == :(1//4*b^-3*x^4+-1*a*b^-4*x^3+-10*x*a^3*b^-6+3*a^2*b^-5*x^2+6*a^5*b^-7*(a+b*x)^-1+15*a^4*b^-7*log(a+b*x)+-1//2*a^6*b^-7*(a+b*x)^-2)
@test integrate(x^5*(a+b*x)^-3, x) == :(1//3*b^-3*x^3+(1/2)*a^5*b^-6*(a+b*x)^-2+-10*a^3*b^-6*log(a+b*x)+-5*a^4*b^-6*(a+b*x)^-1+6*x*a^2*b^-5+-3//2*a*b^-4*x^2)
@test integrate(x^4*(a+b*x)^-3, x) == :((1/2)*b^-3*x^2+-3*a*x*b^-4+4*a^3*b^-5*(a+b*x)^-1+6*a^2*b^-5*log(a+b*x)+-1//2*a^4*b^-5*(a+b*x)^-2)
@test integrate(x^3*(a+b*x)^-3, x) == :(x*b^-3+(1/2)*a^3*b^-4*(a+b*x)^-2+-3*a*b^-4*log(a+b*x)+-3*a^2*b^-4*(a+b*x)^-1)
@test integrate(x^2*(a+b*x)^-3, x) == :(b^-3*log(a+b*x)+2*a*b^-3*(a+b*x)^-1+-1//2*a^2*b^-3*(a+b*x)^-2)
@test integrate(x*(a+b*x)^-3, x) == :((1/2)*a^-1*x^2*(a+b*x)^-2)
@test integrate((a+b*x)^-3, x) == :(-1//2*b^-1*(a+b*x)^-2)
@test integrate(x^-1*(a+b*x)^-3, x) == :(a^-3*log(x)+a^-2*(a+b*x)^-1+(1/2)*a^-1*(a+b*x)^-2+-1*a^-3*log(a+b*x))
@test integrate(x^-2*(a+b*x)^-3, x) == :(-1*a^-3*x^-1+-3*b*a^-4*log(x)+-2*b*a^-3*(a+b*x)^-1+3*b*a^-4*log(a+b*x)+-1//2*b*a^-2*(a+b*x)^-2)
@test integrate(x^-3*(a+b*x)^-3, x) == :(-1//2*a^-3*x^-2+(1/2)*a^-3*b^2*(a+b*x)^-2+-6*a^-5*b^2*log(a+b*x)+3*b*a^-4*x^-1+3*a^-4*b^2*(a+b*x)^-1+6*a^-5*b^2*log(x))
@test integrate(x^-4*(a+b*x)^-3, x) == :(-1//3*a^-3*x^-3+-10*a^-6*b^3*log(x)+-6*a^-5*b^2*x^-1+-4*a^-5*b^3*(a+b*x)^-1+10*a^-6*b^3*log(a+b*x)+-1//2*a^-4*b^3*(a+b*x)^-2+3//2*b*a^-4*x^-2)
@test integrate(x^-5*(a+b*x)^-3, x) == :(-1//4*a^-3*x^-4+b*a^-4*x^-3+(1/2)*a^-5*b^4*(a+b*x)^-2+-15*a^-7*b^4*log(a+b*x)+-3*a^-5*b^2*x^-2+5*a^-6*b^4*(a+b*x)^-1+10*a^-6*b^3*x^-1+15*a^-7*b^4*log(x))
@test integrate(x^8*(a+b*x)^-4, x) == :(1//5*b^-4*x^5+-1*a*b^-5*x^4+-56*a^5*b^-9*log(a+b*x)+-28*a^6*b^-9*(a+b*x)^-1+-10*a^3*b^-7*x^2+4*a^7*b^-9*(a+b*x)^-2+35*x*a^4*b^-8+-1//3*a^8*b^-9*(a+b*x)^-3+10//3*a^2*b^-6*x^3)
@test integrate(x^7*(a+b*x)^-4, x) == :(1//4*b^-4*x^4+-20*x*a^3*b^-7+5*a^2*b^-6*x^2+21*a^5*b^-8*(a+b*x)^-1+35*a^4*b^-8*log(a+b*x)+-7//2*a^6*b^-8*(a+b*x)^-2+-4//3*a*b^-5*x^3+1//3*a^7*b^-8*(a+b*x)^-3)
@test integrate(x^6*(a+b*x)^-4, x) == :(1//3*b^-4*x^3+-20*a^3*b^-7*log(a+b*x)+-15*a^4*b^-7*(a+b*x)^-1+-2*a*b^-5*x^2+3*a^5*b^-7*(a+b*x)^-2+10*x*a^2*b^-6+-1//3*a^6*b^-7*(a+b*x)^-3)
@test integrate(x^5*(a+b*x)^-4, x) == :((1/2)*b^-4*x^2+-4*a*x*b^-5+10*a^2*b^-6*log(a+b*x)+10*a^3*b^-6*(a+b*x)^-1+-5//2*a^4*b^-6*(a+b*x)^-2+1//3*a^5*b^-6*(a+b*x)^-3)
@test integrate(x^4*(a+b*x)^-4, x) == :(x*b^-4+-6*a^2*b^-5*(a+b*x)^-1+-4*a*b^-5*log(a+b*x)+2*a^3*b^-5*(a+b*x)^-2+-1//3*a^4*b^-5*(a+b*x)^-3)
@test integrate(x^3*(a+b*x)^-4, x) == :(b^-4*log(a+b*x)+3*a*b^-4*(a+b*x)^-1+-3//2*a^2*b^-4*(a+b*x)^-2+1//3*a^3*b^-4*(a+b*x)^-3)
@test integrate(x^2*(a+b*x)^-4, x) == :(1//3*a^-1*x^3*(a+b*x)^-3)
@test integrate(x*(a+b*x)^-4, x) == :(-1//2*b^-2*(a+b*x)^-2+1//3*a*b^-2*(a+b*x)^-3)
@test integrate((a+b*x)^-4, x) == :(-1//3*b^-1*(a+b*x)^-3)
@test integrate(x^-1*(a+b*x)^-4, x) == :(a^-4*log(x)+a^-3*(a+b*x)^-1+(1/2)*a^-2*(a+b*x)^-2+-1*a^-4*log(a+b*x)+1//3*a^-1*(a+b*x)^-3)
@test integrate(x^-2*(a+b*x)^-4, x) == :(-1*a^-4*x^-1+-1*b*a^-3*(a+b*x)^-2+-4*b*a^-5*log(x)+-3*b*a^-4*(a+b*x)^-1+4*b*a^-5*log(a+b*x)+-1//3*b*a^-2*(a+b*x)^-3)
@test integrate(x^-3*(a+b*x)^-4, x) == :(-1//2*a^-4*x^-2+-10*a^-6*b^2*log(a+b*x)+4*b*a^-5*x^-1+6*a^-5*b^2*(a+b*x)^-1+10*a^-6*b^2*log(x)+1//3*a^-3*b^2*(a+b*x)^-3+3//2*a^-4*b^2*(a+b*x)^-2)
@test integrate(x^-4*(a+b*x)^-4, x) == :(-1//3*a^-4*x^-3+-20*a^-7*b^3*log(x)+-10*a^-6*b^2*x^-1+-10*a^-6*b^3*(a+b*x)^-1+-2*a^-5*b^3*(a+b*x)^-2+2*b*a^-5*x^-2+20*a^-7*b^3*log(a+b*x)+-1//3*a^-4*b^3*(a+b*x)^-3)
@test integrate(x^-5*(a+b*x)^-4, x) == :(-1//4*a^-4*x^-4+-35*a^-8*b^4*log(a+b*x)+-5*a^-6*b^2*x^-2+15*a^-7*b^4*(a+b*x)^-1+20*a^-7*b^3*x^-1+35*a^-8*b^4*log(x)+1//3*a^-5*b^4*(a+b*x)^-3+4//3*b*a^-5*x^-3+5//2*a^-6*b^4*(a+b*x)^-2)
@test integrate(x^10*(a+b*x)^-7, x) == :(1//4*b^-7*x^4+-105*a^6*b^-11*(a+b*x)^-2+-84*x*a^3*b^-10+2*a^9*b^-11*(a+b*x)^-5+14*a^2*b^-9*x^2+40*a^7*b^-11*(a+b*x)^-3+210*a^4*b^-11*log(a+b*x)+252*a^5*b^-11*(a+b*x)^-1+-45//4*a^8*b^-11*(a+b*x)^-4+-7//3*a*b^-8*x^3+-1//6*a^10*b^-11*(a+b*x)^-6)
@test integrate(x^9*(a+b*x)^-7, x) == :(1//3*b^-7*x^3+-126*a^4*b^-10*(a+b*x)^-1+-84*a^3*b^-10*log(a+b*x)+-28*a^6*b^-10*(a+b*x)^-3+9*a^7*b^-10*(a+b*x)^-4+28*x*a^2*b^-9+63*a^5*b^-10*(a+b*x)^-2+-9//5*a^8*b^-10*(a+b*x)^-5+-7//2*a*b^-8*x^2+1//6*a^9*b^-10*(a+b*x)^-6)
@test integrate(x^8*(a+b*x)^-7, x) == :((1/2)*b^-7*x^2+-35*a^4*b^-9*(a+b*x)^-2+-7*a*x*b^-8+-7*a^6*b^-9*(a+b*x)^-4+28*a^2*b^-9*log(a+b*x)+56*a^3*b^-9*(a+b*x)^-1+-1//6*a^8*b^-9*(a+b*x)^-6+8//5*a^7*b^-9*(a+b*x)^-5+56//3*a^5*b^-9*(a+b*x)^-3)
@test integrate(x^7*(a+b*x)^-7, x) == :(x*b^-7+-21*a^2*b^-8*(a+b*x)^-1+-7*a*b^-8*log(a+b*x)+-35//3*a^4*b^-8*(a+b*x)^-3+-7//5*a^6*b^-8*(a+b*x)^-5+1//6*a^7*b^-8*(a+b*x)^-6+21//4*a^5*b^-8*(a+b*x)^-4+35//2*a^3*b^-8*(a+b*x)^-2)
@test integrate(x^6*(a+b*x)^-7, x) == :(b^-7*log(a+b*x)+6*a*b^-7*(a+b*x)^-1+-15//2*a^2*b^-7*(a+b*x)^-2+-15//4*a^4*b^-7*(a+b*x)^-4+-1//6*a^6*b^-7*(a+b*x)^-6+6//5*a^5*b^-7*(a+b*x)^-5+20//3*a^3*b^-7*(a+b*x)^-3)
@test integrate(x^5*(a+b*x)^-7, x) == :(1//6*a^-1*x^6*(a+b*x)^-6)
@test integrate(x^4*(a+b*x)^-7, x) == :(1//6*a^-1*x^5*(a+b*x)^-6+1//30*a^-2*x^5*(a+b*x)^-5)
@test integrate(x^2*(a+b*x)^-7, x) == :(-1//4*b^-3*(a+b*x)^-4+-1//6*a^2*b^-3*(a+b*x)^-6+2//5*a*b^-3*(a+b*x)^-5)
@test integrate(x*(a+b*x)^-7, x) == :(-1//5*b^-2*(a+b*x)^-5+1//6*a*b^-2*(a+b*x)^-6)
@test integrate((a+b*x)^-7, x) == :(-1//6*b^-1*(a+b*x)^-6)
@test integrate(x^-1*(a+b*x)^-7, x) == :(a^-7*log(x)+a^-6*(a+b*x)^-1+(1/2)*a^-5*(a+b*x)^-2+-1*a^-7*log(a+b*x)+1//3*a^-4*(a+b*x)^-3+1//4*a^-3*(a+b*x)^-4+1//5*a^-2*(a+b*x)^-5+1//6*a^-1*(a+b*x)^-6)
@test integrate(x^-2*(a+b*x)^-7, x) == :(-1*a^-7*x^-1+-7*b*a^-8*log(x)+-6*b*a^-7*(a+b*x)^-1+7*b*a^-8*log(a+b*x)+-5//2*b*a^-6*(a+b*x)^-2+-4//3*b*a^-5*(a+b*x)^-3+-3//4*b*a^-4*(a+b*x)^-4+-2//5*b*a^-3*(a+b*x)^-5+-1//6*b*a^-2*(a+b*x)^-6)
@test integrate(x^-3*(a+b*x)^-7, x) == :(-1//2*a^-7*x^-2+-28*a^-9*b^2*log(a+b*x)+7*b*a^-8*x^-1+21*a^-8*b^2*(a+b*x)^-1+28*a^-9*b^2*log(x)+1//6*a^-3*b^2*(a+b*x)^-6+3//2*a^-5*b^2*(a+b*x)^-4+3//5*a^-4*b^2*(a+b*x)^-5+10//3*a^-6*b^2*(a+b*x)^-3+15//2*a^-7*b^2*(a+b*x)^-2)
@test integrate(x^-4*(a+b*x)^-7, x) == :(-1//3*a^-7*x^-3+-84*a^-10*b^3*log(x)+-56*a^-9*b^3*(a+b*x)^-1+-28*a^-9*b^2*x^-1+84*a^-10*b^3*log(a+b*x)+-35//2*a^-8*b^3*(a+b*x)^-2+-20//3*a^-7*b^3*(a+b*x)^-3+-5//2*a^-6*b^3*(a+b*x)^-4+-4//5*a^-5*b^3*(a+b*x)^-5+-1//6*a^-4*b^3*(a+b*x)^-6+7//2*b*a^-8*x^-2)
@test integrate(x^12*(a+b*x)^-10, x) == :(1//3*b^-10*x^3+-495*a^4*b^-13*(a+b*x)^-1+-308*a^6*b^-13*(a+b*x)^-3+-220*a^3*b^-13*log(a+b*x)+-99*a^8*b^-13*(a+b*x)^-5+-5*a*b^-11*x^2+55*x*a^2*b^-12+198*a^7*b^-13*(a+b*x)^-4+396*a^5*b^-13*(a+b*x)^-2+-66//7*a^10*b^-13*(a+b*x)^-7+-1//9*a^12*b^-13*(a+b*x)^-9+3//2*a^11*b^-13*(a+b*x)^-8+110//3*a^9*b^-13*(a+b*x)^-6)
@test integrate(x^11*(a+b*x)^-10, x) == :((1/2)*b^-10*x^2+-165*a^4*b^-12*(a+b*x)^-2+-10*a*x*b^-11+55*a^2*b^-12*log(a+b*x)+66*a^7*b^-12*(a+b*x)^-5+154*a^5*b^-12*(a+b*x)^-3+165*a^3*b^-12*(a+b*x)^-1+-231//2*a^6*b^-12*(a+b*x)^-4+-55//2*a^8*b^-12*(a+b*x)^-6+-11//8*a^10*b^-12*(a+b*x)^-8+1//9*a^11*b^-12*(a+b*x)^-9+55//7*a^9*b^-12*(a+b*x)^-7)
@test integrate(x^10*(a+b*x)^-10, x) == :(x*b^-10+-70*a^4*b^-11*(a+b*x)^-3+-45*a^2*b^-11*(a+b*x)^-1+-42*a^6*b^-11*(a+b*x)^-5+-10*a*b^-11*log(a+b*x)+20*a^7*b^-11*(a+b*x)^-6+60*a^3*b^-11*(a+b*x)^-2+63*a^5*b^-11*(a+b*x)^-4+-45//7*a^8*b^-11*(a+b*x)^-7+-1//9*a^10*b^-11*(a+b*x)^-9+5//4*a^9*b^-11*(a+b*x)^-8)
@test integrate(x^9*(a+b*x)^-10, x) == :(b^-10*log(a+b*x)+-18*a^2*b^-10*(a+b*x)^-2+-14*a^6*b^-10*(a+b*x)^-6+9*a*b^-10*(a+b*x)^-1+28*a^3*b^-10*(a+b*x)^-3+-63//2*a^4*b^-10*(a+b*x)^-4+-9//8*a^8*b^-10*(a+b*x)^-8+1//9*a^9*b^-10*(a+b*x)^-9+36//7*a^7*b^-10*(a+b*x)^-7+126//5*a^5*b^-10*(a+b*x)^-5)
@test integrate(x^8*(a+b*x)^-10, x) == :(1//9*a^-1*x^9*(a+b*x)^-9)
@test integrate(x^7*(a+b*x)^-10, x) == :(1//9*a^-1*x^8*(a+b*x)^-9+1//72*a^-2*x^8*(a+b*x)^-8)
@test integrate(x^6*(a+b*x)^-10, x) == :(1//9*a^-1*x^7*(a+b*x)^-9+1//36*a^-2*x^7*(a+b*x)^-8+1//252*a^-3*x^7*(a+b*x)^-7)
@test integrate(x^5*(a+b*x)^-10, x) == :(1//9*a^-1*x^6*(a+b*x)^-9+1//24*a^-2*x^6*(a+b*x)^-8+1//84*a^-3*x^6*(a+b*x)^-7+1//504*a^-4*x^6*(a+b*x)^-6)
@test integrate(x^4*(a+b*x)^-10, x) == :(-1//5*b^-5*(a+b*x)^-5+(1/2)*a^3*b^-5*(a+b*x)^-8+-6//7*a^2*b^-5*(a+b*x)^-7+-1//9*a^4*b^-5*(a+b*x)^-9+2//3*a*b^-5*(a+b*x)^-6)
@test integrate(x^3*(a+b*x)^-10, x) == :(-1//6*b^-4*(a+b*x)^-6+-3//8*a^2*b^-4*(a+b*x)^-8+1//9*a^3*b^-4*(a+b*x)^-9+3//7*a*b^-4*(a+b*x)^-7)
@test integrate(x^2*(a+b*x)^-10, x) == :(-1//7*b^-3*(a+b*x)^-7+-1//9*a^2*b^-3*(a+b*x)^-9+1//4*a*b^-3*(a+b*x)^-8)
@test integrate(x*(a+b*x)^-10, x) == :(-1//8*b^-2*(a+b*x)^-8+1//9*a*b^-2*(a+b*x)^-9)
@test integrate((a+b*x)^-10, x) == :(-1//9*b^-1*(a+b*x)^-9)
@test integrate(x^-1*(a+b*x)^-10, x) == :(a^-10*log(x)+a^-9*(a+b*x)^-1+(1/2)*a^-8*(a+b*x)^-2+-1*a^-10*log(a+b*x)+1//3*a^-7*(a+b*x)^-3+1//4*a^-6*(a+b*x)^-4+1//5*a^-5*(a+b*x)^-5+1//6*a^-4*(a+b*x)^-6+1//7*a^-3*(a+b*x)^-7+1//8*a^-2*(a+b*x)^-8+1//9*a^-1*(a+b*x)^-9)
@test integrate(x^-2*(a+b*x)^-10, x) == :(-1*a^-10*x^-1+-1*b*a^-6*(a+b*x)^-5+-10*b*a^-11*log(x)+-9*b*a^-10*(a+b*x)^-1+-4*b*a^-9*(a+b*x)^-2+10*b*a^-11*log(a+b*x)+-7//3*b*a^-8*(a+b*x)^-3+-3//2*b*a^-7*(a+b*x)^-4+-3//7*b*a^-4*(a+b*x)^-7+-2//3*b*a^-5*(a+b*x)^-6+-1//4*b*a^-3*(a+b*x)^-8+-1//9*b*a^-2*(a+b*x)^-9)
@test integrate(x^-3*(a+b*x)^-10, x) == :(-1//2*a^-10*x^-2+-55*a^-12*b^2*log(a+b*x)+3*a^-7*b^2*(a+b*x)^-5+10*b*a^-11*x^-1+18*a^-10*b^2*(a+b*x)^-2+45*a^-11*b^2*(a+b*x)^-1+55*a^-12*b^2*log(x)+1//9*a^-3*b^2*(a+b*x)^-9+3//8*a^-4*b^2*(a+b*x)^-8+5//3*a^-6*b^2*(a+b*x)^-6+6//7*a^-5*b^2*(a+b*x)^-7+21//4*a^-8*b^2*(a+b*x)^-4+28//3*a^-9*b^2*(a+b*x)^-3)
@test integrate(x^-4*(a+b*x)^-10, x) == :(-1//3*a^-10*x^-3+-220*a^-13*b^3*log(x)+-165*a^-12*b^3*(a+b*x)^-1+-60*a^-11*b^3*(a+b*x)^-2+-55*a^-12*b^2*x^-1+-28*a^-10*b^3*(a+b*x)^-3+-14*a^-9*b^3*(a+b*x)^-4+-7*a^-8*b^3*(a+b*x)^-5+5*b*a^-11*x^-2+220*a^-13*b^3*log(a+b*x)+-10//3*a^-7*b^3*(a+b*x)^-6+-10//7*a^-6*b^3*(a+b*x)^-7+-1//2*a^-5*b^3*(a+b*x)^-8+-1//9*a^-4*b^3*(a+b*x)^-9)
@test integrate(x^-10*(a+b*x)^12, x) == :(-1//9*a^12*x^-9+1//3*b^12*x^3+-495*a^4*b^8*x^-1+-396*a^5*b^7*x^-2+-308*a^6*b^6*x^-3+-198*a^7*b^5*x^-4+-99*a^8*b^4*x^-5+6*a*b^11*x^2+66*x*a^2*b^10+220*a^3*b^9*log(x)+-110//3*a^9*b^3*x^-6+-66//7*a^10*b^2*x^-7+-3//2*b*a^11*x^-8)
@test integrate(x^-10*(a+b*x)^11, x) == :((1/2)*b^11*x^2+-1//9*a^11*x^-9+-165*a^3*b^8*x^-1+-165*a^4*b^7*x^-2+-154*a^5*b^6*x^-3+-66*a^7*b^4*x^-5+11*a*x*b^10+55*a^2*b^9*log(x)+-231//2*a^6*b^5*x^-4+-55//2*a^8*b^3*x^-6+-55//7*a^9*b^2*x^-7+-11//8*b*a^10*x^-8)
@test integrate(x^-10*(a+b*x)^10, x) == :(x*b^10+-1//9*a^10*x^-9+-70*a^4*b^6*x^-3+-63*a^5*b^5*x^-4+-60*a^3*b^7*x^-2+-45*a^2*b^8*x^-1+-42*a^6*b^4*x^-5+-20*a^7*b^3*x^-6+10*a*b^9*log(x)+-45//7*a^8*b^2*x^-7+-5//4*b*a^9*x^-8)
@test integrate(x^-10*(a+b*x)^9, x) == :(b^9*log(x)+-1//9*a^9*x^-9+-28*a^3*b^6*x^-3+-18*a^2*b^7*x^-2+-14*a^6*b^3*x^-6+-9*a*b^8*x^-1+-126//5*a^5*b^4*x^-5+-63//2*a^4*b^5*x^-4+-36//7*a^7*b^2*x^-7+-9//8*b*a^8*x^-8)
@test integrate(x^-10*(a+b*x)^8, x) == :(-1//9*a^-1*x^-9*(a+b*x)^9)
@test integrate(x^-10*(a+b*x)^7, x) == :(-1//9*a^-1*x^-9*(a+b*x)^8+1//72*b*a^-2*x^-8*(a+b*x)^8)
@test integrate(x^-10*(a+b*x)^6, x) == :(-1//9*a^-1*x^-9*(a+b*x)^7+-1//252*a^-3*b^2*x^-7*(a+b*x)^7+1//36*b*a^-2*x^-8*(a+b*x)^7)
@test integrate(x^-10*(a+b*x)^5, x) == :(-1//4*b^5*x^-4+-1//9*a^5*x^-9+-1*a*b^4*x^-5+-10//7*a^3*b^2*x^-7+-5//3*a^2*b^3*x^-6+-5//8*b*a^4*x^-8)
@test integrate(x^-10*(a+b*x)^4, x) == :(-1//5*b^4*x^-5+-1//9*a^4*x^-9+-6//7*a^2*b^2*x^-7+-2//3*a*b^3*x^-6+-1//2*b*a^3*x^-8)
@test integrate(x^-10*(a+b*x)^3, x) == :(-1//6*b^3*x^-6+-1//9*a^3*x^-9+-3//7*a*b^2*x^-7+-3//8*b*a^2*x^-8)
@test integrate(x^-10*(a+b*x)^2, x) == :(-1//7*b^2*x^-7+-1//9*a^2*x^-9+-1//4*a*b*x^-8)
@test integrate(x^-10*(a+b*x), x) == :(-1//8*b*x^-8+-1//9*a*x^-9)
@test integrate(x^-10, x) == :(-1//9*x^-9)
@test integrate(x^-10*(a+b*x)^-1, x) == :(-1//9*a^-1*x^-9+a^-10*b^9*log(a+b*x)+(1/2)*a^-8*b^7*x^-2+-1*a^-10*b^9*log(x)+-1*a^-9*b^8*x^-1+-1//3*a^-7*b^6*x^-3+-1//5*a^-5*b^4*x^-5+-1//7*a^-3*b^2*x^-7+1//4*a^-6*b^5*x^-4+1//6*a^-4*b^3*x^-6+1//8*b*a^-2*x^-8)
@test integrate(x^-10*(a+b*x)^-2, x) == :(-1//9*a^-2*x^-9+-1*a^-10*b^9*(a+b*x)^-1+-1*a^-6*b^4*x^-5+-10*a^-11*b^9*log(x)+-9*a^-10*b^8*x^-1+4*a^-9*b^7*x^-2+10*a^-11*b^9*log(a+b*x)+-7//3*a^-8*b^6*x^-3+-3//7*a^-4*b^2*x^-7+1//4*b*a^-3*x^-8+2//3*a^-5*b^3*x^-6+3//2*a^-7*b^5*x^-4)
@test integrate(x^-10*(a+b*x)^-3, x) == :(-1//9*a^-3*x^-9+-55*a^-12*b^9*log(x)+-45*a^-11*b^8*x^-1+-10*a^-11*b^9*(a+b*x)^-1+-3*a^-7*b^4*x^-5+18*a^-10*b^7*x^-2+55*a^-12*b^9*log(a+b*x)+-28//3*a^-9*b^6*x^-3+-6//7*a^-5*b^2*x^-7+-1//2*a^-10*b^9*(a+b*x)^-2+3//8*b*a^-4*x^-8+5//3*a^-6*b^3*x^-6+21//4*a^-8*b^5*x^-4)
@test integrate(x^-1*(2+3x)^-1, x) == :((1/2)*log(x)+-1//2*log(2+3x))
@test integrate(x^-1*(4+6x)^-1, x) == :(-1//4*log(2+3x)+1//4*log(x))
@test integrate(x^-2*(4+6x)^-1, x) == :(-3//8*log(x)+-1//4*x^-1+3//8*log(2+3x))
@test integrate(x^-3*(4+6x)^-1, x) == :(-9//16*log(2+3x)+-1//8*x^-2+3//8*x^-1+9//16*log(x))
@test integrate(x^-4*(4+6x)^-1, x) == :(-27//32*log(x)+-9//16*x^-1+-1//12*x^-3+3//16*x^-2+27//32*log(2+3x))
@test integrate(x^-5*(4+6x)^-1, x) == :(-81//64*log(2+3x)+-9//32*x^-2+-1//16*x^-4+1//8*x^-3+27//32*x^-1+81//64*log(x))
@test integrate(x^-1*(4+6x)^-2, x) == :((16+24x)^-1+-1//16*log(2+3x)+1//16*log(x))
@test integrate(x^-2*(4+6x)^-2, x) == :(-3*(32+48x)^-1+-3//16*log(x)+-1//16*x^-1+3//16*log(2+3x))
@test integrate(x^-3*(4+6x)^-2, x) == :(9*(64+96x)^-1+-27//64*log(2+3x)+-1//32*x^-2+3//16*x^-1+27//64*log(x))
@test integrate(x^-4*(4+6x)^-2, x) == :(-27*(128+192x)^-1+-27//32*log(x)+-27//64*x^-1+-1//48*x^-3+3//32*x^-2+27//32*log(2+3x))
@test integrate(x^-5*(4+6x)^-2, x) == :(81*(256+384x)^-1+-405//256*log(2+3x)+-27//128*x^-2+-1//64*x^-4+1//16*x^-3+27//32*x^-1+405//256*log(x))
@test integrate(x^-1*(4+6x)^-3, x) == :((64+96x)^-1+-1//64*log(2+3x)+1//32*(2+3x)^-2+1//64*log(x))
@test integrate(x^-2*(4+6x)^-3, x) == :(-3*(64+96x)^-1+-9//128*log(x)+-3//64*(2+3x)^-2+-1//64*x^-1+9//128*log(2+3x))
@test integrate(x^-3*(4+6x)^-3, x) == :(27*(256+384x)^-1+-27//128*log(2+3x)+-1//128*x^-2+9//128*x^-1+9//128*(2+3x)^-2+27//128*log(x))
@test integrate(x^-4*(4+6x)^-3, x) == :(-27*(128+192x)^-1+-135//256*log(x)+-27//128*x^-1+-27//256*(2+3x)^-2+-1//192*x^-3+9//256*x^-2+135//256*log(2+3x))
@test integrate(x^-5*(4+6x)^-3, x) == :(405*(1024+1536x)^-1+-1215//1024*log(2+3x)+-27//256*x^-2+-1//256*x^-4+3//128*x^-3+81//512*(2+3x)^-2+135//256*x^-1+1215//1024*log(x))
@test integrate((2+2x)^-1, x) == :((1/2)*log(1+x))
@test integrate((4+-6x)^-1, x) == :(-1//6*log(2+-3x))
@test integrate((a+x*a^(1/2))^-1, x) == :(a^-1//2*log(x+a^(1/2)))
@test integrate((a+x*(-1a)^(1/2))^-1, x) == :((-1a)^-1//2*log(a+x*(-1a)^(1/2)))
@test integrate((a^2+x*(-1a)^(1/2))^-1, x) == :((-1a)^-1//2*log(a^2+x*(-1a)^(1/2)))
@test integrate((a^3+x*(-1a)^(1/2))^-1, x) == :((-1a)^-1//2*log(a^3+x*(-1a)^(1/2)))
@test integrate((a^-1+x*(-1a)^(1/2))^-1, x) == :((-1a)^-1//2*log(1+-1*x*(-1a)^3//2))
@test integrate((a^-2+x*(-1a)^(1/2))^-1, x) == :((-1a)^-1//2*log(1+x*(-1a)^5//2))
@test integrate(x^-1*(1+b*x)^-1, x) == :(-1*log(1+b*x)+log(x))
@test integrate(x^-1*(-1+b*x)^-1, x) == :(-1*log(x)+log(1+-1*b*x))
@test integrate(x^-2*(1+b*x)^-1, x) == :(-1*x^-1+b*log(1+b*x)+-1*b*log(x))
@test integrate(x^-2*(-1+b*x)^-1, x) == :(x^-1+b*log(1+-1*b*x)+-1*b*log(x))
@test integrate(b*x^-1+x^-2*(1+b*x)^-1, x) == :(-1*x^-1+b*log(1+b*x))
@test integrate(x^3*(a+b*x)^(1/2), x) == :(2//9*b^-4*(a+b*x)^9//2+-6//7*a*b^-4*(a+b*x)^7//2+-2//3*a^3*b^-4*(a+b*x)^3//2+6//5*a^2*b^-4*(a+b*x)^5//2)
@test integrate(x^2*(a+b*x)^(1/2), x) == :(2//7*b^-3*(a+b*x)^7//2+-4//5*a*b^-3*(a+b*x)^5//2+2//3*a^2*b^-3*(a+b*x)^3//2)
@test integrate(x*(a+b*x)^(1/2), x) == :(2//5*b^-2*(a+b*x)^5//2+-2//3*a*b^-2*(a+b*x)^3//2)
@test integrate((a+b*x)^(1/2), x) == :(2//3*b^-1*(a+b*x)^3//2)
@test integrate(x^-1*(a+b*x)^(1/2), x) == :(2*(a+b*x)^(1/2)+-2*a^(1/2)*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^-2*(a+b*x)^(1/2), x) == :(-1*x^-1*(a+b*x)^(1/2)+-1*b*a^-1//2*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^-3*(a+b*x)^(1/2), x) == :(-1//2*x^-2*(a+b*x)^(1/2)+1//4*a^-3//2*b^2*arctanh(a^-1//2*(a+b*x)^(1/2))+-1//4*b*a^-1*x^-1*(a+b*x)^(1/2))
@test integrate(x^-4*(a+b*x)^(1/2), x) == :(-1//3*x^-3*(a+b*x)^(1/2)+-1//8*a^-5//2*b^3*arctanh(a^-1//2*(a+b*x)^(1/2))+-1//12*b*a^-1*x^-2*(a+b*x)^(1/2)+1//8*a^-2*b^2*x^-1*(a+b*x)^(1/2))
@test integrate(x^3*(a+b*x)^3//2, x) == :(2//11*b^-4*(a+b*x)^11//2+-2//3*a*b^-4*(a+b*x)^9//2+-2//5*a^3*b^-4*(a+b*x)^5//2+6//7*a^2*b^-4*(a+b*x)^7//2)
@test integrate(x^2*(a+b*x)^3//2, x) == :(2//9*b^-3*(a+b*x)^9//2+-4//7*a*b^-3*(a+b*x)^7//2+2//5*a^2*b^-3*(a+b*x)^5//2)
@test integrate(x*(a+b*x)^3//2, x) == :(2//7*b^-2*(a+b*x)^7//2+-2//5*a*b^-2*(a+b*x)^5//2)
@test integrate((a+b*x)^3//2, x) == :(2//5*b^-1*(a+b*x)^5//2)
@test integrate(x^-1*(a+b*x)^3//2, x) == :(2//3*(a+b*x)^3//2+-2*a^3//2*arctanh(a^-1//2*(a+b*x)^(1/2))+2*a*(a+b*x)^(1/2))
@test integrate(x^-2*(a+b*x)^3//2, x) == :(-1*x^-1*(a+b*x)^3//2+3*b*(a+b*x)^(1/2)+-3*b*a^(1/2)*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^-3*(a+b*x)^3//2, x) == :(-1//2*x^-2*(a+b*x)^3//2+-3//4*b*x^-1*(a+b*x)^(1/2)+-3//4*a^-1//2*b^2*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^-4*(a+b*x)^3//2, x) == :(-1//3*x^-3*(a+b*x)^3//2+-1//4*b*x^-2*(a+b*x)^(1/2)+1//8*a^-3//2*b^3*arctanh(a^-1//2*(a+b*x)^(1/2))+-1//8*a^-1*b^2*x^-1*(a+b*x)^(1/2))
@test integrate(x^3*(a+b*x)^5//2, x) == :(2//13*b^-4*(a+b*x)^13//2+-6//11*a*b^-4*(a+b*x)^11//2+-2//7*a^3*b^-4*(a+b*x)^7//2+2//3*a^2*b^-4*(a+b*x)^9//2)
@test integrate(x^2*(a+b*x)^5//2, x) == :(2//11*b^-3*(a+b*x)^11//2+-4//9*a*b^-3*(a+b*x)^9//2+2//7*a^2*b^-3*(a+b*x)^7//2)
@test integrate(x*(a+b*x)^5//2, x) == :(2//9*b^-2*(a+b*x)^9//2+-2//7*a*b^-2*(a+b*x)^7//2)
@test integrate((a+b*x)^5//2, x) == :(2//7*b^-1*(a+b*x)^7//2)
@test integrate(x^-1*(a+b*x)^5//2, x) == :(2//5*(a+b*x)^5//2+-2*a^5//2*arctanh(a^-1//2*(a+b*x)^(1/2))+2*a^2*(a+b*x)^(1/2)+2//3*a*(a+b*x)^3//2)
@test integrate(x^-2*(a+b*x)^5//2, x) == :(-1*x^-1*(a+b*x)^5//2+5//3*b*(a+b*x)^3//2+-5*b*a^3//2*arctanh(a^-1//2*(a+b*x)^(1/2))+5*a*b*(a+b*x)^(1/2))
@test integrate(x^-3*(a+b*x)^5//2, x) == :(-1//2*x^-2*(a+b*x)^5//2+15//4*b^2*(a+b*x)^(1/2)+-15//4*a^(1/2)*b^2*arctanh(a^-1//2*(a+b*x)^(1/2))+-5//4*b*x^-1*(a+b*x)^3//2)
@test integrate(x^-4*(a+b*x)^5//2, x) == :(-1//3*x^-3*(a+b*x)^5//2+-5//8*a^-1//2*b^3*arctanh(a^-1//2*(a+b*x)^(1/2))+-5//8*b^2*x^-1*(a+b*x)^(1/2)+-5//12*b*x^-2*(a+b*x)^3//2)
@test integrate(x^-5*(a+b*x)^5//2, x) == :(-1//4*x^-4*(a+b*x)^5//2+-5//24*b*x^-3*(a+b*x)^3//2+-5//32*b^2*x^-2*(a+b*x)^(1/2)+5//64*a^-3//2*b^4*arctanh(a^-1//2*(a+b*x)^(1/2))+-5//64*a^-1*b^3*x^-1*(a+b*x)^(1/2))
@test integrate(x^7*(a+b*x)^9//2, x) == :(2//25*b^-8*(a+b*x)^25//2+2*a^2*b^-8*(a+b*x)^21//2+-70//19*a^3*b^-8*(a+b*x)^19//2+-14//5*a^5*b^-8*(a+b*x)^15//2+-14//23*a*b^-8*(a+b*x)^23//2+-2//11*a^7*b^-8*(a+b*x)^11//2+14//13*a^6*b^-8*(a+b*x)^13//2+70//17*a^4*b^-8*(a+b*x)^17//2)
@test integrate(x^6*(a+b*x)^9//2, x) == :(2//23*b^-7*(a+b*x)^23//2+2*a^4*b^-7*(a+b*x)^15//2+-40//17*a^3*b^-7*(a+b*x)^17//2+-12//13*a^5*b^-7*(a+b*x)^13//2+-4//7*a*b^-7*(a+b*x)^21//2+2//11*a^6*b^-7*(a+b*x)^11//2+30//19*a^2*b^-7*(a+b*x)^19//2)
@test integrate(x^5*(a+b*x)^9//2, x) == :(2//21*b^-6*(a+b*x)^21//2+-10//19*a*b^-6*(a+b*x)^19//2+-4//3*a^3*b^-6*(a+b*x)^15//2+-2//11*a^5*b^-6*(a+b*x)^11//2+10//13*a^4*b^-6*(a+b*x)^13//2+20//17*a^2*b^-6*(a+b*x)^17//2)
@test integrate(x^4*(a+b*x)^9//2, x) == :(2//19*b^-5*(a+b*x)^19//2+-8//13*a^3*b^-5*(a+b*x)^13//2+-8//17*a*b^-5*(a+b*x)^17//2+2//11*a^4*b^-5*(a+b*x)^11//2+4//5*a^2*b^-5*(a+b*x)^15//2)
@test integrate(x^3*(a+b*x)^9//2, x) == :(2//17*b^-4*(a+b*x)^17//2+-2//5*a*b^-4*(a+b*x)^15//2+-2//11*a^3*b^-4*(a+b*x)^11//2+6//13*a^2*b^-4*(a+b*x)^13//2)
@test integrate(x^2*(a+b*x)^9//2, x) == :(2//15*b^-3*(a+b*x)^15//2+-4//13*a*b^-3*(a+b*x)^13//2+2//11*a^2*b^-3*(a+b*x)^11//2)
@test integrate(x*(a+b*x)^9//2, x) == :(2//13*b^-2*(a+b*x)^13//2+-2//11*a*b^-2*(a+b*x)^11//2)
@test integrate((a+b*x)^9//2, x) == :(2//11*b^-1*(a+b*x)^11//2)
@test integrate(x^-1*(a+b*x)^9//2, x) == :(2//9*(a+b*x)^9//2+-2*a^9//2*arctanh(a^-1//2*(a+b*x)^(1/2))+2*a^4*(a+b*x)^(1/2)+2//3*a^3*(a+b*x)^3//2+2//5*a^2*(a+b*x)^5//2+2//7*a*(a+b*x)^7//2)
@test integrate(x^-2*(a+b*x)^9//2, x) == :(-1*x^-1*(a+b*x)^9//2+9//7*b*(a+b*x)^7//2+-9*b*a^7//2*arctanh(a^-1//2*(a+b*x)^(1/2))+3*b*a^2*(a+b*x)^3//2+9*b*a^3*(a+b*x)^(1/2)+9//5*a*b*(a+b*x)^5//2)
@test integrate(x^-3*(a+b*x)^9//2, x) == :(-1//2*x^-2*(a+b*x)^9//2+63//20*b^2*(a+b*x)^5//2+-63//4*a^5//2*b^2*arctanh(a^-1//2*(a+b*x)^(1/2))+-9//4*b*x^-1*(a+b*x)^7//2+21//4*a*b^2*(a+b*x)^3//2+63//4*a^2*b^2*(a+b*x)^(1/2))
@test integrate(x^-4*(a+b*x)^9//2, x) == :(-1//3*x^-3*(a+b*x)^9//2+35//8*b^3*(a+b*x)^3//2+-105//8*a^3//2*b^3*arctanh(a^-1//2*(a+b*x)^(1/2))+-21//8*b^2*x^-1*(a+b*x)^5//2+-3//4*b*x^-2*(a+b*x)^7//2+105//8*a*b^3*(a+b*x)^(1/2))
@test integrate(x^-5*(a+b*x)^9//2, x) == :(-1//4*x^-4*(a+b*x)^9//2+315//64*b^4*(a+b*x)^(1/2)+-315//64*a^(1/2)*b^4*arctanh(a^-1//2*(a+b*x)^(1/2))+-105//64*b^3*x^-1*(a+b*x)^3//2+-21//32*b^2*x^-2*(a+b*x)^5//2+-3//8*b*x^-3*(a+b*x)^7//2)
@test integrate(x^-6*(a+b*x)^9//2, x) == :(-1//5*x^-5*(a+b*x)^9//2+-63//128*a^-1//2*b^5*arctanh(a^-1//2*(a+b*x)^(1/2))+-63//128*b^4*x^-1*(a+b*x)^(1/2)+-21//64*b^3*x^-2*(a+b*x)^3//2+-21//80*b^2*x^-3*(a+b*x)^5//2+-9//40*b*x^-4*(a+b*x)^7//2)
@test integrate(x^-7*(a+b*x)^9//2, x) == :(-1//6*x^-6*(a+b*x)^9//2+-21//160*b^2*x^-4*(a+b*x)^5//2+-21//256*b^4*x^-2*(a+b*x)^(1/2)+-7//64*b^3*x^-3*(a+b*x)^3//2+-3//20*b*x^-5*(a+b*x)^7//2+21//512*a^-3//2*b^6*arctanh(a^-1//2*(a+b*x)^(1/2))+-21//512*a^-1*b^5*x^-1*(a+b*x)^(1/2))
@test integrate(x^-8*(a+b*x)^9//2, x) == :(-1//7*x^-7*(a+b*x)^9//2+-9//1024*a^-5//2*b^7*arctanh(a^-1//2*(a+b*x)^(1/2))+-3//28*b*x^-6*(a+b*x)^7//2+-3//40*b^2*x^-5*(a+b*x)^5//2+-3//64*b^3*x^-4*(a+b*x)^3//2+-3//128*b^4*x^-3*(a+b*x)^(1/2)+-3//512*a^-1*b^5*x^-2*(a+b*x)^(1/2)+9//1024*a^-2*b^6*x^-1*(a+b*x)^(1/2))
@test integrate(x^-1*(-1a+b*x)^(1/2), x) == :(2*(-1a+b*x)^(1/2)+-2*a^(1/2)*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-2*(-1a+b*x)^(1/2), x) == :(-1*x^-1*(-1a+b*x)^(1/2)+b*a^-1//2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-3*(-1a+b*x)^(1/2), x) == :(-1//2*x^-2*(-1a+b*x)^(1/2)+1//4*a^-3//2*b^2*arctan(a^-1//2*(-1a+b*x)^(1/2))+1//4*b*a^-1*x^-1*(-1a+b*x)^(1/2))
@test integrate(x^-1*(-1a+b*x)^3//2, x) == :(2//3*(-1a+b*x)^3//2+-2*a*(-1a+b*x)^(1/2)+2*a^3//2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-2*(-1a+b*x)^3//2, x) == :(-1*x^-1*(-1a+b*x)^3//2+3*b*(-1a+b*x)^(1/2)+-3*b*a^(1/2)*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-3*(-1a+b*x)^3//2, x) == :(-1//2*x^-2*(-1a+b*x)^3//2+-3//4*b*x^-1*(-1a+b*x)^(1/2)+3//4*a^-1//2*b^2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-1*(-1a+b*x)^5//2, x) == :(2//5*(-1a+b*x)^5//2+-2*a^5//2*arctan(a^-1//2*(-1a+b*x)^(1/2))+2*a^2*(-1a+b*x)^(1/2)+-2//3*a*(-1a+b*x)^3//2)
@test integrate(x^-2*(-1a+b*x)^5//2, x) == :(-1*x^-1*(-1a+b*x)^5//2+5//3*b*(-1a+b*x)^3//2+-5*a*b*(-1a+b*x)^(1/2)+5*b*a^3//2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-3*(-1a+b*x)^5//2, x) == :(-1//2*x^-2*(-1a+b*x)^5//2+15//4*b^2*(-1a+b*x)^(1/2)+-15//4*a^(1/2)*b^2*arctan(a^-1//2*(-1a+b*x)^(1/2))+-5//4*b*x^-1*(-1a+b*x)^3//2)
@test integrate(x^4*(a+b*x)^-1//2, x) == :(2//9*b^-5*(a+b*x)^9//2+2*a^4*b^-5*(a+b*x)^(1/2)+-8//3*a^3*b^-5*(a+b*x)^3//2+-8//7*a*b^-5*(a+b*x)^7//2+12//5*a^2*b^-5*(a+b*x)^5//2)
@test integrate(x^3*(a+b*x)^-1//2, x) == :(2//7*b^-4*(a+b*x)^7//2+-2*a^3*b^-4*(a+b*x)^(1/2)+2*a^2*b^-4*(a+b*x)^3//2+-6//5*a*b^-4*(a+b*x)^5//2)
@test integrate(x^2*(a+b*x)^-1//2, x) == :(2//5*b^-3*(a+b*x)^5//2+2*a^2*b^-3*(a+b*x)^(1/2)+-4//3*a*b^-3*(a+b*x)^3//2)
@test integrate(x*(a+b*x)^-1//2, x) == :(2//3*b^-2*(a+b*x)^3//2+-2*a*b^-2*(a+b*x)^(1/2))
@test integrate((a+b*x)^-1//2, x) == :(2*b^-1*(a+b*x)^(1/2))
@test integrate(x^-1*(a+b*x)^-1//2, x) == :(-2*a^-1//2*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^-2*(a+b*x)^-1//2, x) == :(b*a^-3//2*arctanh(a^-1//2*(a+b*x)^(1/2))+-1*a^-1*x^-1*(a+b*x)^(1/2))
@test integrate(x^-3*(a+b*x)^-1//2, x) == :(-3//4*a^-5//2*b^2*arctanh(a^-1//2*(a+b*x)^(1/2))+-1//2*a^-1*x^-2*(a+b*x)^(1/2)+3//4*b*a^-2*x^-1*(a+b*x)^(1/2))
@test integrate(x^-4*(a+b*x)^-1//2, x) == :(-1//3*a^-1*x^-3*(a+b*x)^(1/2)+5//8*a^-7//2*b^3*arctanh(a^-1//2*(a+b*x)^(1/2))+-5//8*a^-3*b^2*x^-1*(a+b*x)^(1/2)+5//12*b*a^-2*x^-2*(a+b*x)^(1/2))
@test integrate(x^4*(a+b*x)^-3//2, x) == :(2//7*b^-5*(a+b*x)^7//2+-8*a^3*b^-5*(a+b*x)^(1/2)+-2*a^4*b^-5*(a+b*x)^-1//2+4*a^2*b^-5*(a+b*x)^3//2+-8//5*a*b^-5*(a+b*x)^5//2)
@test integrate(x^3*(a+b*x)^-3//2, x) == :(2//5*b^-4*(a+b*x)^5//2+-2*a*b^-4*(a+b*x)^3//2+2*a^3*b^-4*(a+b*x)^-1//2+6*a^2*b^-4*(a+b*x)^(1/2))
@test integrate(x^2*(a+b*x)^-3//2, x) == :(2//3*b^-3*(a+b*x)^3//2+-4*a*b^-3*(a+b*x)^(1/2)+-2*a^2*b^-3*(a+b*x)^-1//2)
@test integrate(x*(a+b*x)^-3//2, x) == :(2*b^-2*(a+b*x)^(1/2)+2*a*b^-2*(a+b*x)^-1//2)
@test integrate((a+b*x)^-3//2, x) == :(-2*b^-1*(a+b*x)^-1//2)
@test integrate(x^-1*(a+b*x)^-3//2, x) == :(-2*a^-3//2*arctanh(a^-1//2*(a+b*x)^(1/2))+2*a^-1*(a+b*x)^-1//2)
@test integrate(x^-2*(a+b*x)^-3//2, x) == :(-1*a^-1*x^-1*(a+b*x)^-1//2+-3*b*a^-2*(a+b*x)^-1//2+3*b*a^-5//2*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^-3*(a+b*x)^-3//2, x) == :(-15//4*a^-7//2*b^2*arctanh(a^-1//2*(a+b*x)^(1/2))+-1//2*a^-1*x^-2*(a+b*x)^-1//2+15//4*a^-3*b^2*(a+b*x)^-1//2+5//4*b*a^-2*x^-1*(a+b*x)^-1//2)
@test integrate(x^4*(a+b*x)^-5//2, x) == :(2//5*b^-5*(a+b*x)^5//2+8*a^3*b^-5*(a+b*x)^-1//2+12*a^2*b^-5*(a+b*x)^(1/2)+-8//3*a*b^-5*(a+b*x)^3//2+-2//3*a^4*b^-5*(a+b*x)^-3//2)
@test integrate(x^3*(a+b*x)^-5//2, x) == :(2//3*b^-4*(a+b*x)^3//2+-6*a*b^-4*(a+b*x)^(1/2)+-6*a^2*b^-4*(a+b*x)^-1//2+2//3*a^3*b^-4*(a+b*x)^-3//2)
@test integrate(x^2*(a+b*x)^-5//2, x) == :(2*b^-3*(a+b*x)^(1/2)+4*a*b^-3*(a+b*x)^-1//2+-2//3*a^2*b^-3*(a+b*x)^-3//2)
@test integrate(x*(a+b*x)^-5//2, x) == :(-2*b^-2*(a+b*x)^-1//2+2//3*a*b^-2*(a+b*x)^-3//2)
@test integrate((a+b*x)^-5//2, x) == :(-2//3*b^-1*(a+b*x)^-3//2)
@test integrate(x^-1*(a+b*x)^-5//2, x) == :(-2*a^-5//2*arctanh(a^-1//2*(a+b*x)^(1/2))+2*a^-2*(a+b*x)^-1//2+2//3*a^-1*(a+b*x)^-3//2)
@test integrate(x^-2*(a+b*x)^-5//2, x) == :(-1*a^-1*x^-1*(a+b*x)^-3//2+-5*b*a^-3*(a+b*x)^-1//2+5*b*a^-7//2*arctanh(a^-1//2*(a+b*x)^(1/2))+-5//3*b*a^-2*(a+b*x)^-3//2)
@test integrate(x^-3*(a+b*x)^-5//2, x) == :(-35//4*a^-9//2*b^2*arctanh(a^-1//2*(a+b*x)^(1/2))+-1//2*a^-1*x^-2*(a+b*x)^-3//2+35//4*a^-4*b^2*(a+b*x)^-1//2+35//12*a^-3*b^2*(a+b*x)^-3//2+7//4*b*a^-2*x^-1*(a+b*x)^-3//2)
@test integrate(x^-1*(-1a+b*x)^-1//2, x) == :(2*a^-1//2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-2*(-1a+b*x)^-1//2, x) == :(b*a^-3//2*arctan(a^-1//2*(-1a+b*x)^(1/2))+a^-1*x^-1*(-1a+b*x)^(1/2))
@test integrate(x^-3*(-1a+b*x)^-1//2, x) == :((1/2)*a^-1*x^-2*(-1a+b*x)^(1/2)+3//4*a^-5//2*b^2*arctan(a^-1//2*(-1a+b*x)^(1/2))+3//4*b*a^-2*x^-1*(-1a+b*x)^(1/2))
@test integrate(x^-1*(-1a+b*x)^-3//2, x) == :(-2*a^-1*(-1a+b*x)^-1//2+-2*a^-3//2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-2*(-1a+b*x)^-3//2, x) == :(a^-1*x^-1*(-1a+b*x)^-1//2+-3*b*a^-2*(-1a+b*x)^-1//2+-3*b*a^-5//2*arctan(a^-1//2*(-1a+b*x)^(1/2)))
@test integrate(x^-3*(-1a+b*x)^-3//2, x) == :((1/2)*a^-1*x^-2*(-1a+b*x)^-1//2+-15//4*a^-3*b^2*(-1a+b*x)^-1//2+-15//4*a^-7//2*b^2*arctan(a^-1//2*(-1a+b*x)^(1/2))+5//4*b*a^-2*x^-1*(-1a+b*x)^-1//2)
@test integrate(x^-1*(-1a+b*x)^-5//2, x) == :(2*a^-2*(-1a+b*x)^-1//2+2*a^-5//2*arctan(a^-1//2*(-1a+b*x)^(1/2))+-2//3*a^-1*(-1a+b*x)^-3//2)
@test integrate(x^-2*(-1a+b*x)^-5//2, x) == :(a^-1*x^-1*(-1a+b*x)^-3//2+5*b*a^-3*(-1a+b*x)^-1//2+5*b*a^-7//2*arctan(a^-1//2*(-1a+b*x)^(1/2))+-5//3*b*a^-2*(-1a+b*x)^-3//2)
@test integrate(x^-3*(-1a+b*x)^-5//2, x) == :((1/2)*a^-1*x^-2*(-1a+b*x)^-3//2+-35//12*a^-3*b^2*(-1a+b*x)^-3//2+35//4*a^-4*b^2*(-1a+b*x)^-1//2+35//4*a^-9//2*b^2*arctan(a^-1//2*(-1a+b*x)^(1/2))+7//4*b*a^-2*x^-1*(-1a+b*x)^-3//2)
@test integrate((1/2)*x^(-1+m)*(a+b*x)^-3//2*(2*a*m+b*x*(-1+2m)), x) == :(x^m*(a+b*x)^-1//2)
@test integrate(m*x^(-1+m)*(a+b*x)^-1//2+-1//2*b*x^m*(a+b*x)^-3//2, x) == :(x^m*(a+b*x)^-1//2)
@test integrate(x^-1*(a+b*x)^-1//2, x) == :(-2*a^-1//2*arctanh(a^-1//2*(a+b*x)^(1/2)))
@test integrate(x^3*(a+b*x)^1//3, x) == :(3//13*b^-4*(a+b*x)^13//3+-9//10*a*b^-4*(a+b*x)^10//3+-3//4*a^3*b^-4*(a+b*x)^4//3+9//7*a^2*b^-4*(a+b*x)^7//3)
@test integrate(x^2*(a+b*x)^1//3, x) == :(3//10*b^-3*(a+b*x)^10//3+-6//7*a*b^-3*(a+b*x)^7//3+3//4*a^2*b^-3*(a+b*x)^4//3)
@test integrate(x*(a+b*x)^1//3, x) == :(3//7*b^-2*(a+b*x)^7//3+-3//4*a*b^-2*(a+b*x)^4//3)
@test integrate((a+b*x)^1//3, x) == :(3//4*b^-1*(a+b*x)^4//3)
@test integrate(x^-1*(a+b*x)^1//3, x) == :(3*(a+b*x)^1//3+-1//2*a^1//3*log(x)+3//2*a^1//3*log(a^1//3+-1*(a+b*x)^1//3)+-1*3^(1/2)*a^1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-2*(a+b*x)^1//3, x) == :(-1*x^-1*(a+b*x)^1//3+(1/2)*b*a^-2//3*log(a^1//3+-1*(a+b*x)^1//3)+-1//6*b*a^-2//3*log(x)+-1//3*b*3^(1/2)*a^-2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-3*(a+b*x)^1//3, x) == :(-1//2*x^-2*(a+b*x)^1//3+-1//6*a^-5//3*b^2*log(a^1//3+-1*(a+b*x)^1//3)+1//18*a^-5//3*b^2*log(x)+-1//6*b*a^-1*x^-1*(a+b*x)^1//3+1//9*3^(1/2)*a^-5//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^3*(a+b*x)^2//3, x) == :(3//14*b^-4*(a+b*x)^14//3+-9//11*a*b^-4*(a+b*x)^11//3+-3//5*a^3*b^-4*(a+b*x)^5//3+9//8*a^2*b^-4*(a+b*x)^8//3)
@test integrate(x^2*(a+b*x)^2//3, x) == :(3//11*b^-3*(a+b*x)^11//3+-3//4*a*b^-3*(a+b*x)^8//3+3//5*a^2*b^-3*(a+b*x)^5//3)
@test integrate(x*(a+b*x)^2//3, x) == :(3//8*b^-2*(a+b*x)^8//3+-3//5*a*b^-2*(a+b*x)^5//3)
@test integrate((a+b*x)^2//3, x) == :(3//5*b^-1*(a+b*x)^5//3)
@test integrate(x^-1*(a+b*x)^2//3, x) == :(3//2*(a+b*x)^2//3+-1//2*a^2//3*log(x)+3//2*a^2//3*log(a^1//3+-1*(a+b*x)^1//3)+3^(1/2)*a^2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-2*(a+b*x)^2//3, x) == :(-1*x^-1*(a+b*x)^2//3+b*a^-1//3*log(a^1//3+-1*(a+b*x)^1//3)+-1//3*b*a^-1//3*log(x)+2//3*b*3^(1/2)*a^-1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-3*(a+b*x)^2//3, x) == :(-1//2*x^-2*(a+b*x)^2//3+-1//6*a^-4//3*b^2*log(a^1//3+-1*(a+b*x)^1//3)+1//18*a^-4//3*b^2*log(x)+-1//3*b*a^-1*x^-1*(a+b*x)^2//3+-1//9*3^(1/2)*a^-4//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^3*(a+b*x)^4//3, x) == :(3//16*b^-4*(a+b*x)^16//3+-9//13*a*b^-4*(a+b*x)^13//3+-3//7*a^3*b^-4*(a+b*x)^7//3+9//10*a^2*b^-4*(a+b*x)^10//3)
@test integrate(x^2*(a+b*x)^4//3, x) == :(3//13*b^-3*(a+b*x)^13//3+-3//5*a*b^-3*(a+b*x)^10//3+3//7*a^2*b^-3*(a+b*x)^7//3)
@test integrate(x*(a+b*x)^4//3, x) == :(3//10*b^-2*(a+b*x)^10//3+-3//7*a*b^-2*(a+b*x)^7//3)
@test integrate((a+b*x)^4//3, x) == :(3//7*b^-1*(a+b*x)^7//3)
@test integrate(x^-1*(a+b*x)^4//3, x) == :(3//4*(a+b*x)^4//3+3*a*(a+b*x)^1//3+-1//2*a^4//3*log(x)+3//2*a^4//3*log(a^1//3+-1*(a+b*x)^1//3)+-1*3^(1/2)*a^4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-2*(a+b*x)^4//3, x) == :(-1*x^-1*(a+b*x)^4//3+4*b*(a+b*x)^1//3+2*b*a^1//3*log(a^1//3+-1*(a+b*x)^1//3)+-2//3*b*a^1//3*log(x)+-4//3*b*3^(1/2)*a^1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-3*(a+b*x)^4//3, x) == :(-1//2*x^-2*(a+b*x)^4//3+-2//3*b*x^-1*(a+b*x)^1//3+-1//9*a^-2//3*b^2*log(x)+1//3*a^-2//3*b^2*log(a^1//3+-1*(a+b*x)^1//3)+-2//9*3^(1/2)*a^-2//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^3*(a+b*x)^-1//3, x) == :(3//11*b^-4*(a+b*x)^11//3+-9//8*a*b^-4*(a+b*x)^8//3+-3//2*a^3*b^-4*(a+b*x)^2//3+9//5*a^2*b^-4*(a+b*x)^5//3)
@test integrate(x^2*(a+b*x)^-1//3, x) == :(3//8*b^-3*(a+b*x)^8//3+-6//5*a*b^-3*(a+b*x)^5//3+3//2*a^2*b^-3*(a+b*x)^2//3)
@test integrate(x*(a+b*x)^-1//3, x) == :(3//5*b^-2*(a+b*x)^5//3+-3//2*a*b^-2*(a+b*x)^2//3)
@test integrate((a+b*x)^-1//3, x) == :(3//2*b^-1*(a+b*x)^2//3)
@test integrate(x^-1*(a+b*x)^-1//3, x) == :(-1//2*a^-1//3*log(x)+3//2*a^-1//3*log(a^1//3+-1*(a+b*x)^1//3)+3^(1/2)*a^-1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-2*(a+b*x)^-1//3, x) == :(-1*a^-1*x^-1*(a+b*x)^2//3+-1//2*b*a^-4//3*log(a^1//3+-1*(a+b*x)^1//3)+1//6*b*a^-4//3*log(x)+-1//3*b*3^(1/2)*a^-4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-3*(a+b*x)^-1//3, x) == :(-1//2*a^-1*x^-2*(a+b*x)^2//3+-1//9*a^-7//3*b^2*log(x)+1//3*a^-7//3*b^2*log(a^1//3+-1*(a+b*x)^1//3)+2//3*b*a^-2*x^-1*(a+b*x)^2//3+2//9*3^(1/2)*a^-7//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^3*(-1a+b*x)^-1//3, x) == :(3//11*b^-4*(-1a+b*x)^11//3+3//2*a^3*b^-4*(-1a+b*x)^2//3+9//5*a^2*b^-4*(-1a+b*x)^5//3+9//8*a*b^-4*(-1a+b*x)^8//3)
@test integrate(x^2*(-1a+b*x)^-1//3, x) == :(3//8*b^-3*(-1a+b*x)^8//3+3//2*a^2*b^-3*(-1a+b*x)^2//3+6//5*a*b^-3*(-1a+b*x)^5//3)
@test integrate(x*(-1a+b*x)^-1//3, x) == :(3//5*b^-2*(-1a+b*x)^5//3+3//2*a*b^-2*(-1a+b*x)^2//3)
@test integrate((-1a+b*x)^-1//3, x) == :(3//2*b^-1*(-1a+b*x)^2//3)
@test integrate(x^-1*(-1a+b*x)^-1//3, x) == :((1/2)*a^-1//3*log(x)+-3//2*a^-1//3*log(a^1//3+(-1a+b*x)^1//3)+-1*3^(1/2)*a^-1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*(-1a+b*x)^1//3)))
@test integrate(x^-2*(-1a+b*x)^-1//3, x) == :(a^-1*x^-1*(-1a+b*x)^2//3+-1//2*b*a^-4//3*log(a^1//3+(-1a+b*x)^1//3)+1//6*b*a^-4//3*log(x)+-1//3*b*3^(1/2)*a^-4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*(-1a+b*x)^1//3)))
@test integrate(x^-3*(-1a+b*x)^-1//3, x) == :((1/2)*a^-1*x^-2*(-1a+b*x)^2//3+-1//3*a^-7//3*b^2*log(a^1//3+(-1a+b*x)^1//3)+1//9*a^-7//3*b^2*log(x)+-2//9*3^(1/2)*a^-7//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*(-1a+b*x)^1//3))+2//3*b*a^-2*x^-1*(-1a+b*x)^2//3)
@test integrate(x^3*(a+b*x)^-2//3, x) == :(3//10*b^-4*(a+b*x)^10//3+-3*a^3*b^-4*(a+b*x)^1//3+-9//7*a*b^-4*(a+b*x)^7//3+9//4*a^2*b^-4*(a+b*x)^4//3)
@test integrate(x^2*(a+b*x)^-2//3, x) == :(3//7*b^-3*(a+b*x)^7//3+3*a^2*b^-3*(a+b*x)^1//3+-3//2*a*b^-3*(a+b*x)^4//3)
@test integrate(x*(a+b*x)^-2//3, x) == :(3//4*b^-2*(a+b*x)^4//3+-3*a*b^-2*(a+b*x)^1//3)
@test integrate((a+b*x)^-2//3, x) == :(3*b^-1*(a+b*x)^1//3)
@test integrate(x^-1*(a+b*x)^-2//3, x) == :(-1//2*a^-2//3*log(x)+3//2*a^-2//3*log(a^1//3+-1*(a+b*x)^1//3)+-1*3^(1/2)*a^-2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-2*(a+b*x)^-2//3, x) == :(-1*b*a^-5//3*log(a^1//3+-1*(a+b*x)^1//3)+-1*a^-1*x^-1*(a+b*x)^1//3+1//3*b*a^-5//3*log(x)+2//3*b*3^(1/2)*a^-5//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-3*(a+b*x)^-2//3, x) == :(-5//18*a^-8//3*b^2*log(x)+-1//2*a^-1*x^-2*(a+b*x)^1//3+5//6*a^-8//3*b^2*log(a^1//3+-1*(a+b*x)^1//3)+-5//9*3^(1/2)*a^-8//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3))+5//6*b*a^-2*x^-1*(a+b*x)^1//3)
@test integrate(x^3*(a+b*x)^-4//3, x) == :(3//8*b^-4*(a+b*x)^8//3+3*a^3*b^-4*(a+b*x)^-1//3+-9//5*a*b^-4*(a+b*x)^5//3+9//2*a^2*b^-4*(a+b*x)^2//3)
@test integrate(x^2*(a+b*x)^-4//3, x) == :(3//5*b^-3*(a+b*x)^5//3+-3*a*b^-3*(a+b*x)^2//3+-3*a^2*b^-3*(a+b*x)^-1//3)
@test integrate(x*(a+b*x)^-4//3, x) == :(3//2*b^-2*(a+b*x)^2//3+3*a*b^-2*(a+b*x)^-1//3)
@test integrate((a+b*x)^-4//3, x) == :(-3*b^-1*(a+b*x)^-1//3)
@test integrate(x^-1*(a+b*x)^-4//3, x) == :(3*a^-1*(a+b*x)^-1//3+-1//2*a^-4//3*log(x)+3//2*a^-4//3*log(a^1//3+-1*(a+b*x)^1//3)+3^(1/2)*a^-4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-2*(a+b*x)^-4//3, x) == :(-1*a^-1*x^-1*(a+b*x)^-1//3+-4*b*a^-2*(a+b*x)^-1//3+-2*b*a^-7//3*log(a^1//3+-1*(a+b*x)^1//3)+2//3*b*a^-7//3*log(x)+-4//3*b*3^(1/2)*a^-7//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-3*(a+b*x)^-4//3, x) == :(-7//9*a^-10//3*b^2*log(x)+-1//2*a^-1*x^-2*(a+b*x)^-1//3+7//3*a^-10//3*b^2*log(a^1//3+-1*(a+b*x)^1//3)+14//3*a^-3*b^2*(a+b*x)^-1//3+7//6*b*a^-2*x^-1*(a+b*x)^-1//3+14//9*3^(1/2)*a^-10//3*b^2*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+2*(a+b*x)^1//3)))
@test integrate(x^-1*(a^3+x*b^3)^-1//3, x) == :(-1//2*a^-1*log(x)+3//2*a^-1*log(a+-1*(a^3+x*b^3)^1//3)+3^(1/2)*a^-1*arctan(1//3*3^(1/2)*a^-1*(a+2*(a^3+x*b^3)^1//3)))
@test integrate(x^-1*(a^3+-1*x*b^3)^-1//3, x) == :(-1//2*a^-1*log(x)+3//2*a^-1*log(a+-1*(a^3+-1*x*b^3)^1//3)+3^(1/2)*a^-1*arctan(1//3*3^(1/2)*a^-1*(a+2*(a^3+-1*x*b^3)^1//3)))
@test integrate(x^-1*(-1*a^3+x*b^3)^-1//3, x) == :((1/2)*a^-1*log(x)+-3//2*a^-1*log(a+(-1*a^3+x*b^3)^1//3)+-1*3^(1/2)*a^-1*arctan(1//3*3^(1/2)*a^-1*(a+-2*(-1*a^3+x*b^3)^1//3)))
@test integrate(x^-1*(-1*a^3+-1*x*b^3)^-1//3, x) == :((1/2)*a^-1*log(x)+-3//2*a^-1*log(a+(-1*a^3+-1*x*b^3)^1//3)+-1*3^(1/2)*a^-1*arctan(1//3*3^(1/2)*a^-1*(a+-2*(-1*a^3+-1*x*b^3)^1//3)))
@test integrate(x^-1*(a^3+x*b^3)^-2//3, x) == :(-1//2*a^-2*log(x)+3//2*a^-2*log(a+-1*(a^3+x*b^3)^1//3)+-1*3^(1/2)*a^-2*arctan(1//3*3^(1/2)*a^-1*(a+2*(a^3+x*b^3)^1//3)))
@test integrate(x^-1*(a^3+-1*x*b^3)^-2//3, x) == :(-1//2*a^-2*log(x)+3//2*a^-2*log(a+-1*(a^3+-1*x*b^3)^1//3)+-1*3^(1/2)*a^-2*arctan(1//3*3^(1/2)*a^-1*(a+2*(a^3+-1*x*b^3)^1//3)))
@test integrate(x^-1*(-1*a^3+x*b^3)^-2//3, x) == :(-1//2*a^-2*log(x)+3//2*a^-2*log(a+(-1*a^3+x*b^3)^1//3)+-1*3^(1/2)*a^-2*arctan(1//3*3^(1/2)*a^-1*(a+-2*(-1*a^3+x*b^3)^1//3)))
@test integrate(x^-1*(-1*a^3+-1*x*b^3)^-2//3, x) == :(-1//2*a^-2*log(x)+3//2*a^-2*log(a+(-1*a^3+-1*x*b^3)^1//3)+-1*3^(1/2)*a^-2*arctan(1//3*3^(1/2)*a^-1*(a+-2*(-1*a^3+-1*x*b^3)^1//3)))
@test integrate(x^m*(a+b*x), x) == :(a*x^(1+m)*(1+m)^-1+b*x^(2+m)*(2+m)^-1)
@test integrate(x^5//2*(a+b*x), x) == :(2//7*a*x^7//2+2//9*b*x^9//2)
@test integrate(x^3//2*(a+b*x), x) == :(2//5*a*x^5//2+2//7*b*x^7//2)
@test integrate(x^(1/2)*(a+b*x), x) == :(2//3*a*x^3//2+2//5*b*x^5//2)
@test integrate(x^-1//2*(a+b*x), x) == :(2*a*x^(1/2)+2//3*b*x^3//2)
@test integrate(x^-3//2*(a+b*x), x) == :(-2*a*x^-1//2+2*b*x^(1/2))
@test integrate(x^-5//2*(a+b*x), x) == :(-2*b*x^-1//2+-2//3*a*x^-3//2)
@test integrate(x^m*(a+b*x)^2, x) == :(a^2*x^(1+m)*(1+m)^-1+b^2*x^(3+m)*(3+m)^-1+2*a*b*x^(2+m)*(2+m)^-1)
@test integrate(x^5//2*(a+b*x)^2, x) == :(2//7*a^2*x^7//2+2//11*b^2*x^11//2+4//9*a*b*x^9//2)
@test integrate(x^3//2*(a+b*x)^2, x) == :(2//5*a^2*x^5//2+2//9*b^2*x^9//2+4//7*a*b*x^7//2)
@test integrate(x^(1/2)*(a+b*x)^2, x) == :(2//3*a^2*x^3//2+2//7*b^2*x^7//2+4//5*a*b*x^5//2)
@test integrate(x^-1//2*(a+b*x)^2, x) == :(2*a^2*x^(1/2)+2//5*b^2*x^5//2+4//3*a*b*x^3//2)
@test integrate(x^-3//2*(a+b*x)^2, x) == :(-2*a^2*x^-1//2+2//3*b^2*x^3//2+4*a*b*x^(1/2))
@test integrate(x^-5//2*(a+b*x)^2, x) == :(2*b^2*x^(1/2)+-2//3*a^2*x^-3//2+-4*a*b*x^-1//2)
@test integrate(x^m*(a+b*x)^3, x) == :(a^3*x^(1+m)*(1+m)^-1+b^3*x^(4+m)*(4+m)^-1+3*a*b^2*x^(3+m)*(3+m)^-1+3*b*a^2*x^(2+m)*(2+m)^-1)
@test integrate(x^5//2*(a+b*x)^3, x) == :(2//7*a^3*x^7//2+2//13*b^3*x^13//2+2//3*b*a^2*x^9//2+6//11*a*b^2*x^11//2)
@test integrate(x^3//2*(a+b*x)^3, x) == :(2//5*a^3*x^5//2+2//11*b^3*x^11//2+2//3*a*b^2*x^9//2+6//7*b*a^2*x^7//2)
@test integrate(x^(1/2)*(a+b*x)^3, x) == :(2//3*a^3*x^3//2+2//9*b^3*x^9//2+6//5*b*a^2*x^5//2+6//7*a*b^2*x^7//2)
@test integrate(x^-1//2*(a+b*x)^3, x) == :(2*a^3*x^(1/2)+2//7*b^3*x^7//2+2*b*a^2*x^3//2+6//5*a*b^2*x^5//2)
@test integrate(x^-3//2*(a+b*x)^3, x) == :(-2*a^3*x^-1//2+2//5*b^3*x^5//2+2*a*b^2*x^3//2+6*b*a^2*x^(1/2))
@test integrate(x^-5//2*(a+b*x)^3, x) == :(-2//3*a^3*x^-3//2+2//3*b^3*x^3//2+-6*b*a^2*x^-1//2+6*a*b^2*x^(1/2))
@test integrate(x^5//2*(a+b*x)^-1, x) == :(2//5*b^-1*x^5//2+-2*a^5//2*b^-7//2*arctan(a^-1//2*b^(1/2)*x^(1/2))+2*a^2*b^-3*x^(1/2)+-2//3*a*b^-2*x^3//2)
@test integrate(x^3//2*(a+b*x)^-1, x) == :(2//3*b^-1*x^3//2+-2*a*b^-2*x^(1/2)+2*a^3//2*b^-5//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^(1/2)*(a+b*x)^-1, x) == :(2*b^-1*x^(1/2)+-2*a^(1/2)*b^-3//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-1//2*(a+b*x)^-1, x) == :(2*a^-1//2*b^-1//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(a+b*x)^-1, x) == :(-2*a^-1*x^-1//2+-2*a^-3//2*b^(1/2)*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-5//2*(a+b*x)^-1, x) == :(-2//3*a^-1*x^-3//2+2*b*a^-2*x^-1//2+2*a^-5//2*b^3//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-7//2*(a+b*x)^-1, x) == :(-2//5*a^-1*x^-5//2+-2*a^-3*b^2*x^-1//2+-2*a^-7//2*b^5//2*arctan(a^-1//2*b^(1/2)*x^(1/2))+2//3*b*a^-2*x^-3//2)
@test integrate(x^5//2*(a+b*x)^-2, x) == :(5//3*b^-2*x^3//2+-1*b^-1*x^5//2*(a+b*x)^-1+-5*a*b^-3*x^(1/2)+5*a^3//2*b^-7//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^3//2*(a+b*x)^-2, x) == :(3*b^-2*x^(1/2)+-1*b^-1*x^3//2*(a+b*x)^-1+-3*a^(1/2)*b^-5//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^(1/2)*(a+b*x)^-2, x) == :(a^-1//2*b^-3//2*arctan(a^-1//2*b^(1/2)*x^(1/2))+-1*b^-1*x^(1/2)*(a+b*x)^-1)
@test integrate(x^-1//2*(a+b*x)^-2, x) == :(a^-1*x^(1/2)*(a+b*x)^-1+a^-3//2*b^-1//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(a+b*x)^-2, x) == :(-3*a^-2*x^-1//2+a^-1*x^-1//2*(a+b*x)^-1+-3*a^-5//2*b^(1/2)*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-5//2*(a+b*x)^-2, x) == :(-5//3*a^-2*x^-3//2+a^-1*x^-3//2*(a+b*x)^-1+5*b*a^-3*x^-1//2+5*a^-7//2*b^3//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^7//2*(a+b*x)^-3, x) == :(35//12*b^-3*x^3//2+-35//4*a*b^-4*x^(1/2)+-7//4*b^-2*x^5//2*(a+b*x)^-1+-1//2*b^-1*x^7//2*(a+b*x)^-2+35//4*a^3//2*b^-9//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^5//2*(a+b*x)^-3, x) == :(15//4*b^-3*x^(1/2)+-15//4*a^(1/2)*b^-7//2*arctan(a^-1//2*b^(1/2)*x^(1/2))+-5//4*b^-2*x^3//2*(a+b*x)^-1+-1//2*b^-1*x^5//2*(a+b*x)^-2)
@test integrate(x^3//2*(a+b*x)^-3, x) == :(-3//4*b^-2*x^(1/2)*(a+b*x)^-1+-1//2*b^-1*x^3//2*(a+b*x)^-2+3//4*a^-1//2*b^-5//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^(1/2)*(a+b*x)^-3, x) == :(-1//2*b^-1*x^(1/2)*(a+b*x)^-2+1//4*a^-3//2*b^-3//2*arctan(a^-1//2*b^(1/2)*x^(1/2))+1//4*a^-1*b^-1*x^(1/2)*(a+b*x)^-1)
@test integrate(x^-1//2*(a+b*x)^-3, x) == :((1/2)*a^-1*x^(1/2)*(a+b*x)^-2+3//4*a^-2*x^(1/2)*(a+b*x)^-1+3//4*a^-5//2*b^-1//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(a+b*x)^-3, x) == :(-15//4*a^-3*x^-1//2+(1/2)*a^-1*x^-1//2*(a+b*x)^-2+-15//4*a^-7//2*b^(1/2)*arctan(a^-1//2*b^(1/2)*x^(1/2))+5//4*a^-2*x^-1//2*(a+b*x)^-1)
@test integrate(x^-5//2*(a+b*x)^-3, x) == :(-35//12*a^-3*x^-3//2+(1/2)*a^-1*x^-3//2*(a+b*x)^-2+7//4*a^-2*x^-3//2*(a+b*x)^-1+35//4*b*a^-4*x^-1//2+35//4*a^-9//2*b^3//2*arctan(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^5//2*(-1a+b*x)^-1, x) == :(2//5*b^-1*x^5//2+-2*a^5//2*b^-7//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+2*a^2*b^-3*x^(1/2)+2//3*a*b^-2*x^3//2)
@test integrate(x^3//2*(-1a+b*x)^-1, x) == :(2//3*b^-1*x^3//2+-2*a^3//2*b^-5//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+2*a*b^-2*x^(1/2))
@test integrate(x^(1/2)*(-1a+b*x)^-1, x) == :(2*b^-1*x^(1/2)+-2*a^(1/2)*b^-3//2*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-1//2*(-1a+b*x)^-1, x) == :(-2*a^-1//2*b^-1//2*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(-1a+b*x)^-1, x) == :(2*a^-1*x^-1//2+-2*a^-3//2*b^(1/2)*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-5//2*(-1a+b*x)^-1, x) == :(2//3*a^-1*x^-3//2+-2*a^-5//2*b^3//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+2*b*a^-2*x^-1//2)
@test integrate(x^-7//2*(-1a+b*x)^-1, x) == :(2//5*a^-1*x^-5//2+-2*a^-7//2*b^5//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+2*a^-3*b^2*x^-1//2+2//3*b*a^-2*x^-3//2)
@test integrate(x^5//2*(-1a+b*x)^-2, x) == :(5//3*b^-2*x^3//2+b^-1*x^5//2*(a+-1*b*x)^-1+-5*a^3//2*b^-7//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+5*a*b^-3*x^(1/2))
@test integrate(x^3//2*(-1a+b*x)^-2, x) == :(3*b^-2*x^(1/2)+b^-1*x^3//2*(a+-1*b*x)^-1+-3*a^(1/2)*b^-5//2*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^(1/2)*(-1a+b*x)^-2, x) == :(b^-1*x^(1/2)*(a+-1*b*x)^-1+-1*a^-1//2*b^-3//2*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-1//2*(-1a+b*x)^-2, x) == :(a^-1*x^(1/2)*(a+-1*b*x)^-1+a^-3//2*b^-1//2*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(-1a+b*x)^-2, x) == :(-3*a^-2*x^-1//2+a^-1*x^-1//2*(a+-1*b*x)^-1+3*a^-5//2*b^(1/2)*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^-5//2*(-1a+b*x)^-2, x) == :(-5//3*a^-2*x^-3//2+a^-1*x^-3//2*(a+-1*b*x)^-1+-5*b*a^-3*x^-1//2+5*a^-7//2*b^3//2*arctanh(a^-1//2*b^(1/2)*x^(1/2)))
@test integrate(x^7//2*(-1a+b*x)^-3, x) == :(35//12*b^-3*x^3//2+-35//4*a^3//2*b^-9//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+-1//2*b^-1*x^7//2*(a+-1*b*x)^-2+7//4*b^-2*x^5//2*(a+-1*b*x)^-1+35//4*a*b^-4*x^(1/2))
@test integrate(x^5//2*(-1a+b*x)^-3, x) == :(15//4*b^-3*x^(1/2)+-15//4*a^(1/2)*b^-7//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+-1//2*b^-1*x^5//2*(a+-1*b*x)^-2+5//4*b^-2*x^3//2*(a+-1*b*x)^-1)
@test integrate(x^3//2*(-1a+b*x)^-3, x) == :(-3//4*a^-1//2*b^-5//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+-1//2*b^-1*x^3//2*(a+-1*b*x)^-2+3//4*b^-2*x^(1/2)*(a+-1*b*x)^-1)
@test integrate(x^(1/2)*(-1a+b*x)^-3, x) == :(-1//2*b^-1*x^(1/2)*(a+-1*b*x)^-2+1//4*a^-3//2*b^-3//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+1//4*a^-1*b^-1*x^(1/2)*(a+-1*b*x)^-1)
@test integrate(x^-1//2*(-1a+b*x)^-3, x) == :(-3//4*a^-2*x^(1/2)*(a+-1*b*x)^-1+-3//4*a^-5//2*b^-1//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+-1//2*a^-1*x^(1/2)*(a+-1*b*x)^-2)
@test integrate(x^-3//2*(-1a+b*x)^-3, x) == :(15//4*a^-3*x^-1//2+-15//4*a^-7//2*b^(1/2)*arctanh(a^-1//2*b^(1/2)*x^(1/2))+-5//4*a^-2*x^-1//2*(a+-1*b*x)^-1+-1//2*a^-1*x^-1//2*(a+-1*b*x)^-2)
@test integrate(x^-5//2*(-1a+b*x)^-3, x) == :(35//12*a^-3*x^-3//2+-35//4*a^-9//2*b^3//2*arctanh(a^-1//2*b^(1/2)*x^(1/2))+-7//4*a^-2*x^-3//2*(a+-1*b*x)^-1+-1//2*a^-1*x^-3//2*(a+-1*b*x)^-2+35//4*b*a^-4*x^-1//2)
@test integrate(x^5//2*(a+b*x)^(1/2), x) == :(1//4*x^7//2*(a+b*x)^(1/2)+-5//64*a^4*b^-7//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-5//96*a^2*b^-2*x^3//2*(a+b*x)^(1/2)+1//24*a*b^-1*x^5//2*(a+b*x)^(1/2)+5//64*a^3*b^-3*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^3//2*(a+b*x)^(1/2), x) == :(1//3*x^5//2*(a+b*x)^(1/2)+1//8*a^3*b^-5//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-1//8*a^2*b^-2*x^(1/2)*(a+b*x)^(1/2)+1//12*a*b^-1*x^3//2*(a+b*x)^(1/2))
@test integrate(x^(1/2)*(a+b*x)^(1/2), x) == :((1/2)*x^3//2*(a+b*x)^(1/2)+-1//4*a^2*b^-3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+1//4*a*b^-1*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^-1//2*(a+b*x)^(1/2), x) == :(x^(1/2)*(a+b*x)^(1/2)+a*b^-1//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2))
@test integrate(x^-3//2*(a+b*x)^(1/2), x) == :(-2*x^-1//2*(a+b*x)^(1/2)+2*b^(1/2)*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2))
@test integrate(x^-5//2*(a+b*x)^(1/2), x) == :(-2//3*a^-1*x^-3//2*(a+b*x)^3//2)
@test integrate(x^-7//2*(a+b*x)^(1/2), x) == :(-2//5*a^-1*x^-5//2*(a+b*x)^3//2+4//15*b*a^-2*x^-3//2*(a+b*x)^3//2)
@test integrate(x^-9//2*(a+b*x)^(1/2), x) == :(-2//7*a^-1*x^-7//2*(a+b*x)^3//2+-16//105*a^-3*b^2*x^-3//2*(a+b*x)^3//2+8//35*b*a^-2*x^-5//2*(a+b*x)^3//2)
@test integrate(x^5//2*(a+-1*b*x)^(1/2), x) == :(1//4*x^7//2*(a+-1*b*x)^(1/2)+5//64*a^4*b^-7//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-5//64*a^3*b^-3*x^(1/2)*(a+-1*b*x)^(1/2)+-5//96*a^2*b^-2*x^3//2*(a+-1*b*x)^(1/2)+-1//24*a*b^-1*x^5//2*(a+-1*b*x)^(1/2))
@test integrate(x^3//2*(a+-1*b*x)^(1/2), x) == :(1//3*x^5//2*(a+-1*b*x)^(1/2)+1//8*a^3*b^-5//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-1//8*a^2*b^-2*x^(1/2)*(a+-1*b*x)^(1/2)+-1//12*a*b^-1*x^3//2*(a+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(a+-1*b*x)^(1/2), x) == :((1/2)*x^3//2*(a+-1*b*x)^(1/2)+1//4*a^2*b^-3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-1//4*a*b^-1*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^-1//2*(a+-1*b*x)^(1/2), x) == :(x^(1/2)*(a+-1*b*x)^(1/2)+a*b^-1//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2))
@test integrate(x^-3//2*(a+-1*b*x)^(1/2), x) == :(-2*b^(1/2)*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-2*x^-1//2*(a+-1*b*x)^(1/2))
@test integrate(x^-5//2*(a+-1*b*x)^(1/2), x) == :(-2//3*a^-1*x^-3//2*(a+-1*b*x)^3//2)
@test integrate(x^-7//2*(a+-1*b*x)^(1/2), x) == :(-2//5*a^-1*x^-5//2*(a+-1*b*x)^3//2+-4//15*b*a^-2*x^-3//2*(a+-1*b*x)^3//2)
@test integrate(x^-9//2*(a+-1*b*x)^(1/2), x) == :(-2//7*a^-1*x^-7//2*(a+-1*b*x)^3//2+-16//105*a^-3*b^2*x^-3//2*(a+-1*b*x)^3//2+-8//35*b*a^-2*x^-5//2*(a+-1*b*x)^3//2)
@test integrate(x^5//2*(2+b*x)^(1/2), x) == :(-5//4*b^-7//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//4*x^7//2*(2+b*x)^(1/2)+-5//24*b^-2*x^3//2*(2+b*x)^(1/2)+1//12*b^-1*x^5//2*(2+b*x)^(1/2)+5//8*b^-3*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^3//2*(2+b*x)^(1/2), x) == :(b^-5//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//3*x^5//2*(2+b*x)^(1/2)+-1//2*b^-2*x^(1/2)*(2+b*x)^(1/2)+1//6*b^-1*x^3//2*(2+b*x)^(1/2))
@test integrate(x^(1/2)*(2+b*x)^(1/2), x) == :((1/2)*x^3//2*(2+b*x)^(1/2)+-1*b^-3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+(1/2)*b^-1*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-1//2*(2+b*x)^(1/2), x) == :(x^(1/2)*(2+b*x)^(1/2)+2*b^-1//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(2+b*x)^(1/2), x) == :(-2*x^-1//2*(2+b*x)^(1/2)+2*b^(1/2)*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2)))
@test integrate(x^-5//2*(2+b*x)^(1/2), x) == :(-1//3*x^-3//2*(2+b*x)^3//2)
@test integrate(x^-7//2*(2+b*x)^(1/2), x) == :(-1//5*x^-5//2*(2+b*x)^3//2+1//15*b*x^-3//2*(2+b*x)^3//2)
@test integrate(x^-9//2*(2+b*x)^(1/2), x) == :(-1//7*x^-7//2*(2+b*x)^3//2+-2//105*b^2*x^-3//2*(2+b*x)^3//2+2//35*b*x^-5//2*(2+b*x)^3//2)
@test integrate(x^5//2*(2+-1*b*x)^(1/2), x) == :(1//4*x^7//2*(2+-1*b*x)^(1/2)+5//4*b^-7//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-5//8*b^-3*x^(1/2)*(2+-1*b*x)^(1/2)+-5//24*b^-2*x^3//2*(2+-1*b*x)^(1/2)+-1//12*b^-1*x^5//2*(2+-1*b*x)^(1/2))
@test integrate(x^3//2*(2+-1*b*x)^(1/2), x) == :(b^-5//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//3*x^5//2*(2+-1*b*x)^(1/2)+-1//2*b^-2*x^(1/2)*(2+-1*b*x)^(1/2)+-1//6*b^-1*x^3//2*(2+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(2+-1*b*x)^(1/2), x) == :(b^-3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+(1/2)*x^3//2*(2+-1*b*x)^(1/2)+-1//2*b^-1*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^-1//2*(2+-1*b*x)^(1/2), x) == :(x^(1/2)*(2+-1*b*x)^(1/2)+2*b^-1//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(2+-1*b*x)^(1/2), x) == :(-2*b^(1/2)*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^-5//2*(2+-1*b*x)^(1/2), x) == :(-1//3*x^-3//2*(2+-1*b*x)^3//2)
@test integrate(x^-7//2*(2+-1*b*x)^(1/2), x) == :(-1//5*x^-5//2*(2+-1*b*x)^3//2+-1//15*b*x^-3//2*(2+-1*b*x)^3//2)
@test integrate(x^-9//2*(2+-1*b*x)^(1/2), x) == :(-1//7*x^-7//2*(2+-1*b*x)^3//2+-2//35*b*x^-5//2*(2+-1*b*x)^3//2+-2//105*b^2*x^-3//2*(2+-1*b*x)^3//2)
@test integrate(x^5//2*(a+b*x)^3//2, x) == :(1//5*x^7//2*(a+b*x)^3//2+-3//128*a^5*b^-7//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+3//40*a*x^7//2*(a+b*x)^(1/2)+-1//64*a^3*b^-2*x^3//2*(a+b*x)^(1/2)+1//80*a^2*b^-1*x^5//2*(a+b*x)^(1/2)+3//128*a^4*b^-3*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^3//2*(a+b*x)^3//2, x) == :(1//4*x^5//2*(a+b*x)^3//2+1//8*a*x^5//2*(a+b*x)^(1/2)+3//64*a^4*b^-5//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-3//64*a^3*b^-2*x^(1/2)*(a+b*x)^(1/2)+1//32*a^2*b^-1*x^3//2*(a+b*x)^(1/2))
@test integrate(x^(1/2)*(a+b*x)^3//2, x) == :(1//3*x^3//2*(a+b*x)^3//2+-1//8*a^3*b^-3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+1//4*a*x^3//2*(a+b*x)^(1/2)+1//8*a^2*b^-1*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^-1//2*(a+b*x)^3//2, x) == :((1/2)*x^(1/2)*(a+b*x)^3//2+3//4*a*x^(1/2)*(a+b*x)^(1/2)+3//4*a^2*b^-1//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2))
@test integrate(x^-3//2*(a+b*x)^3//2, x) == :(-2*x^-1//2*(a+b*x)^3//2+3*a*b^(1/2)*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+3*b*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^-5//2*(a+b*x)^3//2, x) == :(2*b^3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-2//3*x^-3//2*(a+b*x)^3//2+-2*b*x^-1//2*(a+b*x)^(1/2))
@test integrate(x^5//2*(a+-1*b*x)^3//2, x) == :(1//5*x^7//2*(a+-1*b*x)^3//2+3//40*a*x^7//2*(a+-1*b*x)^(1/2)+3//128*a^5*b^-7//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-3//128*a^4*b^-3*x^(1/2)*(a+-1*b*x)^(1/2)+-1//64*a^3*b^-2*x^3//2*(a+-1*b*x)^(1/2)+-1//80*a^2*b^-1*x^5//2*(a+-1*b*x)^(1/2))
@test integrate(x^3//2*(a+-1*b*x)^3//2, x) == :(1//4*x^5//2*(a+-1*b*x)^3//2+1//8*a*x^5//2*(a+-1*b*x)^(1/2)+3//64*a^4*b^-5//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-3//64*a^3*b^-2*x^(1/2)*(a+-1*b*x)^(1/2)+-1//32*a^2*b^-1*x^3//2*(a+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(a+-1*b*x)^3//2, x) == :(1//3*x^3//2*(a+-1*b*x)^3//2+1//4*a*x^3//2*(a+-1*b*x)^(1/2)+1//8*a^3*b^-3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-1//8*a^2*b^-1*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^-1//2*(a+-1*b*x)^3//2, x) == :((1/2)*x^(1/2)*(a+-1*b*x)^3//2+3//4*a*x^(1/2)*(a+-1*b*x)^(1/2)+3//4*a^2*b^-1//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2))
@test integrate(x^-3//2*(a+-1*b*x)^3//2, x) == :(-2*x^-1//2*(a+-1*b*x)^3//2+-3*a*b^(1/2)*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-3*b*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^-5//2*(a+-1*b*x)^3//2, x) == :(2*b^3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-2//3*x^-3//2*(a+-1*b*x)^3//2+2*b*x^-1//2*(a+-1*b*x)^(1/2))
@test integrate(x^5//2*(2+b*x)^3//2, x) == :(-3//4*b^-7//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//5*x^7//2*(2+b*x)^3//2+3//20*x^7//2*(2+b*x)^(1/2)+-1//8*b^-2*x^3//2*(2+b*x)^(1/2)+1//20*b^-1*x^5//2*(2+b*x)^(1/2)+3//8*b^-3*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^3//2*(2+b*x)^3//2, x) == :(1//4*x^5//2*(2+b*x)^(1/2)+1//4*x^5//2*(2+b*x)^3//2+3//4*b^-5//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-3//8*b^-2*x^(1/2)*(2+b*x)^(1/2)+1//8*b^-1*x^3//2*(2+b*x)^(1/2))
@test integrate(x^(1/2)*(2+b*x)^3//2, x) == :((1/2)*x^3//2*(2+b*x)^(1/2)+-1*b^-3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//3*x^3//2*(2+b*x)^3//2+(1/2)*b^-1*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-1//2*(2+b*x)^3//2, x) == :((1/2)*x^(1/2)*(2+b*x)^3//2+3*b^-1//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+3//2*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-3//2*(2+b*x)^3//2, x) == :(-2*x^-1//2*(2+b*x)^3//2+6*b^(1/2)*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+3*b*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-5//2*(2+b*x)^3//2, x) == :(2*b^3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2//3*x^-3//2*(2+b*x)^3//2+-2*b*x^-1//2*(2+b*x)^(1/2))
@test integrate(x^5//2*(2+-1*b*x)^3//2, x) == :(1//5*x^7//2*(2+-1*b*x)^3//2+3//4*b^-7//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+3//20*x^7//2*(2+-1*b*x)^(1/2)+-3//8*b^-3*x^(1/2)*(2+-1*b*x)^(1/2)+-1//8*b^-2*x^3//2*(2+-1*b*x)^(1/2)+-1//20*b^-1*x^5//2*(2+-1*b*x)^(1/2))
@test integrate(x^3//2*(2+-1*b*x)^3//2, x) == :(1//4*x^5//2*(2+-1*b*x)^(1/2)+1//4*x^5//2*(2+-1*b*x)^3//2+3//4*b^-5//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-3//8*b^-2*x^(1/2)*(2+-1*b*x)^(1/2)+-1//8*b^-1*x^3//2*(2+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(2+-1*b*x)^3//2, x) == :(b^-3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+(1/2)*x^3//2*(2+-1*b*x)^(1/2)+1//3*x^3//2*(2+-1*b*x)^3//2+-1//2*b^-1*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^-1//2*(2+-1*b*x)^3//2, x) == :((1/2)*x^(1/2)*(2+-1*b*x)^3//2+3*b^-1//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+3//2*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^-3//2*(2+-1*b*x)^3//2, x) == :(-6*b^(1/2)*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*x^-1//2*(2+-1*b*x)^3//2+-3*b*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^-5//2*(2+-1*b*x)^3//2, x) == :(2*b^3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2//3*x^-3//2*(2+-1*b*x)^3//2+2*b*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^5//2*(a+b*x)^5//2, x) == :(1//6*x^7//2*(a+b*x)^5//2+-5//512*a^6*b^-7//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+1//12*a*x^7//2*(a+b*x)^3//2+1//32*a^2*x^7//2*(a+b*x)^(1/2)+-5//768*a^4*b^-2*x^3//2*(a+b*x)^(1/2)+1//192*a^3*b^-1*x^5//2*(a+b*x)^(1/2)+5//512*a^5*b^-3*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^3//2*(a+b*x)^5//2, x) == :(1//5*x^5//2*(a+b*x)^5//2+1//8*a*x^5//2*(a+b*x)^3//2+1//16*a^2*x^5//2*(a+b*x)^(1/2)+3//128*a^5*b^-5//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-3//128*a^4*b^-2*x^(1/2)*(a+b*x)^(1/2)+1//64*a^3*b^-1*x^3//2*(a+b*x)^(1/2))
@test integrate(x^(1/2)*(a+b*x)^5//2, x) == :(1//4*x^3//2*(a+b*x)^5//2+-5//64*a^4*b^-3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+5//24*a*x^3//2*(a+b*x)^3//2+5//32*a^2*x^3//2*(a+b*x)^(1/2)+5//64*a^3*b^-1*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^-1//2*(a+b*x)^5//2, x) == :(1//3*x^(1/2)*(a+b*x)^5//2+5//8*a^2*x^(1/2)*(a+b*x)^(1/2)+5//8*a^3*b^-1//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+5//12*a*x^(1/2)*(a+b*x)^3//2)
@test integrate(x^-3//2*(a+b*x)^5//2, x) == :(-2*x^-1//2*(a+b*x)^5//2+5//2*b*x^(1/2)*(a+b*x)^3//2+15//4*a^2*b^(1/2)*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+15//4*a*b*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^-5//2*(a+b*x)^5//2, x) == :(-2//3*x^-3//2*(a+b*x)^5//2+5*a*b^3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+5*b^2*x^(1/2)*(a+b*x)^(1/2)+-10//3*b*x^-1//2*(a+b*x)^3//2)
@test integrate(x^5//2*(a+-1*b*x)^5//2, x) == :(1//6*x^7//2*(a+-1*b*x)^5//2+1//12*a*x^7//2*(a+-1*b*x)^3//2+1//32*a^2*x^7//2*(a+-1*b*x)^(1/2)+5//512*a^6*b^-7//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-5//512*a^5*b^-3*x^(1/2)*(a+-1*b*x)^(1/2)+-5//768*a^4*b^-2*x^3//2*(a+-1*b*x)^(1/2)+-1//192*a^3*b^-1*x^5//2*(a+-1*b*x)^(1/2))
@test integrate(x^3//2*(a+-1*b*x)^5//2, x) == :(1//5*x^5//2*(a+-1*b*x)^5//2+1//8*a*x^5//2*(a+-1*b*x)^3//2+1//16*a^2*x^5//2*(a+-1*b*x)^(1/2)+3//128*a^5*b^-5//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-3//128*a^4*b^-2*x^(1/2)*(a+-1*b*x)^(1/2)+-1//64*a^3*b^-1*x^3//2*(a+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(a+-1*b*x)^5//2, x) == :(1//4*x^3//2*(a+-1*b*x)^5//2+5//24*a*x^3//2*(a+-1*b*x)^3//2+5//32*a^2*x^3//2*(a+-1*b*x)^(1/2)+5//64*a^4*b^-3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-5//64*a^3*b^-1*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^-1//2*(a+-1*b*x)^5//2, x) == :(1//3*x^(1/2)*(a+-1*b*x)^5//2+5//8*a^2*x^(1/2)*(a+-1*b*x)^(1/2)+5//8*a^3*b^-1//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+5//12*a*x^(1/2)*(a+-1*b*x)^3//2)
@test integrate(x^-3//2*(a+-1*b*x)^5//2, x) == :(-2*x^-1//2*(a+-1*b*x)^5//2+-15//4*a^2*b^(1/2)*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-5//2*b*x^(1/2)*(a+-1*b*x)^3//2+-15//4*a*b*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^-5//2*(a+-1*b*x)^5//2, x) == :(-2//3*x^-3//2*(a+-1*b*x)^5//2+5*a*b^3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+5*b^2*x^(1/2)*(a+-1*b*x)^(1/2)+10//3*b*x^-1//2*(a+-1*b*x)^3//2)
@test integrate(x^5//2*(2+b*x)^5//2, x) == :(-5//8*b^-7//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//6*x^7//2*(2+b*x)^3//2+1//6*x^7//2*(2+b*x)^5//2+1//8*x^7//2*(2+b*x)^(1/2)+-5//48*b^-2*x^3//2*(2+b*x)^(1/2)+1//24*b^-1*x^5//2*(2+b*x)^(1/2)+5//16*b^-3*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^3//2*(2+b*x)^5//2, x) == :(1//4*x^5//2*(2+b*x)^(1/2)+1//4*x^5//2*(2+b*x)^3//2+1//5*x^5//2*(2+b*x)^5//2+3//4*b^-5//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-3//8*b^-2*x^(1/2)*(2+b*x)^(1/2)+1//8*b^-1*x^3//2*(2+b*x)^(1/2))
@test integrate(x^(1/2)*(2+b*x)^5//2, x) == :(-5//4*b^-3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//4*x^3//2*(2+b*x)^5//2+5//8*x^3//2*(2+b*x)^(1/2)+5//12*x^3//2*(2+b*x)^3//2+5//8*b^-1*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-1//2*(2+b*x)^5//2, x) == :(5*b^-1//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//3*x^(1/2)*(2+b*x)^5//2+5//2*x^(1/2)*(2+b*x)^(1/2)+5//6*x^(1/2)*(2+b*x)^3//2)
@test integrate(x^-3//2*(2+b*x)^5//2, x) == :(-2*x^-1//2*(2+b*x)^5//2+15*b^(1/2)*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+5//2*b*x^(1/2)*(2+b*x)^3//2+15//2*b*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-5//2*(2+b*x)^5//2, x) == :(10*b^3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2//3*x^-3//2*(2+b*x)^5//2+5*b^2*x^(1/2)*(2+b*x)^(1/2)+-10//3*b*x^-1//2*(2+b*x)^3//2)
@test integrate(x^5//2*(2+-1*b*x)^5//2, x) == :(1//6*x^7//2*(2+-1*b*x)^3//2+1//6*x^7//2*(2+-1*b*x)^5//2+1//8*x^7//2*(2+-1*b*x)^(1/2)+5//8*b^-7//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-5//16*b^-3*x^(1/2)*(2+-1*b*x)^(1/2)+-5//48*b^-2*x^3//2*(2+-1*b*x)^(1/2)+-1//24*b^-1*x^5//2*(2+-1*b*x)^(1/2))
@test integrate(x^3//2*(2+-1*b*x)^5//2, x) == :(1//4*x^5//2*(2+-1*b*x)^(1/2)+1//4*x^5//2*(2+-1*b*x)^3//2+1//5*x^5//2*(2+-1*b*x)^5//2+3//4*b^-5//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-3//8*b^-2*x^(1/2)*(2+-1*b*x)^(1/2)+-1//8*b^-1*x^3//2*(2+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(2+-1*b*x)^5//2, x) == :(1//4*x^3//2*(2+-1*b*x)^5//2+5//4*b^-3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+5//8*x^3//2*(2+-1*b*x)^(1/2)+5//12*x^3//2*(2+-1*b*x)^3//2+-5//8*b^-1*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^-1//2*(2+-1*b*x)^5//2, x) == :(5*b^-1//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+1//3*x^(1/2)*(2+-1*b*x)^5//2+5//2*x^(1/2)*(2+-1*b*x)^(1/2)+5//6*x^(1/2)*(2+-1*b*x)^3//2)
@test integrate(x^-3//2*(2+-1*b*x)^5//2, x) == :(-15*b^(1/2)*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*x^-1//2*(2+-1*b*x)^5//2+-15//2*b*x^(1/2)*(2+-1*b*x)^(1/2)+-5//2*b*x^(1/2)*(2+-1*b*x)^3//2)
@test integrate(x^-5//2*(2+-1*b*x)^5//2, x) == :(10*b^3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2//3*x^-3//2*(2+-1*b*x)^5//2+5*b^2*x^(1/2)*(2+-1*b*x)^(1/2)+10//3*b*x^-1//2*(2+-1*b*x)^3//2)
@test integrate(x^5//2*(a+b*x)^-1//2, x) == :(-5//8*a^3*b^-7//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+1//3*b^-1*x^5//2*(a+b*x)^(1/2)+-5//12*a*b^-2*x^3//2*(a+b*x)^(1/2)+5//8*a^2*b^-3*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^3//2*(a+b*x)^-1//2, x) == :((1/2)*b^-1*x^3//2*(a+b*x)^(1/2)+3//4*a^2*b^-5//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-3//4*a*b^-2*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^(1/2)*(a+b*x)^-1//2, x) == :(b^-1*x^(1/2)*(a+b*x)^(1/2)+-1*a*b^-3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2))
@test integrate(x^-1//2*(a+b*x)^-1//2, x) == :(2*b^-1//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2))
@test integrate(x^-3//2*(a+b*x)^-1//2, x) == :(-2*a^-1*x^-1//2*(a+b*x)^(1/2))
@test integrate(x^-5//2*(a+b*x)^-1//2, x) == :(-2//3*a^-1*x^-3//2*(a+b*x)^(1/2)+4//3*b*a^-2*x^-1//2*(a+b*x)^(1/2))
@test integrate(x^-7//2*(a+b*x)^-1//2, x) == :(-2//5*a^-1*x^-5//2*(a+b*x)^(1/2)+-16//15*a^-3*b^2*x^-1//2*(a+b*x)^(1/2)+8//15*b*a^-2*x^-3//2*(a+b*x)^(1/2))
@test integrate(x^-9//2*(a+b*x)^-1//2, x) == :(-2//7*a^-1*x^-7//2*(a+b*x)^(1/2)+-16//35*a^-3*b^2*x^-3//2*(a+b*x)^(1/2)+12//35*b*a^-2*x^-5//2*(a+b*x)^(1/2)+32//35*a^-4*b^3*x^-1//2*(a+b*x)^(1/2))
@test integrate(x^5//2*(a+b*x)^-3//2, x) == :(-2*b^-1*x^5//2*(a+b*x)^-1//2+5//2*b^-2*x^3//2*(a+b*x)^(1/2)+15//4*a^2*b^-7//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-15//4*a*b^-3*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^3//2*(a+b*x)^-3//2, x) == :(-3*a*b^-5//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-2*b^-1*x^3//2*(a+b*x)^-1//2+3*b^-2*x^(1/2)*(a+b*x)^(1/2))
@test integrate(x^(1/2)*(a+b*x)^-3//2, x) == :(2*b^-3//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-2*b^-1*x^(1/2)*(a+b*x)^-1//2)
@test integrate(x^-1//2*(a+b*x)^-3//2, x) == :(2*a^-1*x^(1/2)*(a+b*x)^-1//2)
@test integrate(x^-3//2*(a+b*x)^-3//2, x) == :(-4*a^-2*x^-1//2*(a+b*x)^(1/2)+2*a^-1*x^-1//2*(a+b*x)^-1//2)
@test integrate(x^-5//2*(a+b*x)^-3//2, x) == :(2*a^-1*x^-3//2*(a+b*x)^-1//2+-8//3*a^-2*x^-3//2*(a+b*x)^(1/2)+16//3*b*a^-3*x^-1//2*(a+b*x)^(1/2))
@test integrate(x^-7//2*(a+b*x)^-3//2, x) == :(2*a^-1*x^-5//2*(a+b*x)^-1//2+-12//5*a^-2*x^-5//2*(a+b*x)^(1/2)+-32//5*a^-4*b^2*x^-1//2*(a+b*x)^(1/2)+16//5*b*a^-3*x^-3//2*(a+b*x)^(1/2))
@test integrate(x^5//2*(a+b*x)^-5//2, x) == :(-5*a*b^-7//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+5*b^-3*x^(1/2)*(a+b*x)^(1/2)+-10//3*b^-2*x^3//2*(a+b*x)^-1//2+-2//3*b^-1*x^5//2*(a+b*x)^-3//2)
@test integrate(x^3//2*(a+b*x)^-5//2, x) == :(2*b^-5//2*arctanh(b^(1/2)*x^(1/2)*(a+b*x)^-1//2)+-2*b^-2*x^(1/2)*(a+b*x)^-1//2+-2//3*b^-1*x^3//2*(a+b*x)^-3//2)
@test integrate(x^(1/2)*(a+b*x)^-5//2, x) == :(2//3*a^-1*x^3//2*(a+b*x)^-3//2)
@test integrate(x^-1//2*(a+b*x)^-5//2, x) == :(2//3*a^-1*x^(1/2)*(a+b*x)^-3//2+4//3*a^-2*x^(1/2)*(a+b*x)^-1//2)
@test integrate(x^-3//2*(a+b*x)^-5//2, x) == :(-16//3*a^-3*x^-1//2*(a+b*x)^(1/2)+2//3*a^-1*x^-1//2*(a+b*x)^-3//2+8//3*a^-2*x^-1//2*(a+b*x)^-1//2)
@test integrate(x^-5//2*(a+b*x)^-5//2, x) == :(4*a^-2*x^-3//2*(a+b*x)^-1//2+-16//3*a^-3*x^-3//2*(a+b*x)^(1/2)+2//3*a^-1*x^-3//2*(a+b*x)^-3//2+32//3*b*a^-4*x^-1//2*(a+b*x)^(1/2))
@test integrate(x^5//2*(a+-1*b*x)^-1//2, x) == :(-1//3*b^-1*x^5//2*(a+-1*b*x)^(1/2)+5//8*a^3*b^-7//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-5//8*a^2*b^-3*x^(1/2)*(a+-1*b*x)^(1/2)+-5//12*a*b^-2*x^3//2*(a+-1*b*x)^(1/2))
@test integrate(x^3//2*(a+-1*b*x)^-1//2, x) == :(-1//2*b^-1*x^3//2*(a+-1*b*x)^(1/2)+3//4*a^2*b^-5//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-3//4*a*b^-2*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(a+-1*b*x)^-1//2, x) == :(a*b^-3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-1*b^-1*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^-1//2*(a+-1*b*x)^-1//2, x) == :(2*b^-1//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2))
@test integrate(x^-3//2*(a+-1*b*x)^-1//2, x) == :(-2*a^-1*x^-1//2*(a+-1*b*x)^(1/2))
@test integrate(x^-5//2*(a+-1*b*x)^-1//2, x) == :(-2//3*a^-1*x^-3//2*(a+-1*b*x)^(1/2)+-4//3*b*a^-2*x^-1//2*(a+-1*b*x)^(1/2))
@test integrate(x^5//2*(a+-1*b*x)^-3//2, x) == :(2*b^-1*x^5//2*(a+-1*b*x)^-1//2+-15//4*a^2*b^-7//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+5//2*b^-2*x^3//2*(a+-1*b*x)^(1/2)+15//4*a*b^-3*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^3//2*(a+-1*b*x)^-3//2, x) == :(-3*a*b^-5//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+2*b^-1*x^3//2*(a+-1*b*x)^-1//2+3*b^-2*x^(1/2)*(a+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(a+-1*b*x)^-3//2, x) == :(-2*b^-3//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+2*b^-1*x^(1/2)*(a+-1*b*x)^-1//2)
@test integrate(x^-1//2*(a+-1*b*x)^-3//2, x) == :(2*a^-1*x^(1/2)*(a+-1*b*x)^-1//2)
@test integrate(x^-3//2*(a+-1*b*x)^-3//2, x) == :(-4*a^-2*x^-1//2*(a+-1*b*x)^(1/2)+2*a^-1*x^-1//2*(a+-1*b*x)^-1//2)
@test integrate(x^-5//2*(a+-1*b*x)^-3//2, x) == :(2*a^-1*x^-3//2*(a+-1*b*x)^-1//2+-8//3*a^-2*x^-3//2*(a+-1*b*x)^(1/2)+-16//3*b*a^-3*x^-1//2*(a+-1*b*x)^(1/2))
@test integrate(x^5//2*(a+-1*b*x)^-5//2, x) == :(-5*b^-3*x^(1/2)*(a+-1*b*x)^(1/2)+5*a*b^-7//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-10//3*b^-2*x^3//2*(a+-1*b*x)^-1//2+2//3*b^-1*x^5//2*(a+-1*b*x)^-3//2)
@test integrate(x^3//2*(a+-1*b*x)^-5//2, x) == :(2*b^-5//2*arctan(b^(1/2)*x^(1/2)*(a+-1*b*x)^-1//2)+-2*b^-2*x^(1/2)*(a+-1*b*x)^-1//2+2//3*b^-1*x^3//2*(a+-1*b*x)^-3//2)
@test integrate(x^(1/2)*(a+-1*b*x)^-5//2, x) == :(2//3*a^-1*x^3//2*(a+-1*b*x)^-3//2)
@test integrate(x^-1//2*(a+-1*b*x)^-5//2, x) == :(2//3*a^-1*x^(1/2)*(a+-1*b*x)^-3//2+4//3*a^-2*x^(1/2)*(a+-1*b*x)^-1//2)
@test integrate(x^-3//2*(a+-1*b*x)^-5//2, x) == :(-16//3*a^-3*x^-1//2*(a+-1*b*x)^(1/2)+2//3*a^-1*x^-1//2*(a+-1*b*x)^-3//2+8//3*a^-2*x^-1//2*(a+-1*b*x)^-1//2)
@test integrate(x^-5//2*(a+-1*b*x)^-5//2, x) == :(4*a^-2*x^-3//2*(a+-1*b*x)^-1//2+-16//3*a^-3*x^-3//2*(a+-1*b*x)^(1/2)+2//3*a^-1*x^-3//2*(a+-1*b*x)^-3//2+-32//3*b*a^-4*x^-1//2*(a+-1*b*x)^(1/2))
@test integrate(x^5//2*(2+b*x)^-1//2, x) == :(-5*b^-7//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-5//6*b^-2*x^3//2*(2+b*x)^(1/2)+1//3*b^-1*x^5//2*(2+b*x)^(1/2)+5//2*b^-3*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^3//2*(2+b*x)^-1//2, x) == :(3*b^-5//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+(1/2)*b^-1*x^3//2*(2+b*x)^(1/2)+-3//2*b^-2*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^(1/2)*(2+b*x)^-1//2, x) == :(-2*b^-3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+b^-1*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^-1//2*(2+b*x)^-1//2, x) == :(2*b^-1//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(2+b*x)^-1//2, x) == :(-1*x^-1//2*(2+b*x)^(1/2))
@test integrate(x^-5//2*(2+b*x)^-1//2, x) == :(-1//3*x^-3//2*(2+b*x)^(1/2)+1//3*b*x^-1//2*(2+b*x)^(1/2))
@test integrate(x^-7//2*(2+b*x)^-1//2, x) == :(-1//5*x^-5//2*(2+b*x)^(1/2)+-2//15*b^2*x^-1//2*(2+b*x)^(1/2)+2//15*b*x^-3//2*(2+b*x)^(1/2))
@test integrate(x^-9//2*(2+b*x)^-1//2, x) == :(-1//7*x^-7//2*(2+b*x)^(1/2)+-2//35*b^2*x^-3//2*(2+b*x)^(1/2)+2//35*b^3*x^-1//2*(2+b*x)^(1/2)+3//35*b*x^-5//2*(2+b*x)^(1/2))
@test integrate(x^5//2*(2+b*x)^-3//2, x) == :(15*b^-7//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*b^-1*x^5//2*(2+b*x)^-1//2+-15//2*b^-3*x^(1/2)*(2+b*x)^(1/2)+5//2*b^-2*x^3//2*(2+b*x)^(1/2))
@test integrate(x^3//2*(2+b*x)^-3//2, x) == :(-6*b^-5//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*b^-1*x^3//2*(2+b*x)^-1//2+3*b^-2*x^(1/2)*(2+b*x)^(1/2))
@test integrate(x^(1/2)*(2+b*x)^-3//2, x) == :(2*b^-3//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*b^-1*x^(1/2)*(2+b*x)^-1//2)
@test integrate(x^-1//2*(2+b*x)^-3//2, x) == :(x^(1/2)*(2+b*x)^-1//2)
@test integrate(x^-3//2*(2+b*x)^-3//2, x) == :(x^-1//2*(2+b*x)^-1//2+-1*x^-1//2*(2+b*x)^(1/2))
@test integrate(x^-5//2*(2+b*x)^-3//2, x) == :(x^-3//2*(2+b*x)^-1//2+-2//3*x^-3//2*(2+b*x)^(1/2)+2//3*b*x^-1//2*(2+b*x)^(1/2))
@test integrate(x^-7//2*(2+b*x)^-3//2, x) == :(x^-5//2*(2+b*x)^-1//2+-3//5*x^-5//2*(2+b*x)^(1/2)+-2//5*b^2*x^-1//2*(2+b*x)^(1/2)+2//5*b*x^-3//2*(2+b*x)^(1/2))
@test integrate(x^5//2*(2+b*x)^-5//2, x) == :(-10*b^-7//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+5*b^-3*x^(1/2)*(2+b*x)^(1/2)+-10//3*b^-2*x^3//2*(2+b*x)^-1//2+-2//3*b^-1*x^5//2*(2+b*x)^-3//2)
@test integrate(x^3//2*(2+b*x)^-5//2, x) == :(2*b^-5//2*arcsinh((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*b^-2*x^(1/2)*(2+b*x)^-1//2+-2//3*b^-1*x^3//2*(2+b*x)^-3//2)
@test integrate(x^(1/2)*(2+b*x)^-5//2, x) == :(1//3*x^3//2*(2+b*x)^-3//2)
@test integrate(x^-1//2*(2+b*x)^-5//2, x) == :(1//3*x^(1/2)*(2+b*x)^-3//2+1//3*x^(1/2)*(2+b*x)^-1//2)
@test integrate(x^-3//2*(2+b*x)^-5//2, x) == :(-2//3*x^-1//2*(2+b*x)^(1/2)+1//3*x^-1//2*(2+b*x)^-3//2+2//3*x^-1//2*(2+b*x)^-1//2)
@test integrate(x^-5//2*(2+b*x)^-5//2, x) == :(x^-3//2*(2+b*x)^-1//2+-2//3*x^-3//2*(2+b*x)^(1/2)+1//3*x^-3//2*(2+b*x)^-3//2+2//3*b*x^-1//2*(2+b*x)^(1/2))
@test integrate(x^5//2*(2+-1*b*x)^-1//2, x) == :(5*b^-7//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-5//2*b^-3*x^(1/2)*(2+-1*b*x)^(1/2)+-5//6*b^-2*x^3//2*(2+-1*b*x)^(1/2)+-1//3*b^-1*x^5//2*(2+-1*b*x)^(1/2))
@test integrate(x^3//2*(2+-1*b*x)^-1//2, x) == :(3*b^-5//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-3//2*b^-2*x^(1/2)*(2+-1*b*x)^(1/2)+-1//2*b^-1*x^3//2*(2+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(2+-1*b*x)^-1//2, x) == :(2*b^-3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-1*b^-1*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^-1//2*(2+-1*b*x)^-1//2, x) == :(2*b^-1//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2)))
@test integrate(x^-3//2*(2+-1*b*x)^-1//2, x) == :(-1*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^-5//2*(2+-1*b*x)^-1//2, x) == :(-1//3*x^-3//2*(2+-1*b*x)^(1/2)+-1//3*b*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^5//2*(2+-1*b*x)^-3//2, x) == :(-15*b^-7//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+2*b^-1*x^5//2*(2+-1*b*x)^-1//2+5//2*b^-2*x^3//2*(2+-1*b*x)^(1/2)+15//2*b^-3*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^3//2*(2+-1*b*x)^-3//2, x) == :(-6*b^-5//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+2*b^-1*x^3//2*(2+-1*b*x)^-1//2+3*b^-2*x^(1/2)*(2+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(2+-1*b*x)^-3//2, x) == :(-2*b^-3//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+2*b^-1*x^(1/2)*(2+-1*b*x)^-1//2)
@test integrate(x^-1//2*(2+-1*b*x)^-3//2, x) == :(x^(1/2)*(2+-1*b*x)^-1//2)
@test integrate(x^-3//2*(2+-1*b*x)^-3//2, x) == :(x^-1//2*(2+-1*b*x)^-1//2+-1*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^-5//2*(2+-1*b*x)^-3//2, x) == :(x^-3//2*(2+-1*b*x)^-1//2+-2//3*x^-3//2*(2+-1*b*x)^(1/2)+-2//3*b*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^5//2*(2+-1*b*x)^-5//2, x) == :(10*b^-7//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-5*b^-3*x^(1/2)*(2+-1*b*x)^(1/2)+-10//3*b^-2*x^3//2*(2+-1*b*x)^-1//2+2//3*b^-1*x^5//2*(2+-1*b*x)^-3//2)
@test integrate(x^3//2*(2+-1*b*x)^-5//2, x) == :(2*b^-5//2*arcsin((1/2)*2^(1/2)*b^(1/2)*x^(1/2))+-2*b^-2*x^(1/2)*(2+-1*b*x)^-1//2+2//3*b^-1*x^3//2*(2+-1*b*x)^-3//2)
@test integrate(x^(1/2)*(2+-1*b*x)^-5//2, x) == :(1//3*x^3//2*(2+-1*b*x)^-3//2)
@test integrate(x^-1//2*(2+-1*b*x)^-5//2, x) == :(1//3*x^(1/2)*(2+-1*b*x)^-3//2+1//3*x^(1/2)*(2+-1*b*x)^-1//2)
@test integrate(x^-3//2*(2+-1*b*x)^-5//2, x) == :(-2//3*x^-1//2*(2+-1*b*x)^(1/2)+1//3*x^-1//2*(2+-1*b*x)^-3//2+2//3*x^-1//2*(2+-1*b*x)^-1//2)
@test integrate(x^-5//2*(2+-1*b*x)^-5//2, x) == :(x^-3//2*(2+-1*b*x)^-1//2+-2//3*x^-3//2*(2+-1*b*x)^(1/2)+1//3*x^-3//2*(2+-1*b*x)^-3//2+-2//3*b*x^-1//2*(2+-1*b*x)^(1/2))
@test integrate(x^(1/2)*(1+-1x)^-1//2, x) == :(-1//2*arcsin(1+-2x)+-1*x^(1/2)*(1+-1x)^(1/2))
@test integrate(x^-1//2*(1+-1x)^-1//2, x) == :(-1*arcsin(1+-2x))
@test integrate(x^-1//2*(1+-1*b*x)^-1//2, x) == :(2*b^-1//2*arcsin(b^(1/2)*x^(1/2)))
@test integrate(x^5//3*(a+b*x), x) == :(3//8*a*x^8//3+3//11*b*x^11//3)
@test integrate(x^4//3*(a+b*x), x) == :(3//7*a*x^7//3+3//10*b*x^10//3)
@test integrate(x^2//3*(a+b*x), x) == :(3//5*a*x^5//3+3//8*b*x^8//3)
@test integrate(x^1//3*(a+b*x), x) == :(3//4*a*x^4//3+3//7*b*x^7//3)
@test integrate(x^-1//3*(a+b*x), x) == :(3//2*a*x^2//3+3//5*b*x^5//3)
@test integrate(x^-2//3*(a+b*x), x) == :(3*a*x^1//3+3//4*b*x^4//3)
@test integrate(x^-4//3*(a+b*x), x) == :(-3*a*x^-1//3+3//2*b*x^2//3)
@test integrate(x^-5//3*(a+b*x), x) == :(3*b*x^1//3+-3//2*a*x^-2//3)
@test integrate(x^5//3*(a+b*x)^2, x) == :(3//8*a^2*x^8//3+3//14*b^2*x^14//3+6//11*a*b*x^11//3)
@test integrate(x^4//3*(a+b*x)^2, x) == :(3//7*a^2*x^7//3+3//13*b^2*x^13//3+3//5*a*b*x^10//3)
@test integrate(x^2//3*(a+b*x)^2, x) == :(3//5*a^2*x^5//3+3//11*b^2*x^11//3+3//4*a*b*x^8//3)
@test integrate(x^1//3*(a+b*x)^2, x) == :(3//4*a^2*x^4//3+3//10*b^2*x^10//3+6//7*a*b*x^7//3)
@test integrate(x^-1//3*(a+b*x)^2, x) == :(3//2*a^2*x^2//3+3//8*b^2*x^8//3+6//5*a*b*x^5//3)
@test integrate(x^-2//3*(a+b*x)^2, x) == :(3*a^2*x^1//3+3//7*b^2*x^7//3+3//2*a*b*x^4//3)
@test integrate(x^-4//3*(a+b*x)^2, x) == :(-3*a^2*x^-1//3+3//5*b^2*x^5//3+3*a*b*x^2//3)
@test integrate(x^-5//3*(a+b*x)^2, x) == :(-3//2*a^2*x^-2//3+3//4*b^2*x^4//3+6*a*b*x^1//3)
@test integrate(x^5//3*(a+b*x)^3, x) == :(3//8*a^3*x^8//3+3//17*b^3*x^17//3+9//11*b*a^2*x^11//3+9//14*a*b^2*x^14//3)
@test integrate(x^4//3*(a+b*x)^3, x) == :(3//7*a^3*x^7//3+3//16*b^3*x^16//3+9//10*b*a^2*x^10//3+9//13*a*b^2*x^13//3)
@test integrate(x^2//3*(a+b*x)^3, x) == :(3//5*a^3*x^5//3+3//14*b^3*x^14//3+9//8*b*a^2*x^8//3+9//11*a*b^2*x^11//3)
@test integrate(x^1//3*(a+b*x)^3, x) == :(3//4*a^3*x^4//3+3//13*b^3*x^13//3+9//7*b*a^2*x^7//3+9//10*a*b^2*x^10//3)
@test integrate(x^-1//3*(a+b*x)^3, x) == :(3//2*a^3*x^2//3+3//11*b^3*x^11//3+9//5*b*a^2*x^5//3+9//8*a*b^2*x^8//3)
@test integrate(x^-2//3*(a+b*x)^3, x) == :(3*a^3*x^1//3+3//10*b^3*x^10//3+9//4*b*a^2*x^4//3+9//7*a*b^2*x^7//3)
@test integrate(x^-4//3*(a+b*x)^3, x) == :(-3*a^3*x^-1//3+3//8*b^3*x^8//3+9//2*b*a^2*x^2//3+9//5*a*b^2*x^5//3)
@test integrate(x^-5//3*(a+b*x)^3, x) == :(-3//2*a^3*x^-2//3+3//7*b^3*x^7//3+9*b*a^2*x^1//3+9//4*a*b^2*x^4//3)
@test integrate(x^5//3*(a+b*x)^-1, x) == :(3//5*b^-1*x^5//3+(1/2)*a^5//3*b^-8//3*log(a+b*x)+-3//2*a*b^-2*x^2//3+-3//2*a^5//3*b^-8//3*log(a^1//3+b^1//3*x^1//3)+-1*3^(1/2)*a^5//3*b^-8//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^4//3*(a+b*x)^-1, x) == :(3//4*b^-1*x^4//3+-3*a*b^-2*x^1//3+-1//2*a^4//3*b^-7//3*log(a+b*x)+3//2*a^4//3*b^-7//3*log(a^1//3+b^1//3*x^1//3)+-1*3^(1/2)*a^4//3*b^-7//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^2//3*(a+b*x)^-1, x) == :(3//2*b^-1*x^2//3+-1//2*a^2//3*b^-5//3*log(a+b*x)+3//2*a^2//3*b^-5//3*log(a^1//3+b^1//3*x^1//3)+3^(1/2)*a^2//3*b^-5//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^1//3*(a+b*x)^-1, x) == :(3*b^-1*x^1//3+(1/2)*a^1//3*b^-4//3*log(a+b*x)+-3//2*a^1//3*b^-4//3*log(a^1//3+b^1//3*x^1//3)+3^(1/2)*a^1//3*b^-4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-1//3*(a+b*x)^-1, x) == :((1/2)*a^-1//3*b^-2//3*log(a+b*x)+-3//2*a^-1//3*b^-2//3*log(a^1//3+b^1//3*x^1//3)+-1*3^(1/2)*a^-1//3*b^-2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-2//3*(a+b*x)^-1, x) == :(-1//2*a^-2//3*b^-1//3*log(a+b*x)+3//2*a^-2//3*b^-1//3*log(a^1//3+b^1//3*x^1//3)+-1*3^(1/2)*a^-2//3*b^-1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-4//3*(a+b*x)^-1, x) == :(-3*a^-1*x^-1//3+-1//2*a^-4//3*b^1//3*log(a+b*x)+3//2*a^-4//3*b^1//3*log(a^1//3+b^1//3*x^1//3)+3^(1/2)*a^-4//3*b^1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-5//3*(a+b*x)^-1, x) == :(-3//2*a^-1*x^-2//3+(1/2)*a^-5//3*b^2//3*log(a+b*x)+-3//2*a^-5//3*b^2//3*log(a^1//3+b^1//3*x^1//3)+3^(1/2)*a^-5//3*b^2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^5//3*(a+b*x)^-2, x) == :(5//2*b^-2*x^2//3+-1*b^-1*x^5//3*(a+b*x)^-1+-5//6*a^2//3*b^-8//3*log(a+b*x)+5//2*a^2//3*b^-8//3*log(a^1//3+b^1//3*x^1//3)+5//3*3^(1/2)*a^2//3*b^-8//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^4//3*(a+b*x)^-2, x) == :(4*b^-2*x^1//3+-1*b^-1*x^4//3*(a+b*x)^-1+-2*a^1//3*b^-7//3*log(a^1//3+b^1//3*x^1//3)+2//3*a^1//3*b^-7//3*log(a+b*x)+4//3*3^(1/2)*a^1//3*b^-7//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^2//3*(a+b*x)^-2, x) == :(-1*a^-1//3*b^-5//3*log(a^1//3+b^1//3*x^1//3)+-1*b^-1*x^2//3*(a+b*x)^-1+1//3*a^-1//3*b^-5//3*log(a+b*x)+-2//3*3^(1/2)*a^-1//3*b^-5//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^1//3*(a+b*x)^-2, x) == :((1/2)*a^-2//3*b^-4//3*log(a^1//3+b^1//3*x^1//3)+-1*b^-1*x^1//3*(a+b*x)^-1+-1//6*a^-2//3*b^-4//3*log(a+b*x)+-1//3*3^(1/2)*a^-2//3*b^-4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-1//3*(a+b*x)^-2, x) == :(a^-1*x^2//3*(a+b*x)^-1+-1//2*a^-4//3*b^-2//3*log(a^1//3+b^1//3*x^1//3)+1//6*a^-4//3*b^-2//3*log(a+b*x)+-1//3*3^(1/2)*a^-4//3*b^-2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-2//3*(a+b*x)^-2, x) == :(a^-1*x^1//3*(a+b*x)^-1+a^-5//3*b^-1//3*log(a^1//3+b^1//3*x^1//3)+-1//3*a^-5//3*b^-1//3*log(a+b*x)+-2//3*3^(1/2)*a^-5//3*b^-1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-4//3*(a+b*x)^-2, x) == :(-4*a^-2*x^-1//3+a^-1*x^-1//3*(a+b*x)^-1+2*a^-7//3*b^1//3*log(a^1//3+b^1//3*x^1//3)+-2//3*a^-7//3*b^1//3*log(a+b*x)+4//3*3^(1/2)*a^-7//3*b^1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-5//3*(a+b*x)^-2, x) == :(-5//2*a^-2*x^-2//3+a^-1*x^-2//3*(a+b*x)^-1+-5//2*a^-8//3*b^2//3*log(a^1//3+b^1//3*x^1//3)+5//6*a^-8//3*b^2//3*log(a+b*x)+5//3*3^(1/2)*a^-8//3*b^2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^5//3*(a+b*x)^-3, x) == :(-5//6*a^-1//3*b^-8//3*log(a^1//3+b^1//3*x^1//3)+-5//6*b^-2*x^2//3*(a+b*x)^-1+-1//2*b^-1*x^5//3*(a+b*x)^-2+5//18*a^-1//3*b^-8//3*log(a+b*x)+-5//9*3^(1/2)*a^-1//3*b^-8//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^4//3*(a+b*x)^-3, x) == :(-2//3*b^-2*x^1//3*(a+b*x)^-1+-1//2*b^-1*x^4//3*(a+b*x)^-2+-1//9*a^-2//3*b^-7//3*log(a+b*x)+1//3*a^-2//3*b^-7//3*log(a^1//3+b^1//3*x^1//3)+-2//9*3^(1/2)*a^-2//3*b^-7//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^2//3*(a+b*x)^-3, x) == :(-1//2*b^-1*x^2//3*(a+b*x)^-2+-1//6*a^-4//3*b^-5//3*log(a^1//3+b^1//3*x^1//3)+1//18*a^-4//3*b^-5//3*log(a+b*x)+-1//9*3^(1/2)*a^-4//3*b^-5//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3))+1//3*a^-1*b^-1*x^2//3*(a+b*x)^-1)
@test integrate(x^1//3*(a+b*x)^-3, x) == :(-1//2*b^-1*x^1//3*(a+b*x)^-2+-1//18*a^-5//3*b^-4//3*log(a+b*x)+1//6*a^-5//3*b^-4//3*log(a^1//3+b^1//3*x^1//3)+-1//9*3^(1/2)*a^-5//3*b^-4//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3))+1//6*a^-1*b^-1*x^1//3*(a+b*x)^-1)
@test integrate(x^-1//3*(a+b*x)^-3, x) == :((1/2)*a^-1*x^2//3*(a+b*x)^-2+-1//3*a^-7//3*b^-2//3*log(a^1//3+b^1//3*x^1//3)+1//9*a^-7//3*b^-2//3*log(a+b*x)+2//3*a^-2*x^2//3*(a+b*x)^-1+-2//9*3^(1/2)*a^-7//3*b^-2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-2//3*(a+b*x)^-3, x) == :((1/2)*a^-1*x^1//3*(a+b*x)^-2+-5//18*a^-8//3*b^-1//3*log(a+b*x)+5//6*a^-2*x^1//3*(a+b*x)^-1+5//6*a^-8//3*b^-1//3*log(a^1//3+b^1//3*x^1//3)+-5//9*3^(1/2)*a^-8//3*b^-1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-4//3*(a+b*x)^-3, x) == :(-14//3*a^-3*x^-1//3+(1/2)*a^-1*x^-1//3*(a+b*x)^-2+-7//9*a^-10//3*b^1//3*log(a+b*x)+7//3*a^-10//3*b^1//3*log(a^1//3+b^1//3*x^1//3)+7//6*a^-2*x^-1//3*(a+b*x)^-1+14//9*3^(1/2)*a^-10//3*b^1//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate(x^-5//3*(a+b*x)^-3, x) == :(-10//3*a^-3*x^-2//3+(1/2)*a^-1*x^-2//3*(a+b*x)^-2+-10//3*a^-11//3*b^2//3*log(a^1//3+b^1//3*x^1//3)+4//3*a^-2*x^-2//3*(a+b*x)^-1+10//9*a^-11//3*b^2//3*log(a+b*x)+20//9*3^(1/2)*a^-11//3*b^2//3*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*x^1//3)))
@test integrate((1+x)^-1*(1+-1x)^1//4, x) == :(4*(1+-1x)^1//4+-2*2^1//4*arctan((1/2)*2^3//4*(1+-1x)^1//4)+-2*2^1//4*arctanh((1/2)*2^3//4*(1+-1x)^1//4))
@test integrate(x^m*(a+b*x)^10, x) == :(a^10*x^(1+m)*(1+m)^-1+b^10*x^(11+m)*(11+m)^-1+10*a*b^9*x^(10+m)*(10+m)^-1+10*b*a^9*x^(2+m)*(2+m)^-1+45*a^2*b^8*x^(9+m)*(9+m)^-1+45*a^8*b^2*x^(3+m)*(3+m)^-1+120*a^3*b^7*x^(8+m)*(8+m)^-1+120*a^7*b^3*x^(4+m)*(4+m)^-1+210*a^4*b^6*x^(7+m)*(7+m)^-1+210*a^6*b^4*x^(5+m)*(5+m)^-1+252*a^5*b^5*x^(6+m)*(6+m)^-1)
@test integrate(x^m*(a+b*x)^7, x) == :(a^7*x^(1+m)*(1+m)^-1+b^7*x^(8+m)*(8+m)^-1+7*a*b^6*x^(7+m)*(7+m)^-1+7*b*a^6*x^(2+m)*(2+m)^-1+21*a^2*b^5*x^(6+m)*(6+m)^-1+21*a^5*b^2*x^(3+m)*(3+m)^-1+35*a^3*b^4*x^(5+m)*(5+m)^-1+35*a^4*b^3*x^(4+m)*(4+m)^-1)
@test integrate(x^m*(a+b*x)^3, x) == :(a^3*x^(1+m)*(1+m)^-1+b^3*x^(4+m)*(4+m)^-1+3*a*b^2*x^(3+m)*(3+m)^-1+3*b*a^2*x^(2+m)*(2+m)^-1)
@test integrate(x^m*(a+b*x)^2, x) == :(a^2*x^(1+m)*(1+m)^-1+b^2*x^(3+m)*(3+m)^-1+2*a*b*x^(2+m)*(2+m)^-1)
@test integrate(x^m*(a+b*x), x) == :(a*x^(1+m)*(1+m)^-1+b*x^(2+m)*(2+m)^-1)
@test integrate(x^3*(a+b*x)^n, x) == :(b^-4*(4+n)^-1*(a+b*x)^(4+n)+-1*a^3*b^-4*(1+n)^-1*(a+b*x)^(1+n)+-3*a*b^-4*(3+n)^-1*(a+b*x)^(3+n)+3*a^2*b^-4*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^2*(a+b*x)^n, x) == :(b^-3*(3+n)^-1*(a+b*x)^(3+n)+a^2*b^-3*(1+n)^-1*(a+b*x)^(1+n)+-2*a*b^-3*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x*(a+b*x)^n, x) == :(b^-2*(2+n)^-1*(a+b*x)^(2+n)+-1*a*b^-2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate((a+b*x)^n, x) == :(b^-1*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^(-3+n)*(a+b*x)^(-1n), x) == :(-1*a^-1*x^(-2+n)*(2+-1n)^-1*(a+b*x)^(1+-1n)+b*a^-2*x^(-1+n)*(1+-1n)^-1*(2+-1n)^-1*(a+b*x)^(1+-1n))
@test integrate(x^(-2+n)*(a+b*x)^(-1n), x) == :(-1*a^-1*x^(-1+n)*(1+-1n)^-1*(a+b*x)^(1+-1n))
@test integrate(x^(-1+n)*(a+b*x)^(-1+-1n), x) == :(a^-1*n^-1*x^n*(a+b*x)^(-1n))
@test integrate(x^(-3+-1n)*(a+b*x)^n, x) == :(-1*a^-1*x^(-2+-1n)*(2+n)^-1*(a+b*x)^(1+n)+b*a^-2*x^(-1+-1n)*(1+n)^-1*(2+n)^-1*(a+b*x)^(1+n))
@test integrate(x^3*(c*x^2)^(1/2)*(a+b*x), x) == :(1//5*a*x^4*(c*x^2)^(1/2)+1//6*b*x^5*(c*x^2)^(1/2))
@test integrate(x^2*(c*x^2)^(1/2)*(a+b*x), x) == :(1//4*a*x^3*(c*x^2)^(1/2)+1//5*b*x^4*(c*x^2)^(1/2))
@test integrate(x*(c*x^2)^(1/2)*(a+b*x), x) == :(1//3*a*x^2*(c*x^2)^(1/2)+1//4*b*x^3*(c*x^2)^(1/2))
@test integrate((c*x^2)^(1/2)*(a+b*x), x) == :((1/2)*a*x*(c*x^2)^(1/2)+1//3*b*x^2*(c*x^2)^(1/2))
@test integrate(x^-1*(c*x^2)^(1/2)*(a+b*x), x) == :(a*(c*x^2)^(1/2)+(1/2)*b*x*(c*x^2)^(1/2))
@test integrate(x^-2*(c*x^2)^(1/2)*(a+b*x), x) == :(b*(c*x^2)^(1/2)+a*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^-3*(c*x^2)^(1/2)*(a+b*x), x) == :(-1*a*x^-2*(c*x^2)^(1/2)+b*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^-4*(c*x^2)^(1/2)*(a+b*x), x) == :(-1//2*a^-1*x^-3*(c*x^2)^(1/2)*(a+b*x)^2)
@test integrate(x^3*(c*x^2)^3//2*(a+b*x), x) == :(1//7*a*c*x^6*(c*x^2)^(1/2)+1//8*b*c*x^7*(c*x^2)^(1/2))
@test integrate(x^2*(c*x^2)^3//2*(a+b*x), x) == :(1//6*a*c*x^5*(c*x^2)^(1/2)+1//7*b*c*x^6*(c*x^2)^(1/2))
@test integrate(x*(c*x^2)^3//2*(a+b*x), x) == :(1//5*a*c*x^4*(c*x^2)^(1/2)+1//6*b*c*x^5*(c*x^2)^(1/2))
@test integrate((c*x^2)^3//2*(a+b*x), x) == :(1//4*a*c*x^3*(c*x^2)^(1/2)+1//5*b*c*x^4*(c*x^2)^(1/2))
@test integrate(x^-1*(c*x^2)^3//2*(a+b*x), x) == :(1//3*a*c*x^2*(c*x^2)^(1/2)+1//4*b*c*x^3*(c*x^2)^(1/2))
@test integrate(x^-2*(c*x^2)^3//2*(a+b*x), x) == :((1/2)*a*c*x*(c*x^2)^(1/2)+1//3*b*c*x^2*(c*x^2)^(1/2))
@test integrate(x^-3*(c*x^2)^3//2*(a+b*x), x) == :(a*c*(c*x^2)^(1/2)+(1/2)*b*c*x*(c*x^2)^(1/2))
@test integrate(x^-4*(c*x^2)^3//2*(a+b*x), x) == :(b*c*(c*x^2)^(1/2)+a*c*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^3*(c*x^2)^5//2*(a+b*x), x) == :(1//9*a*c^2*x^8*(c*x^2)^(1/2)+1//10*b*c^2*x^9*(c*x^2)^(1/2))
@test integrate(x^2*(c*x^2)^5//2*(a+b*x), x) == :(1//8*a*c^2*x^7*(c*x^2)^(1/2)+1//9*b*c^2*x^8*(c*x^2)^(1/2))
@test integrate(x*(c*x^2)^5//2*(a+b*x), x) == :(1//7*a*c^2*x^6*(c*x^2)^(1/2)+1//8*b*c^2*x^7*(c*x^2)^(1/2))
@test integrate((c*x^2)^5//2*(a+b*x), x) == :(1//6*a*c^2*x^5*(c*x^2)^(1/2)+1//7*b*c^2*x^6*(c*x^2)^(1/2))
@test integrate(x^-1*(c*x^2)^5//2*(a+b*x), x) == :(1//5*a*c^2*x^4*(c*x^2)^(1/2)+1//6*b*c^2*x^5*(c*x^2)^(1/2))
@test integrate(x^-2*(c*x^2)^5//2*(a+b*x), x) == :(1//4*a*c^2*x^3*(c*x^2)^(1/2)+1//5*b*c^2*x^4*(c*x^2)^(1/2))
@test integrate(x^-3*(c*x^2)^5//2*(a+b*x), x) == :(1//3*a*c^2*x^2*(c*x^2)^(1/2)+1//4*b*c^2*x^3*(c*x^2)^(1/2))
@test integrate(x^-4*(c*x^2)^5//2*(a+b*x), x) == :((1/2)*a*x*c^2*(c*x^2)^(1/2)+1//3*b*c^2*x^2*(c*x^2)^(1/2))
@test integrate(x^3*(c*x^2)^-1//2*(a+b*x), x) == :(1//3*a*x^4*(c*x^2)^-1//2+1//4*b*x^5*(c*x^2)^-1//2)
@test integrate(x^2*(c*x^2)^-1//2*(a+b*x), x) == :((1/2)*a*x^3*(c*x^2)^-1//2+1//3*b*x^4*(c*x^2)^-1//2)
@test integrate(x*(c*x^2)^-1//2*(a+b*x), x) == :(a*x^2*(c*x^2)^-1//2+(1/2)*b*x^3*(c*x^2)^-1//2)
@test integrate((c*x^2)^-1//2*(a+b*x), x) == :(b*x^2*(c*x^2)^-1//2+a*x*(c*x^2)^-1//2*log(x))
@test integrate(x^-1*(c*x^2)^-1//2*(a+b*x), x) == :(-1*a*(c*x^2)^-1//2+b*x*(c*x^2)^-1//2*log(x))
@test integrate(x^-2*(c*x^2)^-1//2*(a+b*x), x) == :(-1//2*a^-1*x^-1*(c*x^2)^-1//2*(a+b*x)^2)
@test integrate(x^-3*(c*x^2)^-1//2*(a+b*x), x) == :(-1//2*b*x^-1*(c*x^2)^-1//2+-1//3*a*x^-2*(c*x^2)^-1//2)
@test integrate(x^-4*(c*x^2)^-1//2*(a+b*x), x) == :(-1//3*b*x^-2*(c*x^2)^-1//2+-1//4*a*x^-3*(c*x^2)^-1//2)
@test integrate(x^3*(c*x^2)^-3//2*(a+b*x), x) == :(a*c^-1*x^2*(c*x^2)^-1//2+(1/2)*b*c^-1*x^3*(c*x^2)^-1//2)
@test integrate(x^2*(c*x^2)^-3//2*(a+b*x), x) == :(b*c^-1*x^2*(c*x^2)^-1//2+a*x*c^-1*(c*x^2)^-1//2*log(x))
@test integrate(x*(c*x^2)^-3//2*(a+b*x), x) == :(-1*a*c^-1*(c*x^2)^-1//2+b*x*c^-1*(c*x^2)^-1//2*log(x))
@test integrate((c*x^2)^-3//2*(a+b*x), x) == :(-1//2*a^-1*c^-1*x^-1*(c*x^2)^-1//2*(a+b*x)^2)
@test integrate(x^-1*(c*x^2)^-3//2*(a+b*x), x) == :(-1//2*b*c^-1*x^-1*(c*x^2)^-1//2+-1//3*a*c^-1*x^-2*(c*x^2)^-1//2)
@test integrate(x^-2*(c*x^2)^-3//2*(a+b*x), x) == :(-1//3*b*c^-1*x^-2*(c*x^2)^-1//2+-1//4*a*c^-1*x^-3*(c*x^2)^-1//2)
@test integrate(x^-3*(c*x^2)^-3//2*(a+b*x), x) == :(-1//4*b*c^-1*x^-3*(c*x^2)^-1//2+-1//5*a*c^-1*x^-4*(c*x^2)^-1//2)
@test integrate(x^-4*(c*x^2)^-3//2*(a+b*x), x) == :(-1//5*b*c^-1*x^-4*(c*x^2)^-1//2+-1//6*a*c^-1*x^-5*(c*x^2)^-1//2)
@test integrate(x^3*(c*x^2)^-5//2*(a+b*x), x) == :(-1*a*c^-2*(c*x^2)^-1//2+b*x*c^-2*(c*x^2)^-1//2*log(x))
@test integrate(x^2*(c*x^2)^-5//2*(a+b*x), x) == :(-1//2*a^-1*c^-2*x^-1*(c*x^2)^-1//2*(a+b*x)^2)
@test integrate(x*(c*x^2)^-5//2*(a+b*x), x) == :(-1//2*b*c^-2*x^-1*(c*x^2)^-1//2+-1//3*a*c^-2*x^-2*(c*x^2)^-1//2)
@test integrate((c*x^2)^-5//2*(a+b*x), x) == :(-1//3*b*c^-2*x^-2*(c*x^2)^-1//2+-1//4*a*c^-2*x^-3*(c*x^2)^-1//2)
@test integrate(x^-1*(c*x^2)^-5//2*(a+b*x), x) == :(-1//4*b*c^-2*x^-3*(c*x^2)^-1//2+-1//5*a*c^-2*x^-4*(c*x^2)^-1//2)
@test integrate(x^-2*(c*x^2)^-5//2*(a+b*x), x) == :(-1//5*b*c^-2*x^-4*(c*x^2)^-1//2+-1//6*a*c^-2*x^-5*(c*x^2)^-1//2)
@test integrate(x^-3*(c*x^2)^-5//2*(a+b*x), x) == :(-1//6*b*c^-2*x^-5*(c*x^2)^-1//2+-1//7*a*c^-2*x^-6*(c*x^2)^-1//2)
@test integrate(x^-4*(c*x^2)^-5//2*(a+b*x), x) == :(-1//7*b*c^-2*x^-6*(c*x^2)^-1//2+-1//8*a*c^-2*x^-7*(c*x^2)^-1//2)
@test integrate(x^3*(c*x^2)^(1/2)*(a+b*x)^2, x) == :(1//5*a^2*x^4*(c*x^2)^(1/2)+1//7*b^2*x^6*(c*x^2)^(1/2)+1//3*a*b*x^5*(c*x^2)^(1/2))
@test integrate(x^2*(c*x^2)^(1/2)*(a+b*x)^2, x) == :(1//4*a^2*x^3*(c*x^2)^(1/2)+1//6*b^2*x^5*(c*x^2)^(1/2)+2//5*a*b*x^4*(c*x^2)^(1/2))
@test integrate(x*(c*x^2)^(1/2)*(a+b*x)^2, x) == :(1//3*a^2*x^2*(c*x^2)^(1/2)+1//5*b^2*x^4*(c*x^2)^(1/2)+(1/2)*a*b*x^3*(c*x^2)^(1/2))
@test integrate((c*x^2)^(1/2)*(a+b*x)^2, x) == :((1/2)*x*a^2*(c*x^2)^(1/2)+1//4*b^2*x^3*(c*x^2)^(1/2)+2//3*a*b*x^2*(c*x^2)^(1/2))
@test integrate(x^-1*(c*x^2)^(1/2)*(a+b*x)^2, x) == :(1//3*b^-1*x^-1*(c*x^2)^(1/2)*(a+b*x)^3)
@test integrate(x^-2*(c*x^2)^(1/2)*(a+b*x)^2, x) == :((1/2)*x*b^2*(c*x^2)^(1/2)+2*a*b*(c*x^2)^(1/2)+a^2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^-3*(c*x^2)^(1/2)*(a+b*x)^2, x) == :(b^2*(c*x^2)^(1/2)+-1*a^2*x^-2*(c*x^2)^(1/2)+2*a*b*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^-4*(c*x^2)^(1/2)*(a+b*x)^2, x) == :(-1//2*a^2*x^-3*(c*x^2)^(1/2)+b^2*x^-1*(c*x^2)^(1/2)*log(x)+-2*a*b*x^-2*(c*x^2)^(1/2))
@test integrate(x^3*(c*x^2)^3//2*(a+b*x)^2, x) == :(1//7*c*a^2*x^6*(c*x^2)^(1/2)+1//9*c*b^2*x^8*(c*x^2)^(1/2)+1//4*a*b*c*x^7*(c*x^2)^(1/2))
@test integrate(x^2*(c*x^2)^3//2*(a+b*x)^2, x) == :(1//6*c*a^2*x^5*(c*x^2)^(1/2)+1//8*c*b^2*x^7*(c*x^2)^(1/2)+2//7*a*b*c*x^6*(c*x^2)^(1/2))
@test integrate(x*(c*x^2)^3//2*(a+b*x)^2, x) == :(1//5*c*a^2*x^4*(c*x^2)^(1/2)+1//7*c*b^2*x^6*(c*x^2)^(1/2)+1//3*a*b*c*x^5*(c*x^2)^(1/2))
@test integrate((c*x^2)^3//2*(a+b*x)^2, x) == :(1//4*c*a^2*x^3*(c*x^2)^(1/2)+1//6*c*b^2*x^5*(c*x^2)^(1/2)+2//5*a*b*c*x^4*(c*x^2)^(1/2))
@test integrate(x^-1*(c*x^2)^3//2*(a+b*x)^2, x) == :(1//3*c*a^2*x^2*(c*x^2)^(1/2)+1//5*c*b^2*x^4*(c*x^2)^(1/2)+(1/2)*a*b*c*x^3*(c*x^2)^(1/2))
@test integrate(x^-2*(c*x^2)^3//2*(a+b*x)^2, x) == :((1/2)*c*x*a^2*(c*x^2)^(1/2)+1//4*c*b^2*x^3*(c*x^2)^(1/2)+2//3*a*b*c*x^2*(c*x^2)^(1/2))
@test integrate(x^-3*(c*x^2)^3//2*(a+b*x)^2, x) == :(1//3*c*b^-1*x^-1*(c*x^2)^(1/2)*(a+b*x)^3)
@test integrate(x^-4*(c*x^2)^3//2*(a+b*x)^2, x) == :((1/2)*c*x*b^2*(c*x^2)^(1/2)+2*a*b*c*(c*x^2)^(1/2)+c*a^2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x*(c*x^2)^5//2*(a+b*x)^2, x) == :(1//7*a^2*c^2*x^6*(c*x^2)^(1/2)+1//9*b^2*c^2*x^8*(c*x^2)^(1/2)+1//4*a*b*c^2*x^7*(c*x^2)^(1/2))
@test integrate((c*x^2)^5//2*(a+b*x)^2, x) == :(1//6*a^2*c^2*x^5*(c*x^2)^(1/2)+1//8*b^2*c^2*x^7*(c*x^2)^(1/2)+2//7*a*b*c^2*x^6*(c*x^2)^(1/2))
@test integrate(x^-1*(c*x^2)^5//2*(a+b*x)^2, x) == :(1//5*a^2*c^2*x^4*(c*x^2)^(1/2)+1//7*b^2*c^2*x^6*(c*x^2)^(1/2)+1//3*a*b*c^2*x^5*(c*x^2)^(1/2))
@test integrate(x^-2*(c*x^2)^5//2*(a+b*x)^2, x) == :(1//4*a^2*c^2*x^3*(c*x^2)^(1/2)+1//6*b^2*c^2*x^5*(c*x^2)^(1/2)+2//5*a*b*c^2*x^4*(c*x^2)^(1/2))
@test integrate(x^-3*(c*x^2)^5//2*(a+b*x)^2, x) == :(1//3*a^2*c^2*x^2*(c*x^2)^(1/2)+1//5*b^2*c^2*x^4*(c*x^2)^(1/2)+(1/2)*a*b*c^2*x^3*(c*x^2)^(1/2))
@test integrate(x^-4*(c*x^2)^5//2*(a+b*x)^2, x) == :((1/2)*x*a^2*c^2*(c*x^2)^(1/2)+1//4*b^2*c^2*x^3*(c*x^2)^(1/2)+2//3*a*b*c^2*x^2*(c*x^2)^(1/2))
@test integrate(x^-5*(c*x^2)^5//2*(a+b*x)^2, x) == :(1//3*b^-1*c^2*x^-1*(c*x^2)^(1/2)*(a+b*x)^3)
@test integrate(x^-6*(c*x^2)^5//2*(a+b*x)^2, x) == :((1/2)*x*b^2*c^2*(c*x^2)^(1/2)+2*a*b*c^2*(c*x^2)^(1/2)+a^2*c^2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^3*(c*x^2)^-1//2*(a+b*x)^2, x) == :(1//3*a^2*x^4*(c*x^2)^-1//2+1//5*b^2*x^6*(c*x^2)^-1//2+(1/2)*a*b*x^5*(c*x^2)^-1//2)
@test integrate(x^2*(c*x^2)^-1//2*(a+b*x)^2, x) == :((1/2)*a^2*x^3*(c*x^2)^-1//2+1//4*b^2*x^5*(c*x^2)^-1//2+2//3*a*b*x^4*(c*x^2)^-1//2)
@test integrate(x*(c*x^2)^-1//2*(a+b*x)^2, x) == :(1//3*x*b^-1*(c*x^2)^-1//2*(a+b*x)^3)
@test integrate((c*x^2)^-1//2*(a+b*x)^2, x) == :((1/2)*b^2*x^3*(c*x^2)^-1//2+x*a^2*(c*x^2)^-1//2*log(x)+2*a*b*x^2*(c*x^2)^-1//2)
@test integrate(x^-1*(c*x^2)^-1//2*(a+b*x)^2, x) == :(-1*a^2*(c*x^2)^-1//2+b^2*x^2*(c*x^2)^-1//2+2*a*b*x*(c*x^2)^-1//2*log(x))
@test integrate(x^-2*(c*x^2)^-1//2*(a+b*x)^2, x) == :(-2*a*b*(c*x^2)^-1//2+-1//2*a^2*x^-1*(c*x^2)^-1//2+x*b^2*(c*x^2)^-1//2*log(x))
@test integrate(x^-3*(c*x^2)^-1//2*(a+b*x)^2, x) == :(-1//3*a^-1*x^-2*(c*x^2)^-1//2*(a+b*x)^3)
@test integrate(x^-4*(c*x^2)^-1//2*(a+b*x)^2, x) == :(-1//2*b^2*x^-1*(c*x^2)^-1//2+-1//4*a^2*x^-3*(c*x^2)^-1//2+-2//3*a*b*x^-2*(c*x^2)^-1//2)
@test integrate(x^3*(c*x^2)^-3//2*(a+b*x)^2, x) == :(1//3*x*b^-1*c^-1*(c*x^2)^-1//2*(a+b*x)^3)
@test integrate(x^2*(c*x^2)^-3//2*(a+b*x)^2, x) == :((1/2)*b^2*c^-1*x^3*(c*x^2)^-1//2+x*a^2*c^-1*(c*x^2)^-1//2*log(x)+2*a*b*c^-1*x^2*(c*x^2)^-1//2)
@test integrate(x*(c*x^2)^-3//2*(a+b*x)^2, x) == :(-1*a^2*c^-1*(c*x^2)^-1//2+b^2*c^-1*x^2*(c*x^2)^-1//2+2*a*b*x*c^-1*(c*x^2)^-1//2*log(x))
@test integrate((c*x^2)^-3//2*(a+b*x)^2, x) == :(-2*a*b*c^-1*(c*x^2)^-1//2+-1//2*a^2*c^-1*x^-1*(c*x^2)^-1//2+x*b^2*c^-1*(c*x^2)^-1//2*log(x))
@test integrate(x^-1*(c*x^2)^-3//2*(a+b*x)^2, x) == :(-1//3*a^-1*c^-1*x^-2*(c*x^2)^-1//2*(a+b*x)^3)
@test integrate(x^-2*(c*x^2)^-3//2*(a+b*x)^2, x) == :(-1//2*b^2*c^-1*x^-1*(c*x^2)^-1//2+-1//4*a^2*c^-1*x^-3*(c*x^2)^-1//2+-2//3*a*b*c^-1*x^-2*(c*x^2)^-1//2)
@test integrate(x^-3*(c*x^2)^-3//2*(a+b*x)^2, x) == :(-1//3*b^2*c^-1*x^-2*(c*x^2)^-1//2+-1//5*a^2*c^-1*x^-4*(c*x^2)^-1//2+-1//2*a*b*c^-1*x^-3*(c*x^2)^-1//2)
@test integrate(x^-4*(c*x^2)^-3//2*(a+b*x)^2, x) == :(-1//4*b^2*c^-1*x^-3*(c*x^2)^-1//2+-1//6*a^2*c^-1*x^-5*(c*x^2)^-1//2+-2//5*a*b*c^-1*x^-4*(c*x^2)^-1//2)
@test integrate(x^3*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-1*a^2*c^-2*(c*x^2)^-1//2+b^2*c^-2*x^2*(c*x^2)^-1//2+2*a*b*x*c^-2*(c*x^2)^-1//2*log(x))
@test integrate(x^2*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-2*a*b*c^-2*(c*x^2)^-1//2+-1//2*a^2*c^-2*x^-1*(c*x^2)^-1//2+x*b^2*c^-2*(c*x^2)^-1//2*log(x))
@test integrate(x*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-1//3*a^-1*c^-2*x^-2*(c*x^2)^-1//2*(a+b*x)^3)
@test integrate((c*x^2)^-5//2*(a+b*x)^2, x) == :(-1//2*b^2*c^-2*x^-1*(c*x^2)^-1//2+-1//4*a^2*c^-2*x^-3*(c*x^2)^-1//2+-2//3*a*b*c^-2*x^-2*(c*x^2)^-1//2)
@test integrate(x^-1*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-1//3*b^2*c^-2*x^-2*(c*x^2)^-1//2+-1//5*a^2*c^-2*x^-4*(c*x^2)^-1//2+-1//2*a*b*c^-2*x^-3*(c*x^2)^-1//2)
@test integrate(x^-2*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-1//4*b^2*c^-2*x^-3*(c*x^2)^-1//2+-1//6*a^2*c^-2*x^-5*(c*x^2)^-1//2+-2//5*a*b*c^-2*x^-4*(c*x^2)^-1//2)
@test integrate(x^-3*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-1//5*b^2*c^-2*x^-4*(c*x^2)^-1//2+-1//7*a^2*c^-2*x^-6*(c*x^2)^-1//2+-1//3*a*b*c^-2*x^-5*(c*x^2)^-1//2)
@test integrate(x^-4*(c*x^2)^-5//2*(a+b*x)^2, x) == :(-1//6*b^2*c^-2*x^-5*(c*x^2)^-1//2+-1//8*a^2*c^-2*x^-7*(c*x^2)^-1//2+-2//7*a*b*c^-2*x^-6*(c*x^2)^-1//2)
@test integrate(x^3*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :(-1*a^3*b^-4*(c*x^2)^(1/2)+1//4*b^-1*x^3*(c*x^2)^(1/2)+(1/2)*x*a^2*b^-3*(c*x^2)^(1/2)+-1//3*a*b^-2*x^2*(c*x^2)^(1/2)+a^4*b^-5*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^2*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :(a^2*b^-3*(c*x^2)^(1/2)+1//3*b^-1*x^2*(c*x^2)^(1/2)+-1//2*a*x*b^-2*(c*x^2)^(1/2)+-1*a^3*b^-4*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :((1/2)*x*b^-1*(c*x^2)^(1/2)+-1*a*b^-2*(c*x^2)^(1/2)+a^2*b^-3*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate((c*x^2)^(1/2)*(a+b*x)^-1, x) == :(b^-1*(c*x^2)^(1/2)+-1*a*b^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-1*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :(b^-1*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-2*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :(a^-1*x^-1*(c*x^2)^(1/2)*log(x)+-1*a^-1*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-3*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :(-1*a^-1*x^-2*(c*x^2)^(1/2)+b*a^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+-1*b*a^-2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^-4*(c*x^2)^(1/2)*(a+b*x)^-1, x) == :(-1//2*a^-1*x^-3*(c*x^2)^(1/2)+b*a^-2*x^-2*(c*x^2)^(1/2)+a^-3*b^2*x^-1*(c*x^2)^(1/2)*log(x)+-1*a^-3*b^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x*(c*x^2)^3//2*(a+b*x)^-1, x) == :(-1*c*a^3*b^-4*(c*x^2)^(1/2)+1//4*c*b^-1*x^3*(c*x^2)^(1/2)+(1/2)*c*x*a^2*b^-3*(c*x^2)^(1/2)+-1//3*a*c*b^-2*x^2*(c*x^2)^(1/2)+c*a^4*b^-5*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate((c*x^2)^3//2*(a+b*x)^-1, x) == :(c*a^2*b^-3*(c*x^2)^(1/2)+1//3*c*b^-1*x^2*(c*x^2)^(1/2)+-1//2*a*c*x*b^-2*(c*x^2)^(1/2)+-1*c*a^3*b^-4*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-1*(c*x^2)^3//2*(a+b*x)^-1, x) == :((1/2)*c*x*b^-1*(c*x^2)^(1/2)+-1*a*c*b^-2*(c*x^2)^(1/2)+c*a^2*b^-3*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-2*(c*x^2)^3//2*(a+b*x)^-1, x) == :(c*b^-1*(c*x^2)^(1/2)+-1*a*c*b^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-3*(c*x^2)^3//2*(a+b*x)^-1, x) == :(c*b^-1*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-4*(c*x^2)^3//2*(a+b*x)^-1, x) == :(c*a^-1*x^-1*(c*x^2)^(1/2)*log(x)+-1*c*a^-1*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-5*(c*x^2)^3//2*(a+b*x)^-1, x) == :(-1*c*a^-1*x^-2*(c*x^2)^(1/2)+b*c*a^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+-1*b*c*a^-2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^-6*(c*x^2)^3//2*(a+b*x)^-1, x) == :(-1//2*c*a^-1*x^-3*(c*x^2)^(1/2)+b*c*a^-2*x^-2*(c*x^2)^(1/2)+c*a^-3*b^2*x^-1*(c*x^2)^(1/2)*log(x)+-1*c*a^-3*b^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-7*(c*x^2)^3//2*(a+b*x)^-1, x) == :(-1//3*c*a^-1*x^-4*(c*x^2)^(1/2)+(1/2)*b*c*a^-2*x^-3*(c*x^2)^(1/2)+-1*c*a^-3*b^2*x^-2*(c*x^2)^(1/2)+c*a^-4*b^3*x^-1*(c*x^2)^(1/2)*log(a+b*x)+-1*c*a^-4*b^3*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate((c*x^2)^5//2*(a+b*x)^-1, x) == :(a^4*b^-5*c^2*(c*x^2)^(1/2)+1//5*b^-1*c^2*x^4*(c*x^2)^(1/2)+-1//2*x*a^3*b^-4*c^2*(c*x^2)^(1/2)+-1//4*a*b^-2*c^2*x^3*(c*x^2)^(1/2)+1//3*a^2*b^-3*c^2*x^2*(c*x^2)^(1/2)+-1*a^5*b^-6*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-1*(c*x^2)^5//2*(a+b*x)^-1, x) == :(-1*a^3*b^-4*c^2*(c*x^2)^(1/2)+1//4*b^-1*c^2*x^3*(c*x^2)^(1/2)+(1/2)*x*a^2*b^-3*c^2*(c*x^2)^(1/2)+-1//3*a*b^-2*c^2*x^2*(c*x^2)^(1/2)+a^4*b^-5*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-2*(c*x^2)^5//2*(a+b*x)^-1, x) == :(a^2*b^-3*c^2*(c*x^2)^(1/2)+1//3*b^-1*c^2*x^2*(c*x^2)^(1/2)+-1//2*a*x*b^-2*c^2*(c*x^2)^(1/2)+-1*a^3*b^-4*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-3*(c*x^2)^5//2*(a+b*x)^-1, x) == :((1/2)*x*b^-1*c^2*(c*x^2)^(1/2)+-1*a*b^-2*c^2*(c*x^2)^(1/2)+a^2*b^-3*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-4*(c*x^2)^5//2*(a+b*x)^-1, x) == :(b^-1*c^2*(c*x^2)^(1/2)+-1*a*b^-2*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-5*(c*x^2)^5//2*(a+b*x)^-1, x) == :(b^-1*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-6*(c*x^2)^5//2*(a+b*x)^-1, x) == :(a^-1*c^2*x^-1*(c*x^2)^(1/2)*log(x)+-1*a^-1*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-7*(c*x^2)^5//2*(a+b*x)^-1, x) == :(-1*a^-1*c^2*x^-2*(c*x^2)^(1/2)+b*a^-2*c^2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+-1*b*a^-2*c^2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^4*(c*x^2)^-1//2*(a+b*x)^-1, x) == :(1//3*b^-1*x^4*(c*x^2)^-1//2+a^2*b^-3*x^2*(c*x^2)^-1//2+-1//2*a*b^-2*x^3*(c*x^2)^-1//2+-1*x*a^3*b^-4*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^3*(c*x^2)^-1//2*(a+b*x)^-1, x) == :((1/2)*b^-1*x^3*(c*x^2)^-1//2+-1*a*b^-2*x^2*(c*x^2)^-1//2+x*a^2*b^-3*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^2*(c*x^2)^-1//2*(a+b*x)^-1, x) == :(b^-1*x^2*(c*x^2)^-1//2+-1*a*x*b^-2*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x*(c*x^2)^-1//2*(a+b*x)^-1, x) == :(x*b^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate((c*x^2)^-1//2*(a+b*x)^-1, x) == :(x*a^-1*(c*x^2)^-1//2*log(x)+-1*x*a^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^-1*(c*x^2)^-1//2*(a+b*x)^-1, x) == :(-1*a^-1*(c*x^2)^-1//2+b*x*a^-2*(c*x^2)^-1//2*log(a+b*x)+-1*b*x*a^-2*(c*x^2)^-1//2*log(x))
@test integrate(x^-2*(c*x^2)^-1//2*(a+b*x)^-1, x) == :(b*a^-2*(c*x^2)^-1//2+-1//2*a^-1*x^-1*(c*x^2)^-1//2+x*a^-3*b^2*(c*x^2)^-1//2*log(x)+-1*x*a^-3*b^2*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^-3*(c*x^2)^-1//2*(a+b*x)^-1, x) == :(-1*a^-3*b^2*(c*x^2)^-1//2+-1//3*a^-1*x^-2*(c*x^2)^-1//2+(1/2)*b*a^-2*x^-1*(c*x^2)^-1//2+x*a^-4*b^3*(c*x^2)^-1//2*log(a+b*x)+-1*x*a^-4*b^3*(c*x^2)^-1//2*log(x))
@test integrate(x^6*(c*x^2)^-3//2*(a+b*x)^-1, x) == :(1//3*b^-1*c^-1*x^4*(c*x^2)^-1//2+a^2*b^-3*c^-1*x^2*(c*x^2)^-1//2+-1//2*a*b^-2*c^-1*x^3*(c*x^2)^-1//2+-1*x*a^3*b^-4*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^5*(c*x^2)^-3//2*(a+b*x)^-1, x) == :((1/2)*b^-1*c^-1*x^3*(c*x^2)^-1//2+-1*a*b^-2*c^-1*x^2*(c*x^2)^-1//2+x*a^2*b^-3*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^4*(c*x^2)^-3//2*(a+b*x)^-1, x) == :(b^-1*c^-1*x^2*(c*x^2)^-1//2+-1*a*x*b^-2*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^3*(c*x^2)^-3//2*(a+b*x)^-1, x) == :(x*b^-1*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^2*(c*x^2)^-3//2*(a+b*x)^-1, x) == :(x*a^-1*c^-1*(c*x^2)^-1//2*log(x)+-1*x*a^-1*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x*(c*x^2)^-3//2*(a+b*x)^-1, x) == :(-1*a^-1*c^-1*(c*x^2)^-1//2+b*x*a^-2*c^-1*(c*x^2)^-1//2*log(a+b*x)+-1*b*x*a^-2*c^-1*(c*x^2)^-1//2*log(x))
@test integrate((c*x^2)^-3//2*(a+b*x)^-1, x) == :(b*a^-2*c^-1*(c*x^2)^-1//2+-1//2*a^-1*c^-1*x^-1*(c*x^2)^-1//2+x*a^-3*b^2*c^-1*(c*x^2)^-1//2*log(x)+-1*x*a^-3*b^2*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^-1*(c*x^2)^-3//2*(a+b*x)^-1, x) == :(-1*a^-3*b^2*c^-1*(c*x^2)^-1//2+-1//3*a^-1*c^-1*x^-2*(c*x^2)^-1//2+(1/2)*b*a^-2*c^-1*x^-1*(c*x^2)^-1//2+x*a^-4*b^3*c^-1*(c*x^2)^-1//2*log(a+b*x)+-1*x*a^-4*b^3*c^-1*(c*x^2)^-1//2*log(x))
@test integrate(x^3*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :(3*a^2*b^-4*(c*x^2)^(1/2)+1//3*b^-2*x^2*(c*x^2)^(1/2)+-1*a*x*b^-3*(c*x^2)^(1/2)+-1*a^4*b^-5*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-4*a^3*b^-5*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^2*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :((1/2)*x*b^-2*(c*x^2)^(1/2)+-2*a*b^-3*(c*x^2)^(1/2)+a^3*b^-4*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+3*a^2*b^-4*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :(b^-2*(c*x^2)^(1/2)+-1*a^2*b^-3*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-2*a*b^-3*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate((c*x^2)^(1/2)*(a+b*x)^-2, x) == :(b^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+a*b^-2*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1)
@test integrate(x^-1*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :(-1*b^-1*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1)
@test integrate(x^-2*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :(a^-1*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+a^-2*x^-1*(c*x^2)^(1/2)*log(x)+-1*a^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-3*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :(-1*a^-2*x^-2*(c*x^2)^(1/2)+-1*b*a^-2*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-2*b*a^-3*x^-1*(c*x^2)^(1/2)*log(x)+2*b*a^-3*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-4*(c*x^2)^(1/2)*(a+b*x)^-2, x) == :(-1//2*a^-2*x^-3*(c*x^2)^(1/2)+2*b*a^-3*x^-2*(c*x^2)^(1/2)+a^-3*b^2*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-3*a^-4*b^2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+3*a^-4*b^2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x*(c*x^2)^3//2*(a+b*x)^-2, x) == :(3*c*a^2*b^-4*(c*x^2)^(1/2)+1//3*c*b^-2*x^2*(c*x^2)^(1/2)+-1*a*c*x*b^-3*(c*x^2)^(1/2)+-1*c*a^4*b^-5*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-4*c*a^3*b^-5*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate((c*x^2)^3//2*(a+b*x)^-2, x) == :((1/2)*c*x*b^-2*(c*x^2)^(1/2)+-2*a*c*b^-3*(c*x^2)^(1/2)+c*a^3*b^-4*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+3*c*a^2*b^-4*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-1*(c*x^2)^3//2*(a+b*x)^-2, x) == :(c*b^-2*(c*x^2)^(1/2)+-1*c*a^2*b^-3*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-2*a*c*b^-3*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-2*(c*x^2)^3//2*(a+b*x)^-2, x) == :(c*b^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+a*c*b^-2*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1)
@test integrate(x^-3*(c*x^2)^3//2*(a+b*x)^-2, x) == :(-1*c*b^-1*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1)
@test integrate(x^-4*(c*x^2)^3//2*(a+b*x)^-2, x) == :(c*a^-1*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+c*a^-2*x^-1*(c*x^2)^(1/2)*log(x)+-1*c*a^-2*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-5*(c*x^2)^3//2*(a+b*x)^-2, x) == :(-1*c*a^-2*x^-2*(c*x^2)^(1/2)+-1*b*c*a^-2*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-2*b*c*a^-3*x^-1*(c*x^2)^(1/2)*log(x)+2*b*c*a^-3*x^-1*(c*x^2)^(1/2)*log(a+b*x))
@test integrate(x^-6*(c*x^2)^3//2*(a+b*x)^-2, x) == :(-1//2*c*a^-2*x^-3*(c*x^2)^(1/2)+2*b*c*a^-3*x^-2*(c*x^2)^(1/2)+c*a^-3*b^2*x^-1*(c*x^2)^(1/2)*(a+b*x)^-1+-3*c*a^-4*b^2*x^-1*(c*x^2)^(1/2)*log(a+b*x)+3*c*a^-4*b^2*x^-1*(c*x^2)^(1/2)*log(x))
@test integrate(x^5*(c*x^2)^-1//2*(a+b*x)^-2, x) == :(1//3*b^-2*x^4*(c*x^2)^-1//2+-1*a*b^-3*x^3*(c*x^2)^-1//2+3*a^2*b^-4*x^2*(c*x^2)^-1//2+-1*x*a^4*b^-5*(c*x^2)^-1//2*(a+b*x)^-1+-4*x*a^3*b^-5*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^4*(c*x^2)^-1//2*(a+b*x)^-2, x) == :((1/2)*b^-2*x^3*(c*x^2)^-1//2+-2*a*b^-3*x^2*(c*x^2)^-1//2+x*a^3*b^-4*(c*x^2)^-1//2*(a+b*x)^-1+3*x*a^2*b^-4*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^3*(c*x^2)^-1//2*(a+b*x)^-2, x) == :(b^-2*x^2*(c*x^2)^-1//2+-1*x*a^2*b^-3*(c*x^2)^-1//2*(a+b*x)^-1+-2*a*x*b^-3*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^2*(c*x^2)^-1//2*(a+b*x)^-2, x) == :(x*b^-2*(c*x^2)^-1//2*log(a+b*x)+a*x*b^-2*(c*x^2)^-1//2*(a+b*x)^-1)
@test integrate(x*(c*x^2)^-1//2*(a+b*x)^-2, x) == :(-1*x*b^-1*(c*x^2)^-1//2*(a+b*x)^-1)
@test integrate((c*x^2)^-1//2*(a+b*x)^-2, x) == :(x*a^-1*(c*x^2)^-1//2*(a+b*x)^-1+x*a^-2*(c*x^2)^-1//2*log(x)+-1*x*a^-2*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^-1*(c*x^2)^-1//2*(a+b*x)^-2, x) == :(-1*a^-2*(c*x^2)^-1//2+-1*b*x*a^-2*(c*x^2)^-1//2*(a+b*x)^-1+-2*b*x*a^-3*(c*x^2)^-1//2*log(x)+2*b*x*a^-3*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^-2*(c*x^2)^-1//2*(a+b*x)^-2, x) == :(2*b*a^-3*(c*x^2)^-1//2+-1//2*a^-2*x^-1*(c*x^2)^-1//2+x*a^-3*b^2*(c*x^2)^-1//2*(a+b*x)^-1+-3*x*a^-4*b^2*(c*x^2)^-1//2*log(a+b*x)+3*x*a^-4*b^2*(c*x^2)^-1//2*log(x))
@test integrate(x^5*(c*x^2)^-3//2*(a+b*x)^-2, x) == :(b^-2*c^-1*x^2*(c*x^2)^-1//2+-1*x*a^2*b^-3*c^-1*(c*x^2)^-1//2*(a+b*x)^-1+-2*a*x*b^-3*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x^4*(c*x^2)^-3//2*(a+b*x)^-2, x) == :(x*b^-2*c^-1*(c*x^2)^-1//2*log(a+b*x)+a*x*b^-2*c^-1*(c*x^2)^-1//2*(a+b*x)^-1)
@test integrate(x^3*(c*x^2)^-3//2*(a+b*x)^-2, x) == :(-1*x*b^-1*c^-1*(c*x^2)^-1//2*(a+b*x)^-1)
@test integrate(x^2*(c*x^2)^-3//2*(a+b*x)^-2, x) == :(x*a^-1*c^-1*(c*x^2)^-1//2*(a+b*x)^-1+x*a^-2*c^-1*(c*x^2)^-1//2*log(x)+-1*x*a^-2*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate(x*(c*x^2)^-3//2*(a+b*x)^-2, x) == :(-1*a^-2*c^-1*(c*x^2)^-1//2+-1*b*x*a^-2*c^-1*(c*x^2)^-1//2*(a+b*x)^-1+-2*b*x*a^-3*c^-1*(c*x^2)^-1//2*log(x)+2*b*x*a^-3*c^-1*(c*x^2)^-1//2*log(a+b*x))
@test integrate((c*x^2)^-3//2*(a+b*x)^-2, x) == :(2*b*a^-3*c^-1*(c*x^2)^-1//2+-1//2*a^-2*c^-1*x^-1*(c*x^2)^-1//2+x*a^-3*b^2*c^-1*(c*x^2)^-1//2*(a+b*x)^-1+-3*x*a^-4*b^2*c^-1*(c*x^2)^-1//2*log(a+b*x)+3*x*a^-4*b^2*c^-1*(c*x^2)^-1//2*log(x))
@test integrate(x^2*(c*x^2)^(1/2)*(a+b*x)^n, x) == :(b^-4*x^-1*(c*x^2)^(1/2)*(4+n)^-1*(a+b*x)^(4+n)+-1*a^3*b^-4*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-3*a*b^-4*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+3*a^2*b^-4*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x*(c*x^2)^(1/2)*(a+b*x)^n, x) == :(b^-3*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+a^2*b^-3*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-2*a*b^-3*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n))
@test integrate((c*x^2)^(1/2)*(a+b*x)^n, x) == :(b^-2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n)+-1*a*b^-2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^-1*(c*x^2)^(1/2)*(a+b*x)^n, x) == :(b^-1*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x*(c*x^2)^3//2*(a+b*x)^n, x) == :(c*b^-5*x^-1*(c*x^2)^(1/2)*(5+n)^-1*(a+b*x)^(5+n)+c*a^4*b^-5*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-4*a*c*b^-5*x^-1*(c*x^2)^(1/2)*(4+n)^-1*(a+b*x)^(4+n)+-4*c*a^3*b^-5*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n)+6*c*a^2*b^-5*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n))
@test integrate((c*x^2)^3//2*(a+b*x)^n, x) == :(c*b^-4*x^-1*(c*x^2)^(1/2)*(4+n)^-1*(a+b*x)^(4+n)+-1*c*a^3*b^-4*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-3*a*c*b^-4*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+3*c*a^2*b^-4*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^-1*(c*x^2)^3//2*(a+b*x)^n, x) == :(c*b^-3*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+c*a^2*b^-3*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-2*a*c*b^-3*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^-2*(c*x^2)^3//2*(a+b*x)^n, x) == :(c*b^-2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n)+-1*a*c*b^-2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^-3*(c*x^2)^3//2*(a+b*x)^n, x) == :(c*b^-1*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n))
@test integrate((c*x^2)^5//2*(a+b*x)^n, x) == :(b^-6*c^2*x^-1*(c*x^2)^(1/2)*(6+n)^-1*(a+b*x)^(6+n)+-1*a^5*b^-6*c^2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-10*a^3*b^-6*c^2*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+-5*a*b^-6*c^2*x^-1*(c*x^2)^(1/2)*(5+n)^-1*(a+b*x)^(5+n)+5*a^4*b^-6*c^2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n)+10*a^2*b^-6*c^2*x^-1*(c*x^2)^(1/2)*(4+n)^-1*(a+b*x)^(4+n))
@test integrate(x^-1*(c*x^2)^5//2*(a+b*x)^n, x) == :(b^-5*c^2*x^-1*(c*x^2)^(1/2)*(5+n)^-1*(a+b*x)^(5+n)+a^4*b^-5*c^2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-4*a*b^-5*c^2*x^-1*(c*x^2)^(1/2)*(4+n)^-1*(a+b*x)^(4+n)+-4*a^3*b^-5*c^2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n)+6*a^2*b^-5*c^2*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n))
@test integrate(x^-2*(c*x^2)^5//2*(a+b*x)^n, x) == :(b^-4*c^2*x^-1*(c*x^2)^(1/2)*(4+n)^-1*(a+b*x)^(4+n)+-1*a^3*b^-4*c^2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-3*a*b^-4*c^2*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+3*a^2*b^-4*c^2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^-3*(c*x^2)^5//2*(a+b*x)^n, x) == :(b^-3*c^2*x^-1*(c*x^2)^(1/2)*(3+n)^-1*(a+b*x)^(3+n)+a^2*b^-3*c^2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n)+-2*a*b^-3*c^2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^-4*(c*x^2)^5//2*(a+b*x)^n, x) == :(b^-2*c^2*x^-1*(c*x^2)^(1/2)*(2+n)^-1*(a+b*x)^(2+n)+-1*a*b^-2*c^2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^-5*(c*x^2)^5//2*(a+b*x)^n, x) == :(b^-1*c^2*x^-1*(c*x^2)^(1/2)*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^4*(c*x^2)^-1//2*(a+b*x)^n, x) == :(x*b^-4*(c*x^2)^-1//2*(4+n)^-1*(a+b*x)^(4+n)+-1*x*a^3*b^-4*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n)+-3*a*x*b^-4*(c*x^2)^-1//2*(3+n)^-1*(a+b*x)^(3+n)+3*x*a^2*b^-4*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^3*(c*x^2)^-1//2*(a+b*x)^n, x) == :(x*b^-3*(c*x^2)^-1//2*(3+n)^-1*(a+b*x)^(3+n)+x*a^2*b^-3*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n)+-2*a*x*b^-3*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^2*(c*x^2)^-1//2*(a+b*x)^n, x) == :(x*b^-2*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n)+-1*a*x*b^-2*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x*(c*x^2)^-1//2*(a+b*x)^n, x) == :(x*b^-1*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^6*(c*x^2)^-3//2*(a+b*x)^n, x) == :(x*b^-4*c^-1*(c*x^2)^-1//2*(4+n)^-1*(a+b*x)^(4+n)+-1*x*a^3*b^-4*c^-1*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n)+-3*a*x*b^-4*c^-1*(c*x^2)^-1//2*(3+n)^-1*(a+b*x)^(3+n)+3*x*a^2*b^-4*c^-1*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^5*(c*x^2)^-3//2*(a+b*x)^n, x) == :(x*b^-3*c^-1*(c*x^2)^-1//2*(3+n)^-1*(a+b*x)^(3+n)+x*a^2*b^-3*c^-1*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n)+-2*a*x*b^-3*c^-1*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^4*(c*x^2)^-3//2*(a+b*x)^n, x) == :(x*b^-2*c^-1*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n)+-1*a*x*b^-2*c^-1*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^3*(c*x^2)^-3//2*(a+b*x)^n, x) == :(x*b^-1*c^-1*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^8*(c*x^2)^-5//2*(a+b*x)^n, x) == :(x*b^-4*c^-2*(c*x^2)^-1//2*(4+n)^-1*(a+b*x)^(4+n)+-1*x*a^3*b^-4*c^-2*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n)+-3*a*x*b^-4*c^-2*(c*x^2)^-1//2*(3+n)^-1*(a+b*x)^(3+n)+3*x*a^2*b^-4*c^-2*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^7*(c*x^2)^-5//2*(a+b*x)^n, x) == :(x*b^-3*c^-2*(c*x^2)^-1//2*(3+n)^-1*(a+b*x)^(3+n)+x*a^2*b^-3*c^-2*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n)+-2*a*x*b^-3*c^-2*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n))
@test integrate(x^6*(c*x^2)^-5//2*(a+b*x)^n, x) == :(x*b^-2*c^-2*(c*x^2)^-1//2*(2+n)^-1*(a+b*x)^(2+n)+-1*a*x*b^-2*c^-2*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate(x^5*(c*x^2)^-5//2*(a+b*x)^n, x) == :(x*b^-1*c^-2*(c*x^2)^-1//2*(1+n)^-1*(a+b*x)^(1+n))
@test integrate((c*x^2)^5//2*(d*x)^m*(a+b*x), x) == :(a*c^2*d^-6*x^-1*(c*x^2)^(1/2)*(d*x)^(6+m)*(6+m)^-1+b*c^2*d^-7*x^-1*(c*x^2)^(1/2)*(d*x)^(7+m)*(7+m)^-1)
@test integrate((c*x^2)^3//2*(d*x)^m*(a+b*x), x) == :(a*c*d^-4*x^-1*(c*x^2)^(1/2)*(d*x)^(4+m)*(4+m)^-1+b*c*d^-5*x^-1*(c*x^2)^(1/2)*(d*x)^(5+m)*(5+m)^-1)
@test integrate((c*x^2)^(1/2)*(d*x)^m*(a+b*x), x) == :(a*d^-2*x^-1*(c*x^2)^(1/2)*(d*x)^(2+m)*(2+m)^-1+b*d^-3*x^-1*(c*x^2)^(1/2)*(d*x)^(3+m)*(3+m)^-1)
@test integrate((c*x^2)^-1//2*(d*x)^m*(a+b*x), x) == :(a*x*m^-1*(c*x^2)^-1//2*(d*x)^m+b*x*d^-1*(c*x^2)^-1//2*(d*x)^(1+m)*(1+m)^-1)
@test integrate((c*x^2)^-3//2*(d*x)^m*(a+b*x), x) == :(-1*a*x*c^-1*d^2*(c*x^2)^-1//2*(d*x)^(-2+m)*(2+-1m)^-1+-1*b*d*x*c^-1*(c*x^2)^-1//2*(d*x)^(-1+m)*(1+-1m)^-1)
@test integrate((c*x^2)^-5//2*(d*x)^m*(a+b*x), x) == :(-1*a*x*c^-2*d^4*(c*x^2)^-1//2*(d*x)^(-4+m)*(4+-1m)^-1+-1*b*x*c^-2*d^3*(c*x^2)^-1//2*(d*x)^(-3+m)*(3+-1m)^-1)
@test integrate((c*x^2)^5//2*(d*x)^m*(a+b*x)^2, x) == :(a^2*c^2*d^-6*x^-1*(c*x^2)^(1/2)*(d*x)^(6+m)*(6+m)^-1+b^2*c^2*d^-8*x^-1*(c*x^2)^(1/2)*(d*x)^(8+m)*(8+m)^-1+2*a*b*c^2*d^-7*x^-1*(c*x^2)^(1/2)*(d*x)^(7+m)*(7+m)^-1)
@test integrate((c*x^2)^3//2*(d*x)^m*(a+b*x)^2, x) == :(c*a^2*d^-4*x^-1*(c*x^2)^(1/2)*(d*x)^(4+m)*(4+m)^-1+c*b^2*d^-6*x^-1*(c*x^2)^(1/2)*(d*x)^(6+m)*(6+m)^-1+2*a*b*c*d^-5*x^-1*(c*x^2)^(1/2)*(d*x)^(5+m)*(5+m)^-1)
@test integrate((c*x^2)^(1/2)*(d*x)^m*(a+b*x)^2, x) == :(a^2*d^-2*x^-1*(c*x^2)^(1/2)*(d*x)^(2+m)*(2+m)^-1+b^2*d^-4*x^-1*(c*x^2)^(1/2)*(d*x)^(4+m)*(4+m)^-1+2*a*b*d^-3*x^-1*(c*x^2)^(1/2)*(d*x)^(3+m)*(3+m)^-1)
@test integrate((c*x^2)^-1//2*(d*x)^m*(a+b*x)^2, x) == :(x*a^2*m^-1*(c*x^2)^-1//2*(d*x)^m+x*b^2*d^-2*(c*x^2)^-1//2*(d*x)^(2+m)*(2+m)^-1+2*a*b*x*d^-1*(c*x^2)^-1//2*(d*x)^(1+m)*(1+m)^-1)
@test integrate((c*x^2)^-3//2*(d*x)^m*(a+b*x)^2, x) == :(x*b^2*c^-1*m^-1*(c*x^2)^-1//2*(d*x)^m+-1*x*a^2*c^-1*d^2*(c*x^2)^-1//2*(d*x)^(-2+m)*(2+-1m)^-1+-2*a*b*d*x*c^-1*(c*x^2)^-1//2*(d*x)^(-1+m)*(1+-1m)^-1)
@test integrate((c*x^2)^-5//2*(d*x)^m*(a+b*x)^2, x) == :(-1*x*a^2*c^-2*d^4*(c*x^2)^-1//2*(d*x)^(-4+m)*(4+-1m)^-1+-1*x*b^2*c^-2*d^2*(c*x^2)^-1//2*(d*x)^(-2+m)*(2+-1m)^-1+-2*a*b*x*c^-2*d^3*(c*x^2)^-1//2*(d*x)^(-3+m)*(3+-1m)^-1)
@test integrate(x^3*(c*x^2)^p*(a+b*x)^(-5+-2p), x) == :((1/2)*a^-1*x^4*(c*x^2)^p*(2+p)^-1*(a+b*x)^(-4+-2p))
@test integrate(x^2*(c*x^2)^p*(a+b*x)^(-4+-2p), x) == :(a^-1*x^3*(c*x^2)^p*(3+2p)^-1*(a+b*x)^(-3+-2p))
@test integrate(x*(c*x^2)^p*(a+b*x)^(-3+-2p), x) == :((1/2)*a^-1*x^2*(c*x^2)^p*(1+p)^-1*(a+b*x)^(-2+-2p))
@test integrate((c*x^2)^p*(a+b*x)^(-2+-2p), x) == :(x*a^-1*(c*x^2)^p*(1+2p)^-1*(a+b*x)^(-1+-2p))
@test integrate(x^-1*(c*x^2)^p*(a+b*x)^(-1+-2p), x) == :((1/2)*a^-1*p^-1*(c*x^2)^p*(a+b*x)^(-2p))
@test integrate(x^-2*(c*x^2)^p*(a+b*x)^(-2p), x) == :(-1*a^-1*x^-1*(c*x^2)^p*(1+-2p)^-1*(a+b*x)^(1+-2p))
@test integrate(x^-3*(c*x^2)^p*(a+b*x)^(1+-2p), x) == :(-1//2*a^-1*x^-2*(c*x^2)^p*(1+-1p)^-1*(a+b*x)^(2+-2p))
@test integrate(x^-4*(c*x^2)^p*(a+b*x)^(2+-2p), x) == :(-1*a^-1*x^-3*(c*x^2)^p*(3+-2p)^-1*(a+b*x)^(3+-2p))
@test integrate(x^m*(c*x^2)^p*(a+b*x)^(-2+-1m+-2p), x) == :(a^-1*x^(1+m)*(c*x^2)^p*(a+b*x)^(-1+-1m+-2p)*(1+m+2p)^-1)
@test integrate((c*x^2)^p*(d*x)^m*(a+b*x)^(-2+-1m+-2p), x) == :(x*a^-1*(c*x^2)^p*(d*x)^m*(a+b*x)^(-1+-1m+-2p)*(1+m+2p)^-1)
@test integrate((a+b*x)^5*(d*x+a*d*b^-1)^-3, x) == :(1//3*b^2*d^-3*(a+b*x)^3)
@test integrate((a+b*x)^4*(d*x+a*d*b^-1)^-3, x) == :((1/2)*b^4*d^-3*x^2+a*x*b^3*d^-3)
@test integrate((a+b*x)^3*(d*x+a*d*b^-1)^-3, x) == :(x*b^3*d^-3)
@test integrate((a+b*x)^2*(d*x+a*d*b^-1)^-3, x) == :(b^2*d^-3*log(a+b*x))
@test integrate((d*x+a*d*b^-1)^-3*(a+b*x), x) == :(-1*b^2*d^-3*(a+b*x)^-1)
@test integrate((a+b*x)^-1*(d*x+a*d*b^-1)^-3, x) == :(-1//3*b^2*d^-3*(a+b*x)^-3)
@test integrate((a+b*x)^-2*(d*x+a*d*b^-1)^-3, x) == :(-1//4*b^2*d^-3*(a+b*x)^-4)
@test integrate((a+b*x)^-3*(d*x+a*d*b^-1)^-3, x) == :(-1//5*b^2*d^-3*(a+b*x)^-5)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^5, x) == :(1//3*b^5*d^-6*(c+d*x)^3)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^4, x) == :((1/2)*b^4*d^-3*x^2+c*x*b^4*d^-4)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^3, x) == :(x*b^3*d^-3)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^2, x) == :(b^2*d^-3*log(c+d*x))
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1), x) == :(-1*b*d^-2*(c+d*x)^-1)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^-1, x) == :(-1//3*b^-1*(c+d*x)^-3)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^-2, x) == :(-1//4*d*b^-2*(c+d*x)^-4)
@test integrate((c+d*x)^-3*(b*x+b*c*d^-1)^-3, x) == :(-1//5*b^-3*d^2*(c+d*x)^-5)
@test integrate((a+b*x)^5*(a*c+b*c*x)^n, x) == :(b^-1*c^-6*(6+n)^-1*(a*c+b*c*x)^(6+n))
@test integrate((a+b*x)^5*(a*c+b*c*x)^3, x) == :(1//9*b^-1*c^3*(a+b*x)^9)
@test integrate((a+b*x)^5*(a*c+b*c*x)^2, x) == :(1//8*b^-1*c^2*(a+b*x)^8)
@test integrate((a+b*x)^5*(a*c+b*c*x), x) == :(1//7*c*b^-1*(a+b*x)^7)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-1, x) == :(1//5*b^-1*c^-1*(a+b*x)^5)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-2, x) == :(1//4*b^-1*c^-2*(a+b*x)^4)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-3, x) == :(1//3*b^-1*c^-3*(a+b*x)^3)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-4, x) == :(a*x*c^-4+(1/2)*b*c^-4*x^2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-5, x) == :(x*c^-5)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-6, x) == :(b^-1*c^-6*log(a+b*x))
@test integrate((a+b*x)^5*(a*c+b*c*x)^-7, x) == :(-1*b^-1*c^-7*(a+b*x)^-1)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-8, x) == :(-1//2*b^-1*c^-8*(a+b*x)^-2)
@test integrate((-2+-3x)^-1//2*(2+3x)^-1//2, x) == :(1//3*(-2+-3x)^-1//2*(2+3x)^(1/2)*log(2+3x))
@test integrate((a*c+-1*b*c*x)^3*(a+b*x), x) == :(1//5*b^-1*c^3*(a+-1*b*x)^5+-1//2*a*b^-1*c^3*(a+-1*b*x)^4)
@test integrate((a*c+-1*b*c*x)^2*(a+b*x), x) == :(1//4*b^-1*c^2*(a+-1*b*x)^4+-2//3*a*b^-1*c^2*(a+-1*b*x)^3)
@test integrate((a+b*x)*(a*c+-1*b*c*x), x) == :(c*x*a^2+-1//3*c*b^2*x^3)
@test integrate(a+b*x, x) == :(a*x+(1/2)*b*x^2)
@test integrate((a*c+-1*b*c*x)^-1*(a+b*x), x) == :(-1*x*c^-1+-2*a*b^-1*c^-1*log(a+-1*b*x))
@test integrate((a*c+-1*b*c*x)^-2*(a+b*x), x) == :(b^-1*c^-2*log(a+-1*b*x)+2*a*b^-1*c^-2*(a+-1*b*x)^-1)
@test integrate((a*c+-1*b*c*x)^-3*(a+b*x), x) == :(x*c^-3*(a+-1*b*x)^-2)
@test integrate((a*c+-1*b*c*x)^-4*(a+b*x), x) == :(-1//2*b^-1*c^-4*(a+-1*b*x)^-2+2//3*a*b^-1*c^-4*(a+-1*b*x)^-3)
@test integrate((a*c+-1*b*c*x)^-5*(a+b*x), x) == :(-1//3*b^-1*c^-5*(a+-1*b*x)^-3+(1/2)*a*b^-1*c^-5*(a+-1*b*x)^-4)
@test integrate((a*c+-1*b*c*x)^-6*(a+b*x), x) == :(-1//4*b^-1*c^-6*(a+-1*b*x)^-4+2//5*a*b^-1*c^-6*(a+-1*b*x)^-5)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^3, x) == :(-1//6*b^-1*c^3*(a+-1*b*x)^6+-1*a^2*b^-1*c^3*(a+-1*b*x)^4+4//5*a*b^-1*c^3*(a+-1*b*x)^5)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^2, x) == :(x*a^4*c^2+1//5*b^4*c^2*x^5+-2//3*a^2*b^2*c^2*x^3)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x), x) == :(-1//4*c*b^-1*(a+b*x)^4+2//3*a*c*b^-1*(a+b*x)^3)
@test integrate((a+b*x)^2, x) == :(1//3*b^-1*(a+b*x)^3)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-1, x) == :(-2*a*x*c^-1+-1//2*b^-1*c^-1*(a+b*x)^2+-4*a^2*b^-1*c^-1*log(a+-1*b*x))
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-2, x) == :(x*c^-2+4*a*b^-1*c^-2*log(a+-1*b*x)+4*a^2*b^-1*c^-2*(a+-1*b*x)^-1)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-3, x) == :(-1*b^-1*c^-3*log(a+-1*b*x)+-4*a*b^-1*c^-3*(a+-1*b*x)^-1+2*a^2*b^-1*c^-3*(a+-1*b*x)^-2)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-4, x) == :(1//6*a^-1*b^-1*c^-4*(a+b*x)^3*(a+-1*b*x)^-3)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-5, x) == :((1/2)*b^-1*c^-5*(a+-1*b*x)^-2+a^2*b^-1*c^-5*(a+-1*b*x)^-4+-4//3*a*b^-1*c^-5*(a+-1*b*x)^-3)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-6, x) == :(1//3*b^-1*c^-6*(a+-1*b*x)^-3+-1*a*b^-1*c^-6*(a+-1*b*x)^-4+4//5*a^2*b^-1*c^-6*(a+-1*b*x)^-5)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^-7, x) == :(1//4*b^-1*c^-7*(a+-1*b*x)^-4+-4//5*a*b^-1*c^-7*(a+-1*b*x)^-5+2//3*a^2*b^-1*c^-7*(a+-1*b*x)^-6)
@test integrate((a+b*x)^-1*(a*c+-1*b*c*x)^3, x) == :(-4*x*a^2*c^3+1//3*b^-1*c^3*(a+-1*b*x)^3+a*b^-1*c^3*(a+-1*b*x)^2+8*a^3*b^-1*c^3*log(a+b*x))
@test integrate((a+b*x)^-1*(a*c+-1*b*c*x)^2, x) == :((1/2)*b^-1*c^2*(a+-1*b*x)^2+-2*a*x*c^2+4*a^2*b^-1*c^2*log(a+b*x))
@test integrate((a+b*x)^-1*(a*c+-1*b*c*x), x) == :(-1*c*x+2*a*c*b^-1*log(a+b*x))
@test integrate((a+b*x)^-1, x) == :(b^-1*log(a+b*x))
@test integrate((a+b*x)^-1*(a*c+-1*b*c*x)^-1, x) == :(a^-1*b^-1*c^-1*arctanh(b*x*a^-1))
@test integrate((a+b*x)^-1*(a*c+-1*b*c*x)^-2, x) == :((1/2)*a^-1*b^-1*c^-2*(a+-1*b*x)^-1+(1/2)*a^-2*b^-1*c^-2*arctanh(b*x*a^-1))
@test integrate((a+b*x)^-1*(a*c+-1*b*c*x)^-3, x) == :(1//4*a^-1*b^-1*c^-3*(a+-1*b*x)^-2+1//4*a^-3*b^-1*c^-3*arctanh(b*x*a^-1)+1//4*a^-2*b^-1*c^-3*(a+-1*b*x)^-1)
@test integrate((a+b*x)^-2*(a*c+-1*b*c*x)^3, x) == :(5*a*x*c^3+-1//2*b*c^3*x^2+-12*a^2*b^-1*c^3*log(a+b*x)+-8*a^3*b^-1*c^3*(a+b*x)^-1)
@test integrate((a+b*x)^-2*(a*c+-1*b*c*x)^2, x) == :(x*c^2+-4*a*b^-1*c^2*log(a+b*x)+-4*a^2*b^-1*c^2*(a+b*x)^-1)
@test integrate((a+b*x)^-2*(a*c+-1*b*c*x), x) == :(-1*c*b^-1*log(a+b*x)+-2*a*c*b^-1*(a+b*x)^-1)
@test integrate((a+b*x)^-2, x) == :(-1*b^-1*(a+b*x)^-1)
@test integrate((a+b*x)^-2*(a*c+-1*b*c*x)^-1, x) == :((1/2)*a^-2*b^-1*c^-1*arctanh(b*x*a^-1)+-1//2*a^-1*b^-1*c^-1*(a+b*x)^-1)
@test integrate((a+b*x)^-2*(a*c+-1*b*c*x)^-2, x) == :((1/2)*x*a^-2*c^-2*(a^2+-1*b^2*x^2)^-1+(1/2)*a^-3*b^-1*c^-2*arctanh(b*x*a^-1))
@test integrate((a+b*x)^-2*(a*c+-1*b*c*x)^-3, x) == :(-1//8*a^-3*b^-1*c^-3*(a+b*x)^-1+1//4*a^-3*b^-1*c^-3*(a+-1*b*x)^-1+1//8*a^-2*b^-1*c^-3*(a+-1*b*x)^-2+3//8*a^-4*b^-1*c^-3*arctanh(b*x*a^-1))
@test integrate((1+x)^(1/2)*(1+-1x)^9//2, x) == :(21//16*arcsin(x)+1//6*(1+x)^3//2*(1+-1x)^9//2+3//10*(1+x)^3//2*(1+-1x)^7//2+7//8*(1+x)^3//2*(1+-1x)^3//2+21//40*(1+x)^3//2*(1+-1x)^5//2+21//16*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^(1/2)*(1+-1x)^7//2, x) == :(7//8*arcsin(x)+1//5*(1+x)^3//2*(1+-1x)^7//2+7//12*(1+x)^3//2*(1+-1x)^3//2+7//20*(1+x)^3//2*(1+-1x)^5//2+7//8*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^(1/2)*(1+-1x)^5//2, x) == :(5//8*arcsin(x)+1//4*(1+x)^3//2*(1+-1x)^5//2+5//12*(1+x)^3//2*(1+-1x)^3//2+5//8*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^(1/2)*(1+-1x)^3//2, x) == :((1/2)*arcsin(x)+1//3*(1+x)^3//2*(1+-1x)^3//2+(1/2)*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^(1/2)*(1+-1x)^(1/2), x) == :((1/2)*arcsin(x)+(1/2)*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^(1/2)*(1+-1x)^-1//2, x) == :(-1*(1+x)^(1/2)*(1+-1x)^(1/2)+arcsin(x))
@test integrate((1+x)^(1/2)*(1+-1x)^-3//2, x) == :(-1*arcsin(x)+2*(1+x)^(1/2)*(1+-1x)^-1//2)
@test integrate((1+x)^(1/2)*(1+-1x)^-5//2, x) == :(1//3*(1+x)^3//2*(1+-1x)^-3//2)
@test integrate((1+x)^(1/2)*(1+-1x)^-7//2, x) == :(1//5*(1+x)^3//2*(1+-1x)^-5//2+1//15*(1+x)^3//2*(1+-1x)^-3//2)
@test integrate((1+x)^(1/2)*(1+-1x)^-9//2, x) == :(1//7*(1+x)^3//2*(1+-1x)^-7//2+2//35*(1+x)^3//2*(1+-1x)^-5//2+2//105*(1+x)^3//2*(1+-1x)^-3//2)
@test integrate((1+x)^(1/2)*(1+-1x)^-11//2, x) == :(1//9*(1+x)^3//2*(1+-1x)^-9//2+1//21*(1+x)^3//2*(1+-1x)^-7//2+2//105*(1+x)^3//2*(1+-1x)^-5//2+2//315*(1+x)^3//2*(1+-1x)^-3//2)
@test integrate((1+x)^(1/2)*(1+-1x)^-13//2, x) == :(1//11*(1+x)^3//2*(1+-1x)^-11//2+4//99*(1+x)^3//2*(1+-1x)^-9//2+4//231*(1+x)^3//2*(1+-1x)^-7//2+8//1155*(1+x)^3//2*(1+-1x)^-5//2+8//3465*(1+x)^3//2*(1+-1x)^-3//2)
@test integrate((1+x)^3//2*(1+-1x)^9//2, x) == :(9//16*arcsin(x)+1//7*(1+x)^5//2*(1+-1x)^9//2+3//10*(1+x)^5//2*(1+-1x)^5//2+3//14*(1+x)^5//2*(1+-1x)^7//2+3//8*x*(1+x)^3//2*(1+-1x)^3//2+9//16*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^3//2*(1+-1x)^7//2, x) == :(7//16*arcsin(x)+1//6*(1+x)^5//2*(1+-1x)^7//2+7//30*(1+x)^5//2*(1+-1x)^5//2+7//16*x*(1+x)^(1/2)*(1+-1x)^(1/2)+7//24*x*(1+x)^3//2*(1+-1x)^3//2)
@test integrate((1+x)^3//2*(1+-1x)^5//2, x) == :(3//8*arcsin(x)+1//5*(1+x)^5//2*(1+-1x)^5//2+1//4*x*(1+x)^3//2*(1+-1x)^3//2+3//8*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^3//2*(1+-1x)^3//2, x) == :(3//8*arcsin(x)+1//4*x*(1+x)^3//2*(1+-1x)^3//2+3//8*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^3//2*(1+-1x)^(1/2), x) == :((1/2)*arcsin(x)+-1//3*(1+x)^3//2*(1+-1x)^3//2+(1/2)*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^3//2*(1+-1x)^-1//2, x) == :(3//2*arcsin(x)+-3//2*(1+x)^(1/2)*(1+-1x)^(1/2)+-1//2*(1+x)^3//2*(1+-1x)^(1/2))
@test integrate((1+x)^3//2*(1+-1x)^-3//2, x) == :(-3*arcsin(x)+2*(1+x)^3//2*(1+-1x)^-1//2+3*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^3//2*(1+-1x)^-5//2, x) == :(-2*(1+x)^(1/2)*(1+-1x)^-1//2+2//3*(1+x)^3//2*(1+-1x)^-3//2+arcsin(x))
@test integrate((1+x)^3//2*(1+-1x)^-7//2, x) == :(1//5*(1+x)^5//2*(1+-1x)^-5//2)
@test integrate((1+x)^3//2*(1+-1x)^-9//2, x) == :(1//7*(1+x)^5//2*(1+-1x)^-7//2+1//35*(1+x)^5//2*(1+-1x)^-5//2)
@test integrate((1+x)^3//2*(1+-1x)^-11//2, x) == :(1//9*(1+x)^5//2*(1+-1x)^-9//2+2//63*(1+x)^5//2*(1+-1x)^-7//2+2//315*(1+x)^5//2*(1+-1x)^-5//2)
@test integrate((1+x)^3//2*(1+-1x)^-13//2, x) == :(1//11*(1+x)^5//2*(1+-1x)^-11//2+1//33*(1+x)^5//2*(1+-1x)^-9//2+2//231*(1+x)^5//2*(1+-1x)^-7//2+2//1155*(1+x)^5//2*(1+-1x)^-5//2)
@test integrate((1+x)^3//2*(1+-1x)^-15//2, x) == :(1//13*(1+x)^5//2*(1+-1x)^-13//2+4//143*(1+x)^5//2*(1+-1x)^-11//2+4//429*(1+x)^5//2*(1+-1x)^-9//2+8//3003*(1+x)^5//2*(1+-1x)^-7//2+8//15015*(1+x)^5//2*(1+-1x)^-5//2)
@test integrate((1+x)^5//2*(1+-1x)^11//2, x) == :(55//128*arcsin(x)+1//9*(1+x)^7//2*(1+-1x)^11//2+11//56*(1+x)^7//2*(1+-1x)^7//2+11//72*(1+x)^7//2*(1+-1x)^9//2+11//48*x*(1+x)^5//2*(1+-1x)^5//2+55//128*x*(1+x)^(1/2)*(1+-1x)^(1/2)+55//192*x*(1+x)^3//2*(1+-1x)^3//2)
@test integrate((1+x)^5//2*(1+-1x)^9//2, x) == :(45//128*arcsin(x)+1//8*(1+x)^7//2*(1+-1x)^9//2+9//56*(1+x)^7//2*(1+-1x)^7//2+3//16*x*(1+x)^5//2*(1+-1x)^5//2+15//64*x*(1+x)^3//2*(1+-1x)^3//2+45//128*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^5//2*(1+-1x)^7//2, x) == :(5//16*arcsin(x)+1//7*(1+x)^7//2*(1+-1x)^7//2+1//6*x*(1+x)^5//2*(1+-1x)^5//2+5//16*x*(1+x)^(1/2)*(1+-1x)^(1/2)+5//24*x*(1+x)^3//2*(1+-1x)^3//2)
@test integrate((1+x)^5//2*(1+-1x)^5//2, x) == :(5//16*arcsin(x)+1//6*x*(1+x)^5//2*(1+-1x)^5//2+5//16*x*(1+x)^(1/2)*(1+-1x)^(1/2)+5//24*x*(1+x)^3//2*(1+-1x)^3//2)
@test integrate((1+x)^5//2*(1+-1x)^3//2, x) == :(3//8*arcsin(x)+-1//5*(1+x)^5//2*(1+-1x)^5//2+1//4*x*(1+x)^3//2*(1+-1x)^3//2+3//8*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^5//2*(1+-1x)^(1/2), x) == :(5//8*arcsin(x)+-5//12*(1+x)^3//2*(1+-1x)^3//2+-1//4*(1+x)^5//2*(1+-1x)^3//2+5//8*x*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^5//2*(1+-1x)^-1//2, x) == :(5//2*arcsin(x)+-5//2*(1+x)^(1/2)*(1+-1x)^(1/2)+-5//6*(1+x)^3//2*(1+-1x)^(1/2)+-1//3*(1+x)^5//2*(1+-1x)^(1/2))
@test integrate((1+x)^5//2*(1+-1x)^-3//2, x) == :(-15//2*arcsin(x)+2*(1+x)^5//2*(1+-1x)^-1//2+5//2*(1+x)^3//2*(1+-1x)^(1/2)+15//2*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^5//2*(1+-1x)^-5//2, x) == :(5*arcsin(x)+-5*(1+x)^(1/2)*(1+-1x)^(1/2)+-10//3*(1+x)^3//2*(1+-1x)^-1//2+2//3*(1+x)^5//2*(1+-1x)^-3//2)
@test integrate((1+x)^5//2*(1+-1x)^-7//2, x) == :(-1*arcsin(x)+2*(1+x)^(1/2)*(1+-1x)^-1//2+-2//3*(1+x)^3//2*(1+-1x)^-3//2+2//5*(1+x)^5//2*(1+-1x)^-5//2)
@test integrate((1+x)^5//2*(1+-1x)^-9//2, x) == :(1//7*(1+x)^7//2*(1+-1x)^-7//2)
@test integrate((1+x)^5//2*(1+-1x)^-11//2, x) == :(1//9*(1+x)^7//2*(1+-1x)^-9//2+1//63*(1+x)^7//2*(1+-1x)^-7//2)
@test integrate((1+x)^5//2*(1+-1x)^-13//2, x) == :(1//11*(1+x)^7//2*(1+-1x)^-11//2+2//99*(1+x)^7//2*(1+-1x)^-9//2+2//693*(1+x)^7//2*(1+-1x)^-7//2)
@test integrate((1+x)^5//2*(1+-1x)^-15//2, x) == :(1//13*(1+x)^7//2*(1+-1x)^-13//2+2//429*(1+x)^7//2*(1+-1x)^-9//2+2//3003*(1+x)^7//2*(1+-1x)^-7//2+3//143*(1+x)^7//2*(1+-1x)^-11//2)
@test integrate((1+x)^5//2*(1+-1x)^-17//2, x) == :(1//15*(1+x)^7//2*(1+-1x)^-15//2+4//195*(1+x)^7//2*(1+-1x)^-13//2+4//715*(1+x)^7//2*(1+-1x)^-11//2+8//6435*(1+x)^7//2*(1+-1x)^-9//2+8//45045*(1+x)^7//2*(1+-1x)^-7//2)
@test integrate((1+x)^5//2*(1+-1x)^-19//2, x) == :(1//17*(1+x)^7//2*(1+-1x)^-17//2+1//51*(1+x)^7//2*(1+-1x)^-15//2+4//663*(1+x)^7//2*(1+-1x)^-13//2+4//2431*(1+x)^7//2*(1+-1x)^-11//2+8//21879*(1+x)^7//2*(1+-1x)^-9//2+8//153153*(1+x)^7//2*(1+-1x)^-7//2)
@test integrate((1+a*x)^3//2*(1+-1*a*x)^-1//2, x) == :(3//2*a^-1*arcsin(a*x)+-3//2*a^-1*(1+a*x)^(1/2)*(1+-1*a*x)^(1/2)+-1//2*a^-1*(1+a*x)^3//2*(1+-1*a*x)^(1/2))
@test integrate((1+-1*a*x)^-1*(1+-1*a^2*x^2)^(1/2)*(1+a*x), x) == :(-3//2*a^-1*(1+-1*a^2*x^2)^(1/2)+3//2*a^-1*arcsin(a*x)+-1//2*a^-1*(1+-1*a*x)^-1*(1+-1*a^2*x^2)^3//2)
@test integrate((1+x)^-1//2*(1+-1x)^7//2, x) == :(35//8*arcsin(x)+1//4*(1+x)^(1/2)*(1+-1x)^7//2+7//12*(1+x)^(1/2)*(1+-1x)^5//2+35//8*(1+x)^(1/2)*(1+-1x)^(1/2)+35//24*(1+x)^(1/2)*(1+-1x)^3//2)
@test integrate((1+x)^-1//2*(1+-1x)^5//2, x) == :(5//2*arcsin(x)+1//3*(1+x)^(1/2)*(1+-1x)^5//2+5//2*(1+x)^(1/2)*(1+-1x)^(1/2)+5//6*(1+x)^(1/2)*(1+-1x)^3//2)
@test integrate((1+x)^-1//2*(1+-1x)^3//2, x) == :(3//2*arcsin(x)+(1/2)*(1+x)^(1/2)*(1+-1x)^3//2+3//2*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^-1//2*(1+-1x)^(1/2), x) == :((1+x)^(1/2)*(1+-1x)^(1/2)+arcsin(x))
@test integrate((1+x)^-1//2*(1+-1x)^-1//2, x) == :(arcsin(x))
@test integrate((1+x)^-1//2*(1+-1x)^-3//2, x) == :((1+x)^(1/2)*(1+-1x)^-1//2)
@test integrate((1+x)^-1//2*(1+-1x)^-5//2, x) == :(1//3*(1+x)^(1/2)*(1+-1x)^-3//2+1//3*(1+x)^(1/2)*(1+-1x)^-1//2)
@test integrate((1+x)^-1//2*(1+-1x)^-7//2, x) == :(1//5*(1+x)^(1/2)*(1+-1x)^-5//2+2//15*(1+x)^(1/2)*(1+-1x)^-3//2+2//15*(1+x)^(1/2)*(1+-1x)^-1//2)
@test integrate((1+x)^-1//2*(1+-1x)^-9//2, x) == :(1//7*(1+x)^(1/2)*(1+-1x)^-7//2+2//35*(1+x)^(1/2)*(1+-1x)^-3//2+2//35*(1+x)^(1/2)*(1+-1x)^-1//2+3//35*(1+x)^(1/2)*(1+-1x)^-5//2)
@test integrate((1+x)^-1//2*(1+-1x)^-11//2, x) == :(1//9*(1+x)^(1/2)*(1+-1x)^-9//2+4//63*(1+x)^(1/2)*(1+-1x)^-7//2+4//105*(1+x)^(1/2)*(1+-1x)^-5//2+8//315*(1+x)^(1/2)*(1+-1x)^-3//2+8//315*(1+x)^(1/2)*(1+-1x)^-1//2)
@test integrate((1+x)^-3//2*(1+-1x)^7//2, x) == :(-35//2*arcsin(x)+-2*(1+x)^-1//2*(1+-1x)^7//2+-35//2*(1+x)^(1/2)*(1+-1x)^(1/2)+-35//6*(1+x)^(1/2)*(1+-1x)^3//2+-7//3*(1+x)^(1/2)*(1+-1x)^5//2)
@test integrate((1+x)^-3//2*(1+-1x)^5//2, x) == :(-15//2*arcsin(x)+-2*(1+x)^-1//2*(1+-1x)^5//2+-15//2*(1+x)^(1/2)*(1+-1x)^(1/2)+-5//2*(1+x)^(1/2)*(1+-1x)^3//2)
@test integrate((1+x)^-3//2*(1+-1x)^3//2, x) == :(-3*arcsin(x)+-3*(1+x)^(1/2)*(1+-1x)^(1/2)+-2*(1+x)^-1//2*(1+-1x)^3//2)
@test integrate((1+x)^-3//2*(1+-1x)^(1/2), x) == :(-1*arcsin(x)+-2*(1+x)^-1//2*(1+-1x)^(1/2))
@test integrate((1+x)^-3//2*(1+-1x)^-1//2, x) == :(-1*(1+x)^-1//2*(1+-1x)^(1/2))
@test integrate((1+x)^-3//2*(1+-1x)^-3//2, x) == :(x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-3//2*(1+-1x)^-5//2, x) == :(1//3*(1+x)^-1//2*(1+-1x)^-3//2+2//3*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-3//2*(1+-1x)^-7//2, x) == :(1//5*(1+x)^-1//2*(1+-1x)^-5//2+1//5*(1+x)^-1//2*(1+-1x)^-3//2+2//5*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-3//2*(1+-1x)^-9//2, x) == :(1//7*(1+x)^-1//2*(1+-1x)^-7//2+4//35*(1+x)^-1//2*(1+-1x)^-5//2+4//35*(1+x)^-1//2*(1+-1x)^-3//2+8//35*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-3//2*(1+-1x)^-11//2, x) == :(1//9*(1+x)^-1//2*(1+-1x)^-9//2+4//63*(1+x)^-1//2*(1+-1x)^-5//2+4//63*(1+x)^-1//2*(1+-1x)^-3//2+5//63*(1+x)^-1//2*(1+-1x)^-7//2+8//63*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-5//2*(1+-1x)^9//2, x) == :(105//2*arcsin(x)+6*(1+x)^-1//2*(1+-1x)^7//2+7*(1+x)^(1/2)*(1+-1x)^5//2+-2//3*(1+x)^-3//2*(1+-1x)^9//2+35//2*(1+x)^(1/2)*(1+-1x)^3//2+105//2*(1+x)^(1/2)*(1+-1x)^(1/2))
@test integrate((1+x)^-5//2*(1+-1x)^7//2, x) == :(35//2*arcsin(x)+-2//3*(1+x)^-3//2*(1+-1x)^7//2+14//3*(1+x)^-1//2*(1+-1x)^5//2+35//2*(1+x)^(1/2)*(1+-1x)^(1/2)+35//6*(1+x)^(1/2)*(1+-1x)^3//2)
@test integrate((1+x)^-5//2*(1+-1x)^5//2, x) == :(5*arcsin(x)+5*(1+x)^(1/2)*(1+-1x)^(1/2)+-2//3*(1+x)^-3//2*(1+-1x)^5//2+10//3*(1+x)^-1//2*(1+-1x)^3//2)
@test integrate((1+x)^-5//2*(1+-1x)^3//2, x) == :(2*(1+x)^-1//2*(1+-1x)^(1/2)+-2//3*(1+x)^-3//2*(1+-1x)^3//2+arcsin(x))
@test integrate((1+x)^-5//2*(1+-1x)^(1/2), x) == :(-1//3*(1+x)^-3//2*(1+-1x)^3//2)
@test integrate((1+x)^-5//2*(1+-1x)^-1//2, x) == :(-1//3*(1+x)^-3//2*(1+-1x)^(1/2)+-1//3*(1+x)^-1//2*(1+-1x)^(1/2))
@test integrate((1+x)^-5//2*(1+-1x)^-3//2, x) == :((1+x)^-3//2*(1+-1x)^-1//2+-2//3*(1+x)^-3//2*(1+-1x)^(1/2)+-2//3*(1+x)^-1//2*(1+-1x)^(1/2))
@test integrate((1+x)^-5//2*(1+-1x)^-5//2, x) == :(1//3*x*(1+x)^-3//2*(1+-1x)^-3//2+2//3*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-5//2*(1+-1x)^-7//2, x) == :(1//5*(1+x)^-3//2*(1+-1x)^-5//2+4//15*x*(1+x)^-3//2*(1+-1x)^-3//2+8//15*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-5//2*(1+-1x)^-9//2, x) == :(1//7*(1+x)^-3//2*(1+-1x)^-7//2+1//7*(1+x)^-3//2*(1+-1x)^-5//2+4//21*x*(1+x)^-3//2*(1+-1x)^-3//2+8//21*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((1+x)^-5//2*(1+-1x)^-11//2, x) == :(1//9*(1+x)^-3//2*(1+-1x)^-9//2+2//21*(1+x)^-3//2*(1+-1x)^-7//2+2//21*(1+x)^-3//2*(1+-1x)^-5//2+8//63*x*(1+x)^-3//2*(1+-1x)^-3//2+16//63*x*(1+x)^-1//2*(1+-1x)^-1//2)
@test integrate((a+a*x)^5//2*(c+-1*c*x)^5//2, x) == :(1//6*x*(a+a*x)^5//2*(c+-1*c*x)^5//2+5//8*a^5//2*c^5//2*arctan(a^-1//2*c^(1/2)*(a+a*x)^(1/2)*(c+-1*c*x)^-1//2)+5//16*x*a^2*c^2*(a+a*x)^(1/2)*(c+-1*c*x)^(1/2)+5//24*a*c*x*(a+a*x)^3//2*(c+-1*c*x)^3//2)
@test integrate((a+a*x)^3//2*(c+-1*c*x)^3//2, x) == :(1//4*x*(a+a*x)^3//2*(c+-1*c*x)^3//2+3//4*a^3//2*c^3//2*arctan(a^-1//2*c^(1/2)*(a+a*x)^(1/2)*(c+-1*c*x)^-1//2)+3//8*a*c*x*(a+a*x)^(1/2)*(c+-1*c*x)^(1/2))
@test integrate((a+a*x)^(1/2)*(c+-1*c*x)^(1/2), x) == :(a^(1/2)*c^(1/2)*arctan(a^-1//2*c^(1/2)*(a+a*x)^(1/2)*(c+-1*c*x)^-1//2)+(1/2)*x*(a+a*x)^(1/2)*(c+-1*c*x)^(1/2))
@test integrate((a+a*x)^-1//2*(c+-1*c*x)^-1//2, x) == :(2*a^-1//2*c^-1//2*arctan(a^-1//2*c^(1/2)*(a+a*x)^(1/2)*(c+-1*c*x)^-1//2))
@test integrate((a+a*x)^-3//2*(c+-1*c*x)^-3//2, x) == :(x*a^-1*c^-1*(a+a*x)^-1//2*(c+-1*c*x)^-1//2)
@test integrate((a+a*x)^-5//2*(c+-1*c*x)^-5//2, x) == :(1//3*x*a^-1*c^-1*(a+a*x)^-3//2*(c+-1*c*x)^-3//2+2//3*x*a^-2*c^-2*(a+a*x)^-1//2*(c+-1*c*x)^-1//2)
@test integrate((a+a*x)^-7//2*(c+-1*c*x)^-7//2, x) == :(1//5*x*a^-1*c^-1*(a+a*x)^-5//2*(c+-1*c*x)^-5//2+4//15*x*a^-2*c^-2*(a+a*x)^-3//2*(c+-1*c*x)^-3//2+8//15*x*a^-3*c^-3*(a+a*x)^-1//2*(c+-1*c*x)^-1//2)
@test integrate((a+a*x)^-9//2*(c+-1*c*x)^-9//2, x) == :(1//7*x*a^-1*c^-1*(a+a*x)^-7//2*(c+-1*c*x)^-7//2+6//35*x*a^-2*c^-2*(a+a*x)^-5//2*(c+-1*c*x)^-5//2+8//35*x*a^-3*c^-3*(a+a*x)^-3//2*(c+-1*c*x)^-3//2+16//35*x*a^-4*c^-4*(a+a*x)^-1//2*(c+-1*c*x)^-1//2)
@test integrate((a+b*x)^5//2*(a*c+-1*b*c*x)^5//2, x) == :(1//6*x*(a+b*x)^5//2*(a*c+-1*b*c*x)^5//2+5//8*a^6*b^-1*c^5//2*arctan(c^(1/2)*(c*(a+-1*b*x))^-1//2*(a+b*x)^(1/2))+5//16*x*a^4*c^2*(a+b*x)^(1/2)*(a*c+-1*b*c*x)^(1/2)+5//24*c*x*a^2*(a+b*x)^3//2*(a*c+-1*b*c*x)^3//2)
@test integrate((a+b*x)^3//2*(a*c+-1*b*c*x)^3//2, x) == :(1//4*x*(a+b*x)^3//2*(a*c+-1*b*c*x)^3//2+3//4*a^4*b^-1*c^3//2*arctan(c^(1/2)*(c*(a+-1*b*x))^-1//2*(a+b*x)^(1/2))+3//8*c*x*a^2*(a+b*x)^(1/2)*(a*c+-1*b*c*x)^(1/2))
@test integrate((a+b*x)^(1/2)*(a*c+-1*b*c*x)^(1/2), x) == :((1/2)*x*(a+b*x)^(1/2)*(a*c+-1*b*c*x)^(1/2)+a^2*b^-1*c^(1/2)*arctan(c^(1/2)*(c*(a+-1*b*x))^-1//2*(a+b*x)^(1/2)))
@test integrate((a+b*x)^-1//2*(a*c+-1*b*c*x)^-1//2, x) == :(2*b^-1*c^-1//2*arctan(c^(1/2)*(c*(a+-1*b*x))^-1//2*(a+b*x)^(1/2)))
@test integrate((a+b*x)^-3//2*(a*c+-1*b*c*x)^-3//2, x) == :(x*a^-2*c^-1*(a+b*x)^-1//2*(a*c+-1*b*c*x)^-1//2)
@test integrate((a+b*x)^-5//2*(a*c+-1*b*c*x)^-5//2, x) == :(1//3*x*a^-2*c^-1*(a+b*x)^-3//2*(a*c+-1*b*c*x)^-3//2+2//3*x*a^-4*c^-2*(a+b*x)^-1//2*(a*c+-1*b*c*x)^-1//2)
@test integrate((a+b*x)^-7//2*(a*c+-1*b*c*x)^-7//2, x) == :(1//5*x*a^-2*c^-1*(a+b*x)^-5//2*(a*c+-1*b*c*x)^-5//2+4//15*x*a^-4*c^-2*(a+b*x)^-3//2*(a*c+-1*b*c*x)^-3//2+8//15*x*a^-6*c^-3*(a+b*x)^-1//2*(a*c+-1*b*c*x)^-1//2)
@test integrate((a+b*x)^-9//2*(a*c+-1*b*c*x)^-9//2, x) == :(1//7*x*a^-2*c^-1*(a+b*x)^-7//2*(a*c+-1*b*c*x)^-7//2+6//35*x*a^-4*c^-2*(a+b*x)^-5//2*(a*c+-1*b*c*x)^-5//2+8//35*x*a^-6*c^-3*(a+b*x)^-3//2*(a*c+-1*b*c*x)^-3//2+16//35*x*a^-8*c^-4*(a+b*x)^-1//2*(a*c+-1*b*c*x)^-1//2)
@test integrate((2+4x)^5//2*(3+-6x)^5//2, x) == :(45//8*6^(1/2)*arcsin(2x)+6*x*6^(1/2)*(1+-2x)^5//2*(1+2x)^5//2+15//2*x*6^(1/2)*(1+-2x)^3//2*(1+2x)^3//2+45//4*x*6^(1/2)*(1+-2x)^(1/2)*(1+2x)^(1/2))
@test integrate((2+4x)^3//2*(3+-6x)^3//2, x) == :(9//8*6^(1/2)*arcsin(2x)+3//2*x*6^(1/2)*(1+-2x)^3//2*(1+2x)^3//2+9//4*x*6^(1/2)*(1+-2x)^(1/2)*(1+2x)^(1/2))
@test integrate((2+4x)^(1/2)*(3+-6x)^(1/2), x) == :(1//4*6^(1/2)*arcsin(2x)+(1/2)*x*6^(1/2)*(1+-2x)^(1/2)*(1+2x)^(1/2))
@test integrate((2+4x)^-1//2*(3+-6x)^-1//2, x) == :(1//12*6^(1/2)*arcsin(2x))
@test integrate((2+4x)^-3//2*(3+-6x)^-3//2, x) == :(1//36*x*6^(1/2)*(1+-2x)^-1//2*(1+2x)^-1//2)
@test integrate((2+4x)^-5//2*(3+-6x)^-5//2, x) == :(1//324*x*6^(1/2)*(1+-2x)^-1//2*(1+2x)^-1//2+1//648*x*6^(1/2)*(1+-2x)^-3//2*(1+2x)^-3//2)
@test integrate((2+4x)^-7//2*(3+-6x)^-7//2, x) == :(1//2430*x*6^(1/2)*(1+-2x)^-1//2*(1+2x)^-1//2+1//4860*x*6^(1/2)*(1+-2x)^-3//2*(1+2x)^-3//2+1//6480*x*6^(1/2)*(1+-2x)^-5//2*(1+2x)^-5//2)
@test integrate((-2+x)^3//2*(3+-1x)^3//2, x) == :(-3//128*arcsin(5+-2x)+-1//4*(-2+x)^3//2*(3+-1x)^5//2+-1//8*(-2+x)^(1/2)*(3+-1x)^5//2+1//32*(-2+x)^(1/2)*(3+-1x)^3//2+3//64*(-2+x)^(1/2)*(3+-1x)^(1/2))
@test integrate((-2+x)^(1/2)*(3+-1x)^(1/2), x) == :(-1//8*arcsin(5+-2x)+-1//2*(-2+x)^(1/2)*(3+-1x)^3//2+1//4*(-2+x)^(1/2)*(3+-1x)^(1/2))
@test integrate((-2+x)^-1//2*(3+-1x)^-1//2, x) == :(-1*arcsin(5+-2x))
@test integrate((-2+x)^-3//2*(3+-1x)^-3//2, x) == :(-4*(-2+x)^-1//2*(3+-1x)^(1/2)+2*(-2+x)^-1//2*(3+-1x)^-1//2)
@test integrate((-2+x)^-5//2*(3+-1x)^-5//2, x) == :(4*(-2+x)^-3//2*(3+-1x)^-1//2+-32//3*(-2+x)^-1//2*(3+-1x)^(1/2)+-16//3*(-2+x)^-3//2*(3+-1x)^(1/2)+2//3*(-2+x)^-3//2*(3+-1x)^-3//2)
@test integrate((3+x)^-3//2*(3+-1x)^-3//2, x) == :(1//9*x*(3+x)^-1//2*(3+-1x)^-1//2)
@test integrate((3+b*x)^-3//2*(3+-1*b*x)^-3//2, x) == :(1//9*x*(3+b*x)^-1//2*(3+-1*b*x)^-1//2)
@test integrate((3+x)^-3//2*(6+-2x)^-3//2, x) == :(1//36*x*2^(1/2)*(3+x)^-1//2*(3+-1x)^-1//2)
@test integrate((3+b*x)^-3//2*(6+-2*b*x)^-3//2, x) == :(1//36*x*2^(1/2)*(3+b*x)^-1//2*(3+-1*b*x)^-1//2)
@test integrate((a+b*x)^-1//2*(-1*a*d+b*d*x)^-1//2, x) == :(2*b^-1*d^-1//2*arctanh(d^(1/2)*(a+b*x)^(1/2)*(-1*a*d+b*d*x)^-1//2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^7//4, x) == :(-14//15*im*(a+im*a*x)^3//4*(a+-1*im*a*x)^3//4+-2//5*im*a^-1*(a+im*a*x)^3//4*(a+-1*im*a*x)^7//4+14//5*x*a^2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+-14//5*a^2*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^3//4, x) == :(2*a*x*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+-2//3*im*a^-1*(a+im*a*x)^3//4*(a+-1*im*a*x)^3//4+-2*a*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4, x) == :(2*x*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+-2*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-5//4, x) == :(-2*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+2*a^-1*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-9//4, x) == :(-4//5*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-5//4+2//5*a^-2*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-13//4, x) == :(-4//15*im*a^-2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-5//4+-2//9*im*a^-2*(a+im*a*x)^3//4*(a+-1*im*a*x)^-9//4+2//15*a^-3*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-17//4, x) == :(-10//117*im*a^-3*(a+im*a*x)^3//4*(a+-1*im*a*x)^-9//4+-4//39*im*a^-3*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-5//4+-2//13*im*a^-2*(a+im*a*x)^3//4*(a+-1*im*a*x)^-13//4+2//39*a^-4*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4, x) == :((1/2)*im*2^(1/2)*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1//2*im*2^(1/2)*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+1//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*a^-1*(a+im*a*x)^3//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-3//4, x) == :(im*2^(1/2)*a^-1*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+(1/2)*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*2^(1/2)*a^-1*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1//2*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4))
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-7//4, x) == :(-2//3*im*a^-2*(a+im*a*x)^3//4*(a+-1*im*a*x)^-3//4)
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-11//4, x) == :(-4//21*im*a^-3*(a+im*a*x)^3//4*(a+-1*im*a*x)^-3//4+-2//7*im*a^-2*(a+im*a*x)^3//4*(a+-1*im*a*x)^-7//4)
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-15//4, x) == :(-16//231*im*a^-4*(a+im*a*x)^3//4*(a+-1*im*a*x)^-3//4+-8//77*im*a^-3*(a+im*a*x)^3//4*(a+-1*im*a*x)^-7//4+-2//11*im*a^-2*(a+im*a*x)^3//4*(a+-1*im*a*x)^-11//4)
@test integrate((a+im*a*x)^-1//4*(a+-1*im*a*x)^-19//4, x) == :(-32//1155*im*a^-5*(a+im*a*x)^3//4*(a+-1*im*a*x)^-3//4+-16//385*im*a^-4*(a+im*a*x)^3//4*(a+-1*im*a*x)^-7//4+-4//55*im*a^-3*(a+im*a*x)^3//4*(a+-1*im*a*x)^-11//4+-2//15*im*a^-2*(a+im*a*x)^3//4*(a+-1*im*a*x)^-15//4)
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^3//4, x) == :(-3//2*im*2^(1/2)*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-3//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+3//2*im*2^(1/2)*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+3//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*a^-1*(a+im*a*x)^1//4*(a+-1*im*a*x)^3//4)
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-1//4, x) == :(im*2^(1/2)*a^-1*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+(1/2)*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*2^(1/2)*a^-1*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1//2*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4))
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-5//4, x) == :(-2*im*a^-2*(a+im*a*x)^1//4*(a+-1*im*a*x)^-1//4)
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-9//4, x) == :(-4//5*im*a^-3*(a+im*a*x)^1//4*(a+-1*im*a*x)^-1//4+-2//5*im*a^-2*(a+im*a*x)^1//4*(a+-1*im*a*x)^-5//4)
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-13//4, x) == :(-16//45*im*a^-4*(a+im*a*x)^1//4*(a+-1*im*a*x)^-1//4+-8//45*im*a^-3*(a+im*a*x)^1//4*(a+-1*im*a*x)^-5//4+-2//9*im*a^-2*(a+im*a*x)^1//4*(a+-1*im*a*x)^-9//4)
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^5//4, x) == :(-10//3*im*(a+im*a*x)^1//4*(a+-1*im*a*x)^1//4+-2//3*im*a^-1*(a+im*a*x)^1//4*(a+-1*im*a*x)^5//4+10//3*a^2*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^1//4, x) == :(-2*im*a^-1*(a+im*a*x)^1//4*(a+-1*im*a*x)^1//4+2*a*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4, x) == :(2*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-7//4, x) == :(-2//3*im*a^-2*(a+im*a*x)^1//4*(a+-1*im*a*x)^-3//4+2//3*a^-1*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-3//4*(a+-1*im*a*x)^-11//4, x) == :(-2//7*im*a^-3*(a+im*a*x)^1//4*(a+-1*im*a*x)^-3//4+-2//7*im*a^-2*(a+im*a*x)^1//4*(a+-1*im*a*x)^-7//4+2//7*a^-2*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^7//4, x) == :(-7//2*im*2^(1/2)*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-7//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+7//2*im*2^(1/2)*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+7//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+4//3*im*a^-1*(a+im*a*x)^-3//4*(a+-1*im*a*x)^7//4+7//3*im*a^-1*(a+im*a*x)^1//4*(a+-1*im*a*x)^3//4)
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^3//4, x) == :(im*2^(1/2)*a^-1*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+(1/2)*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*2^(1/2)*a^-1*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1//2*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+4//3*im*a^-1*(a+im*a*x)^-3//4*(a+-1*im*a*x)^3//4)
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-1//4, x) == :(2//3*im*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^3//4)
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-5//4, x) == :(-2*im*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-1//4+4//3*im*a^-3*(a+im*a*x)^-3//4*(a+-1*im*a*x)^3//4)
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-9//4, x) == :(-8//5*im*a^-3*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-1//4+-2//5*im*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-5//4+16//15*im*a^-4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^3//4)
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^9//4, x) == :(10*im*(a+im*a*x)^1//4*(a+-1*im*a*x)^1//4+2*im*a^-1*(a+im*a*x)^1//4*(a+-1*im*a*x)^5//4+4//3*im*a^-1*(a+im*a*x)^-3//4*(a+-1*im*a*x)^9//4+-10*a^2*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^5//4, x) == :(4//3*im*a^-1*(a+im*a*x)^-3//4*(a+-1*im*a*x)^5//4+10//3*im*a^-1*(a+im*a*x)^1//4*(a+-1*im*a*x)^1//4+-10//3*a*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^1//4, x) == :(-2//3*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2)+4//3*im*a^-1*(a+im*a*x)^-3//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-3//4, x) == :(2//3*im*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^1//4+2//3*a^-1*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-7//4, x) == :(2//3*x*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4+2//3*a^-2*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-11//4, x) == :(-2//7*im*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-7//4+10//21*x*a^-3*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4+10//21*a^-3*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-7//4*(a+-1*im*a*x)^-15//4, x) == :(-2//11*im*a^-3*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-7//4+-2//11*im*a^-2*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-11//4+10//33*x*a^-4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4+10//33*a^-4*(1+x^2)^3//4*(a+im*a*x)^-3//4*(a+-1*im*a*x)^-3//4*Elliptic.F((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^7//4, x) == :(-14*a*x*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+4*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^7//4+14//3*im*a^-1*(a+im*a*x)^3//4*(a+-1*im*a*x)^3//4+14*a*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^3//4, x) == :(-6*x*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+4*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^3//4+6*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-1//4, x) == :(2*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+2*a^-1*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-5//4, x) == :(2*a^-2*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-9//4, x) == :(-2//5*im*a^-2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-5//4+6//5*a^-3*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-13//4, x) == :(-2//9*im*a^-3*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-5//4+-2//9*im*a^-2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-9//4+2//3*a^-4*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^5//4, x) == :(-5//2*im*2^(1/2)*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-5//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+5//2*im*2^(1/2)*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+5//4*im*2^(1/2)*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+4*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^5//4+5*im*a^-1*(a+im*a*x)^3//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^1//4, x) == :(im*2^(1/2)*a^-1*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+(1/2)*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*2^(1/2)*a^-1*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+4*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4+-1//2*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4))
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-3//4, x) == :(2*im*a^-2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-7//4, x) == :(-2//3*im*a^-2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-3//4+4//3*im*a^-3*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-5//4*(a+-1*im*a*x)^-11//4, x) == :(-8//21*im*a^-3*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-3//4+-2//7*im*a^-2*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-7//4+16//21*im*a^-4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^7//4, x) == :(42//5*x*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+-42//5*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2)+-28//5*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^3//4+4//5*im*a^-1*(a+im*a*x)^-5//4*(a+-1*im*a*x)^7//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^3//4, x) == :(-6//5*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+4//5*im*a^-1*(a+im*a*x)^-5//4*(a+-1*im*a*x)^3//4+-6//5*a^-1*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-1//4, x) == :(4//5*im*a^-1*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-1//4+2//5*a^-2*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-5//4, x) == :(2//5*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-1//4+6//5*a^-3*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-9//4, x) == :(2//5*x*a^-4*(1+x^2)^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+6//5*a^-4*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-13//4, x) == :(-2//9*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-9//4+14//15*a^-5*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2)+14//45*x*a^-5*(1+x^2)^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-17//4, x) == :(-2//13*im*a^-3*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-9//4+-2//13*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-13//4+14//65*x*a^-6*(1+x^2)^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4+42//65*a^-6*(1+x^2)^1//4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^-1//4*Elliptic.E((1/2)*arctan(x),2))
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^5//4, x) == :(im*2^(1/2)*a^-1*arctan(1+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+(1/2)*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-1*im*2^(1/2)*a^-1*arctan(1+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+-4*im*a^-1*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4+-1//2*im*2^(1/2)*a^-1*log(1+(a+im*a*x)^-1//2*(a+-1*im*a*x)^(1/2)+-1*2^(1/2)*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)+4//5*im*a^-1*(a+im*a*x)^-5//4*(a+-1*im*a*x)^5//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^1//4, x) == :(2//5*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^5//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-3//4, x) == :(2//5*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^1//4+4//5*im*a^-3*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-7//4, x) == :(-2//3*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-3//4+8//15*im*a^-3*(a+im*a*x)^-5//4*(a+-1*im*a*x)^1//4+16//15*im*a^-4*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)
@test integrate((a+im*a*x)^-9//4*(a+-1*im*a*x)^-11//4, x) == :(-4//7*im*a^-3*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-3//4+-2//7*im*a^-2*(a+im*a*x)^-5//4*(a+-1*im*a*x)^-7//4+16//35*im*a^-4*(a+im*a*x)^-5//4*(a+-1*im*a*x)^1//4+32//35*im*a^-5*(a+im*a*x)^-1//4*(a+-1*im*a*x)^1//4)
@test integrate((a+b*x)^2*(a*c+-1*b*c*x)^n, x) == :(-1*b^-1*c^-3*(3+n)^-1*(a*c+-1*b*c*x)^(3+n)+-4*a^2*b^-1*c^-1*(1+n)^-1*(a*c+-1*b*c*x)^(1+n)+4*a*b^-1*c^-2*(2+n)^-1*(a*c+-1*b*c*x)^(2+n))
@test integrate((a*c+-1*b*c*x)^n*(a+b*x), x) == :(b^-1*c^-2*(2+n)^-1*(a*c+-1*b*c*x)^(2+n)+-2*a*b^-1*c^-1*(1+n)^-1*(a*c+-1*b*c*x)^(1+n))
@test integrate((a+b*x)^4*(c+d*x), x) == :(1//5*b^-2*(a+b*x)^5*(b*c+-1*a*d)+1//6*d*b^-2*(a+b*x)^6)
@test integrate((a+b*x)^3*(c+d*x), x) == :(1//4*b^-2*(a+b*x)^4*(b*c+-1*a*d)+1//5*d*b^-2*(a+b*x)^5)
@test integrate((a+b*x)^2*(c+d*x), x) == :(1//3*b^-2*(a+b*x)^3*(b*c+-1*a*d)+1//4*d*b^-2*(a+b*x)^4)
@test integrate((a+b*x)*(c+d*x), x) == :(x^2*((1/2)*a*d+(1/2)*b*c)+a*c*x+1//3*b*d*x^3)
@test integrate(c+d*x, x) == :(c*x+(1/2)*d*x^2)
@test integrate((a+b*x)^-1*(c+d*x), x) == :(d*x*b^-1+b^-2*(b*c+-1*a*d)*log(a+b*x))
@test integrate((a+b*x)^-2*(c+d*x), x) == :(d*b^-2*log(a+b*x)+-1*b^-2*(a+b*x)^-1*(b*c+-1*a*d))
@test integrate((a+b*x)^-3*(c+d*x), x) == :(-1*(a+b*x)^-2*(c+d*x)^2*(-2*a*d+2*b*c)^-1)
@test integrate((a+b*x)^-4*(c+d*x), x) == :(-1//2*d*b^-2*(a+b*x)^-2+-1//3*b^-2*(a+b*x)^-3*(b*c+-1*a*d))
@test integrate((a+b*x)^-5*(c+d*x), x) == :(-1//3*d*b^-2*(a+b*x)^-3+-1//4*b^-2*(a+b*x)^-4*(b*c+-1*a*d))
@test integrate((a+b*x)^4*(c+d*x)^2, x) == :(1//5*b^-3*(a+b*x)^5*(b*c+-1*a*d)^2+1//7*b^-3*d^2*(a+b*x)^7+1//3*d*b^-3*(a+b*x)^6*(b*c+-1*a*d))
@test integrate((a+b*x)^3*(c+d*x)^2, x) == :(1//4*b^-3*(a+b*x)^4*(b*c+-1*a*d)^2+1//6*b^-3*d^2*(a+b*x)^6+2//5*d*b^-3*(a+b*x)^5*(b*c+-1*a*d))
@test integrate((a+b*x)^2*(c+d*x)^2, x) == :(1//3*b^-3*(a+b*x)^3*(b*c+-1*a*d)^2+1//5*b^-3*d^2*(a+b*x)^5+(1/2)*d*b^-3*(a+b*x)^4*(b*c+-1*a*d))
@test integrate((c+d*x)^2*(a+b*x), x) == :(-1//3*d^-2*(c+d*x)^3*(b*c+-1*a*d)+1//4*b*d^-2*(c+d*x)^4)
@test integrate((c+d*x)^2, x) == :(1//3*d^-1*(c+d*x)^3)
@test integrate((a+b*x)^-1*(c+d*x)^2, x) == :((1/2)*b^-1*(c+d*x)^2+b^-3*(b*c+-1*a*d)^2*log(a+b*x)+d*x*b^-2*(b*c+-1*a*d))
@test integrate((a+b*x)^-2*(c+d*x)^2, x) == :(x*b^-2*d^2+-1*b^-3*(a+b*x)^-1*(b*c+-1*a*d)^2+2*d*b^-3*(b*c+-1*a*d)*log(a+b*x))
@test integrate((a+b*x)^-3*(c+d*x)^2, x) == :(b^-3*d^2*log(a+b*x)+-1//2*b^-3*(a+b*x)^-2*(b*c+-1*a*d)^2+-2*d*b^-3*(a+b*x)^-1*(b*c+-1*a*d))
@test integrate((a+b*x)^-4*(c+d*x)^2, x) == :(-1*(a+b*x)^-3*(c+d*x)^3*(-3*a*d+3*b*c)^-1)
@test integrate((a+b*x)^-5*(c+d*x)^2, x) == :(-1//2*b^-3*d^2*(a+b*x)^-2+-1//4*b^-3*(a+b*x)^-4*(b*c+-1*a*d)^2+-2//3*d*b^-3*(a+b*x)^-3*(b*c+-1*a*d))
@test integrate((a+b*x)^-6*(c+d*x)^2, x) == :(-1//3*b^-3*d^2*(a+b*x)^-3+-1//5*b^-3*(a+b*x)^-5*(b*c+-1*a*d)^2+-1//2*d*b^-3*(a+b*x)^-4*(b*c+-1*a*d))
@test integrate((a+b*x)^-7*(c+d*x)^2, x) == :(-1//4*b^-3*d^2*(a+b*x)^-4+-1//6*b^-3*(a+b*x)^-6*(b*c+-1*a*d)^2+-2//5*d*b^-3*(a+b*x)^-5*(b*c+-1*a*d))
@test integrate((a+b*x)^5*(c+d*x)^3, x) == :(1//6*b^-4*(a+b*x)^6*(b*c+-1*a*d)^3+1//9*b^-4*d^3*(a+b*x)^9+3//7*d*b^-4*(a+b*x)^7*(b*c+-1*a*d)^2+3//8*b^-4*d^2*(a+b*x)^8*(b*c+-1*a*d))
@test integrate((a+b*x)^4*(c+d*x)^3, x) == :(1//5*b^-4*(a+b*x)^5*(b*c+-1*a*d)^3+1//8*b^-4*d^3*(a+b*x)^8+(1/2)*d*b^-4*(a+b*x)^6*(b*c+-1*a*d)^2+3//7*b^-4*d^2*(a+b*x)^7*(b*c+-1*a*d))
@test integrate((a+b*x)^3*(c+d*x)^3, x) == :(1//4*b^-4*(a+b*x)^4*(b*c+-1*a*d)^3+1//7*b^-4*d^3*(a+b*x)^7+(1/2)*b^-4*d^2*(a+b*x)^6*(b*c+-1*a*d)+3//5*d*b^-4*(a+b*x)^5*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^3, x) == :(1//4*d^-3*(c+d*x)^4*(b*c+-1*a*d)^2+1//6*b^2*d^-3*(c+d*x)^6+-2//5*b*d^-3*(c+d*x)^5*(b*c+-1*a*d))
@test integrate((c+d*x)^3*(a+b*x), x) == :(-1//4*d^-2*(c+d*x)^4*(b*c+-1*a*d)+1//5*b*d^-2*(c+d*x)^5)
@test integrate((c+d*x)^3, x) == :(1//4*d^-1*(c+d*x)^4)
@test integrate((a+b*x)^-1*(c+d*x)^3, x) == :(1//3*b^-1*(c+d*x)^3+b^-4*(b*c+-1*a*d)^3*log(a+b*x)+(1/2)*b^-2*(c+d*x)^2*(b*c+-1*a*d)+d*x*b^-3*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-2*(c+d*x)^3, x) == :((1/2)*b^-2*d^3*x^2+-1*b^-4*(a+b*x)^-1*(b*c+-1*a*d)^3+x*b^-3*d^2*(-2*a*d+3*b*c)+3*d*b^-4*(b*c+-1*a*d)^2*log(a+b*x))
@test integrate((a+b*x)^-3*(c+d*x)^3, x) == :(x*b^-3*d^3+-1//2*b^-4*(a+b*x)^-2*(b*c+-1*a*d)^3+-3*d*b^-4*(a+b*x)^-1*(b*c+-1*a*d)^2+3*b^-4*d^2*(b*c+-1*a*d)*log(a+b*x))
@test integrate((a+b*x)^-4*(c+d*x)^3, x) == :(b^-4*d^3*log(a+b*x)+-1//3*b^-4*(a+b*x)^-3*(b*c+-1*a*d)^3+-3*b^-4*d^2*(a+b*x)^-1*(b*c+-1*a*d)+-3//2*d*b^-4*(a+b*x)^-2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-5*(c+d*x)^3, x) == :(-1*(a+b*x)^-4*(c+d*x)^4*(-4*a*d+4*b*c)^-1)
@test integrate((a+b*x)^-6*(c+d*x)^3, x) == :(-1*(a+b*x)^-5*(c+d*x)^4*(-5*a*d+5*b*c)^-1+1//20*d*(a+b*x)^-4*(c+d*x)^4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-7*(c+d*x)^3, x) == :(-1//3*b^-4*d^3*(a+b*x)^-3+-1//6*b^-4*(a+b*x)^-6*(b*c+-1*a*d)^3+-3//4*b^-4*d^2*(a+b*x)^-4*(b*c+-1*a*d)+-3//5*d*b^-4*(a+b*x)^-5*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-8*(c+d*x)^3, x) == :(-1//4*b^-4*d^3*(a+b*x)^-4+-1//7*b^-4*(a+b*x)^-7*(b*c+-1*a*d)^3+-3//5*b^-4*d^2*(a+b*x)^-5*(b*c+-1*a*d)+-1//2*d*b^-4*(a+b*x)^-6*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-9*(c+d*x)^3, x) == :(-1//5*b^-4*d^3*(a+b*x)^-5+-1//8*b^-4*(a+b*x)^-8*(b*c+-1*a*d)^3+-3//7*d*b^-4*(a+b*x)^-7*(b*c+-1*a*d)^2+-1//2*b^-4*d^2*(a+b*x)^-6*(b*c+-1*a*d))
@test integrate((a+b*x)^9*(c+d*x)^7, x) == :(1//10*b^-8*(a+b*x)^10*(b*c+-1*a*d)^7+1//17*b^-8*d^7*(a+b*x)^17+5//2*b^-8*d^4*(a+b*x)^14*(b*c+-1*a*d)^3+7//4*b^-8*d^2*(a+b*x)^12*(b*c+-1*a*d)^5+7//5*b^-8*d^5*(a+b*x)^15*(b*c+-1*a*d)^2+7//11*d*b^-8*(a+b*x)^11*(b*c+-1*a*d)^6+7//16*b^-8*d^6*(a+b*x)^16*(b*c+-1*a*d)+35//13*b^-8*d^3*(a+b*x)^13*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^8*(c+d*x)^7, x) == :(1//9*b^-8*(a+b*x)^9*(b*c+-1*a*d)^7+1//16*b^-8*d^7*(a+b*x)^16+3//2*b^-8*d^5*(a+b*x)^14*(b*c+-1*a*d)^2+7//10*d*b^-8*(a+b*x)^10*(b*c+-1*a*d)^6+7//15*b^-8*d^6*(a+b*x)^15*(b*c+-1*a*d)+21//11*b^-8*d^2*(a+b*x)^11*(b*c+-1*a*d)^5+35//12*b^-8*d^3*(a+b*x)^12*(b*c+-1*a*d)^4+35//13*b^-8*d^4*(a+b*x)^13*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^7*(c+d*x)^7, x) == :(1//8*b^-8*(a+b*x)^8*(b*c+-1*a*d)^7+1//15*b^-8*d^7*(a+b*x)^15+(1/2)*b^-8*d^6*(a+b*x)^14*(b*c+-1*a*d)+7//9*d*b^-8*(a+b*x)^9*(b*c+-1*a*d)^6+21//10*b^-8*d^2*(a+b*x)^10*(b*c+-1*a*d)^5+21//13*b^-8*d^5*(a+b*x)^13*(b*c+-1*a*d)^2+35//11*b^-8*d^3*(a+b*x)^11*(b*c+-1*a*d)^4+35//12*b^-8*d^4*(a+b*x)^12*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^6*(c+d*x)^7, x) == :(1//8*d^-7*(c+d*x)^8*(b*c+-1*a*d)^6+1//14*b^6*d^-7*(c+d*x)^14+-20//11*b^3*d^-7*(c+d*x)^11*(b*c+-1*a*d)^3+-6//13*b^5*d^-7*(c+d*x)^13*(b*c+-1*a*d)+-2//3*b*d^-7*(c+d*x)^9*(b*c+-1*a*d)^5+3//2*b^2*d^-7*(c+d*x)^10*(b*c+-1*a*d)^4+5//4*b^4*d^-7*(c+d*x)^12*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^5*(c+d*x)^7, x) == :(-1//8*d^-6*(c+d*x)^8*(b*c+-1*a*d)^5+1//13*b^5*d^-6*(c+d*x)^13+-1*b^2*d^-6*(c+d*x)^10*(b*c+-1*a*d)^3+-5//12*b^4*d^-6*(c+d*x)^12*(b*c+-1*a*d)+5//9*b*d^-6*(c+d*x)^9*(b*c+-1*a*d)^4+10//11*b^3*d^-6*(c+d*x)^11*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^7, x) == :(1//8*d^-5*(c+d*x)^8*(b*c+-1*a*d)^4+1//12*b^4*d^-5*(c+d*x)^12+-4//9*b*d^-5*(c+d*x)^9*(b*c+-1*a*d)^3+-4//11*b^3*d^-5*(c+d*x)^11*(b*c+-1*a*d)+3//5*b^2*d^-5*(c+d*x)^10*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^7, x) == :(-1//8*d^-4*(c+d*x)^8*(b*c+-1*a*d)^3+1//11*b^3*d^-4*(c+d*x)^11+-3//10*b^2*d^-4*(c+d*x)^10*(b*c+-1*a*d)+1//3*b*d^-4*(c+d*x)^9*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^7, x) == :(1//8*d^-3*(c+d*x)^8*(b*c+-1*a*d)^2+1//10*b^2*d^-3*(c+d*x)^10+-2//9*b*d^-3*(c+d*x)^9*(b*c+-1*a*d))
@test integrate((c+d*x)^7*(a+b*x), x) == :(-1//8*d^-2*(c+d*x)^8*(b*c+-1*a*d)+1//9*b*d^-2*(c+d*x)^9)
@test integrate((c+d*x)^7, x) == :(1//8*d^-1*(c+d*x)^8)
@test integrate((a+b*x)^-1*(c+d*x)^7, x) == :(1//7*b^-1*(c+d*x)^7+b^-8*(b*c+-1*a*d)^7*log(a+b*x)+(1/2)*b^-6*(c+d*x)^2*(b*c+-1*a*d)^5+1//3*b^-5*(c+d*x)^3*(b*c+-1*a*d)^4+1//4*b^-4*(c+d*x)^4*(b*c+-1*a*d)^3+1//5*b^-3*(c+d*x)^5*(b*c+-1*a*d)^2+1//6*b^-2*(c+d*x)^6*(b*c+-1*a*d)+d*x*b^-7*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-2*(c+d*x)^7, x) == :(-1*b^-8*(a+b*x)^-1*(b*c+-1*a*d)^7+1//6*b^-8*d^7*(a+b*x)^6+7*d*b^-8*(b*c+-1*a*d)^6*log(a+b*x)+21*x*b^-7*d^2*(b*c+-1*a*d)^5+7//5*b^-8*d^6*(a+b*x)^5*(b*c+-1*a*d)+21//4*b^-8*d^5*(a+b*x)^4*(b*c+-1*a*d)^2+35//2*b^-8*d^3*(a+b*x)^2*(b*c+-1*a*d)^4+35//3*b^-8*d^4*(a+b*x)^3*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^-3*(c+d*x)^7, x) == :(-1//2*b^-8*(a+b*x)^-2*(b*c+-1*a*d)^7+1//5*b^-8*d^7*(a+b*x)^5+-7*d*b^-8*(a+b*x)^-1*(b*c+-1*a*d)^6+7*b^-8*d^5*(a+b*x)^3*(b*c+-1*a*d)^2+21*b^-8*d^2*(b*c+-1*a*d)^5*log(a+b*x)+35*x*b^-7*d^3*(b*c+-1*a*d)^4+7//4*b^-8*d^6*(a+b*x)^4*(b*c+-1*a*d)+35//2*b^-8*d^4*(a+b*x)^2*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^-4*(c+d*x)^7, x) == :(-1//3*b^-8*(a+b*x)^-3*(b*c+-1*a*d)^7+1//4*b^-8*d^7*(a+b*x)^4+-21*b^-8*d^2*(a+b*x)^-1*(b*c+-1*a*d)^5+35*x*b^-7*d^4*(b*c+-1*a*d)^3+35*b^-8*d^3*(b*c+-1*a*d)^4*log(a+b*x)+-7//2*d*b^-8*(a+b*x)^-2*(b*c+-1*a*d)^6+7//3*b^-8*d^6*(a+b*x)^3*(b*c+-1*a*d)+21//2*b^-8*d^5*(a+b*x)^2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-5*(c+d*x)^7, x) == :(-1//4*b^-8*(a+b*x)^-4*(b*c+-1*a*d)^7+1//3*b^-8*d^7*(a+b*x)^3+-35*b^-8*d^3*(a+b*x)^-1*(b*c+-1*a*d)^4+21*x*b^-7*d^5*(b*c+-1*a*d)^2+35*b^-8*d^4*(b*c+-1*a*d)^3*log(a+b*x)+-21//2*b^-8*d^2*(a+b*x)^-2*(b*c+-1*a*d)^5+-7//3*d*b^-8*(a+b*x)^-3*(b*c+-1*a*d)^6+7//2*b^-8*d^6*(a+b*x)^2*(b*c+-1*a*d))
@test integrate((a+b*x)^-6*(c+d*x)^7, x) == :((1/2)*b^-6*d^7*x^2+-1//5*b^-8*(a+b*x)^-5*(b*c+-1*a*d)^7+x*b^-7*d^6*(-6*a*d+7*b*c)+-35*b^-8*d^4*(a+b*x)^-1*(b*c+-1*a*d)^3+-7*b^-8*d^2*(a+b*x)^-3*(b*c+-1*a*d)^5+21*b^-8*d^5*(b*c+-1*a*d)^2*log(a+b*x)+-35//2*b^-8*d^3*(a+b*x)^-2*(b*c+-1*a*d)^4+-7//4*d*b^-8*(a+b*x)^-4*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-7*(c+d*x)^7, x) == :(x*b^-7*d^7+-1//6*b^-8*(a+b*x)^-6*(b*c+-1*a*d)^7+-21*b^-8*d^5*(a+b*x)^-1*(b*c+-1*a*d)^2+7*b^-8*d^6*(b*c+-1*a*d)*log(a+b*x)+-35//2*b^-8*d^4*(a+b*x)^-2*(b*c+-1*a*d)^3+-35//3*b^-8*d^3*(a+b*x)^-3*(b*c+-1*a*d)^4+-21//4*b^-8*d^2*(a+b*x)^-4*(b*c+-1*a*d)^5+-7//5*d*b^-8*(a+b*x)^-5*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-8*(c+d*x)^7, x) == :(b^-8*d^7*log(a+b*x)+-1//7*b^-8*(a+b*x)^-7*(b*c+-1*a*d)^7+-7*b^-8*d^6*(a+b*x)^-1*(b*c+-1*a*d)+-35//3*b^-8*d^4*(a+b*x)^-3*(b*c+-1*a*d)^3+-35//4*b^-8*d^3*(a+b*x)^-4*(b*c+-1*a*d)^4+-21//2*b^-8*d^5*(a+b*x)^-2*(b*c+-1*a*d)^2+-21//5*b^-8*d^2*(a+b*x)^-5*(b*c+-1*a*d)^5+-7//6*d*b^-8*(a+b*x)^-6*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-9*(c+d*x)^7, x) == :(-1*(a+b*x)^-8*(c+d*x)^8*(-8*a*d+8*b*c)^-1)
@test integrate((a+b*x)^-10*(c+d*x)^7, x) == :(-1*(a+b*x)^-9*(c+d*x)^8*(-9*a*d+9*b*c)^-1+1//72*d*(a+b*x)^-8*(c+d*x)^8*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-11*(c+d*x)^7, x) == :(-1*(a+b*x)^-10*(c+d*x)^8*(-10*a*d+10*b*c)^-1+-1//360*d^2*(a+b*x)^-8*(c+d*x)^8*(b*c+-1*a*d)^-3+1//45*d*(a+b*x)^-9*(c+d*x)^8*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-12*(c+d*x)^7, x) == :(-1*(a+b*x)^-11*(c+d*x)^8*(-11*a*d+11*b*c)^-1+-1//165*d^2*(a+b*x)^-9*(c+d*x)^8*(b*c+-1*a*d)^-3+1//1320*d^3*(a+b*x)^-8*(c+d*x)^8*(b*c+-1*a*d)^-4+3//110*d*(a+b*x)^-10*(c+d*x)^8*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-13*(c+d*x)^7, x) == :(-1*(a+b*x)^-12*(c+d*x)^8*(-12*a*d+12*b*c)^-1+-1//110*d^2*(a+b*x)^-10*(c+d*x)^8*(b*c+-1*a*d)^-3+-1//3960*d^4*(a+b*x)^-8*(c+d*x)^8*(b*c+-1*a*d)^-5+1//33*d*(a+b*x)^-11*(c+d*x)^8*(b*c+-1*a*d)^-2+1//495*d^3*(a+b*x)^-9*(c+d*x)^8*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-14*(c+d*x)^7, x) == :(-1//6*b^-8*d^7*(a+b*x)^-6+-1//13*b^-8*(a+b*x)^-13*(b*c+-1*a*d)^7+-1*b^-8*d^6*(a+b*x)^-7*(b*c+-1*a*d)+-35//9*b^-8*d^4*(a+b*x)^-9*(b*c+-1*a*d)^3+-21//8*b^-8*d^5*(a+b*x)^-8*(b*c+-1*a*d)^2+-21//11*b^-8*d^2*(a+b*x)^-11*(b*c+-1*a*d)^5+-7//2*b^-8*d^3*(a+b*x)^-10*(b*c+-1*a*d)^4+-7//12*d*b^-8*(a+b*x)^-12*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-15*(c+d*x)^7, x) == :(-1//7*b^-8*d^7*(a+b*x)^-7+-1//14*b^-8*(a+b*x)^-14*(b*c+-1*a*d)^7+-35//11*b^-8*d^3*(a+b*x)^-11*(b*c+-1*a*d)^4+-7//2*b^-8*d^4*(a+b*x)^-10*(b*c+-1*a*d)^3+-7//3*b^-8*d^5*(a+b*x)^-9*(b*c+-1*a*d)^2+-7//4*b^-8*d^2*(a+b*x)^-12*(b*c+-1*a*d)^5+-7//8*b^-8*d^6*(a+b*x)^-8*(b*c+-1*a*d)+-7//13*d*b^-8*(a+b*x)^-13*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-16*(c+d*x)^7, x) == :(-1//8*b^-8*d^7*(a+b*x)^-8+-1//15*b^-8*(a+b*x)^-15*(b*c+-1*a*d)^7+-35//11*b^-8*d^4*(a+b*x)^-11*(b*c+-1*a*d)^3+-35//12*b^-8*d^3*(a+b*x)^-12*(b*c+-1*a*d)^4+-21//10*b^-8*d^5*(a+b*x)^-10*(b*c+-1*a*d)^2+-21//13*b^-8*d^2*(a+b*x)^-13*(b*c+-1*a*d)^5+-7//9*b^-8*d^6*(a+b*x)^-9*(b*c+-1*a*d)+-1//2*d*b^-8*(a+b*x)^-14*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^12*(c+d*x)^10, x) == :(1//13*b^-11*(a+b*x)^13*(b*c+-1*a*d)^10+1//23*b^-11*d^10*(a+b*x)^23+3*b^-11*d^2*(a+b*x)^15*(b*c+-1*a*d)^8+6*b^-11*d^7*(a+b*x)^20*(b*c+-1*a*d)^3+14*b^-11*d^5*(a+b*x)^18*(b*c+-1*a*d)^5+5//7*d*b^-11*(a+b*x)^14*(b*c+-1*a*d)^9+5//11*b^-11*d^9*(a+b*x)^22*(b*c+-1*a*d)+15//2*b^-11*d^3*(a+b*x)^16*(b*c+-1*a*d)^7+15//7*b^-11*d^8*(a+b*x)^21*(b*c+-1*a*d)^2+210//17*b^-11*d^4*(a+b*x)^17*(b*c+-1*a*d)^6+210//19*b^-11*d^6*(a+b*x)^19*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^11*(c+d*x)^10, x) == :(1//12*b^-11*(a+b*x)^12*(b*c+-1*a*d)^10+1//22*b^-11*d^10*(a+b*x)^22+8*b^-11*d^3*(a+b*x)^15*(b*c+-1*a*d)^7+9//4*b^-11*d^8*(a+b*x)^20*(b*c+-1*a*d)^2+10//13*d*b^-11*(a+b*x)^13*(b*c+-1*a*d)^9+10//21*b^-11*d^9*(a+b*x)^21*(b*c+-1*a*d)+35//3*b^-11*d^6*(a+b*x)^18*(b*c+-1*a*d)^4+45//14*b^-11*d^2*(a+b*x)^14*(b*c+-1*a*d)^8+105//8*b^-11*d^4*(a+b*x)^16*(b*c+-1*a*d)^6+120//19*b^-11*d^7*(a+b*x)^19*(b*c+-1*a*d)^3+252//17*b^-11*d^5*(a+b*x)^17*(b*c+-1*a*d)^5)
@test integrate((a+b*x)^10*(c+d*x)^10, x) == :(1//11*b^-11*(a+b*x)^11*(b*c+-1*a*d)^10+1//21*b^-11*d^10*(a+b*x)^21+(1/2)*b^-11*d^9*(a+b*x)^20*(b*c+-1*a*d)+14*b^-11*d^4*(a+b*x)^15*(b*c+-1*a*d)^6+5//6*d*b^-11*(a+b*x)^12*(b*c+-1*a*d)^9+20//3*b^-11*d^7*(a+b*x)^18*(b*c+-1*a*d)^3+45//13*b^-11*d^2*(a+b*x)^13*(b*c+-1*a*d)^8+45//19*b^-11*d^8*(a+b*x)^19*(b*c+-1*a*d)^2+60//7*b^-11*d^3*(a+b*x)^14*(b*c+-1*a*d)^7+63//4*b^-11*d^5*(a+b*x)^16*(b*c+-1*a*d)^5+210//17*b^-11*d^6*(a+b*x)^17*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^9*(c+d*x)^10, x) == :(-1//11*d^-10*(c+d*x)^11*(b*c+-1*a*d)^9+1//20*b^9*d^-10*(c+d*x)^20+2*b^7*d^-10*(c+d*x)^18*(b*c+-1*a*d)^2+6*b^3*d^-10*(c+d*x)^14*(b*c+-1*a*d)^6+-84//17*b^6*d^-10*(c+d*x)^17*(b*c+-1*a*d)^3+-42//5*b^4*d^-10*(c+d*x)^15*(b*c+-1*a*d)^5+-36//13*b^2*d^-10*(c+d*x)^13*(b*c+-1*a*d)^7+-9//19*b^8*d^-10*(c+d*x)^19*(b*c+-1*a*d)+3//4*b*d^-10*(c+d*x)^12*(b*c+-1*a*d)^8+63//8*b^5*d^-10*(c+d*x)^16*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^8*(c+d*x)^10, x) == :(1//11*d^-9*(c+d*x)^11*(b*c+-1*a*d)^8+1//19*b^8*d^-9*(c+d*x)^19+-4*b^3*d^-9*(c+d*x)^14*(b*c+-1*a*d)^5+-7//2*b^5*d^-9*(c+d*x)^16*(b*c+-1*a*d)^3+-4//9*b^7*d^-9*(c+d*x)^18*(b*c+-1*a*d)+-2//3*b*d^-9*(c+d*x)^12*(b*c+-1*a*d)^7+14//3*b^4*d^-9*(c+d*x)^15*(b*c+-1*a*d)^4+28//13*b^2*d^-9*(c+d*x)^13*(b*c+-1*a*d)^6+28//17*b^6*d^-9*(c+d*x)^17*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^7*(c+d*x)^10, x) == :(-1//11*d^-8*(c+d*x)^11*(b*c+-1*a*d)^7+1//18*b^7*d^-8*(c+d*x)^18+-21//13*b^2*d^-8*(c+d*x)^13*(b*c+-1*a*d)^5+-7//3*b^4*d^-8*(c+d*x)^15*(b*c+-1*a*d)^3+-7//17*b^6*d^-8*(c+d*x)^17*(b*c+-1*a*d)+5//2*b^3*d^-8*(c+d*x)^14*(b*c+-1*a*d)^4+7//12*b*d^-8*(c+d*x)^12*(b*c+-1*a*d)^6+21//16*b^5*d^-8*(c+d*x)^16*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^6*(c+d*x)^10, x) == :(1//11*d^-7*(c+d*x)^11*(b*c+-1*a*d)^6+1//17*b^6*d^-7*(c+d*x)^17+b^4*d^-7*(c+d*x)^15*(b*c+-1*a*d)^2+-10//7*b^3*d^-7*(c+d*x)^14*(b*c+-1*a*d)^3+-3//8*b^5*d^-7*(c+d*x)^16*(b*c+-1*a*d)+-1//2*b*d^-7*(c+d*x)^12*(b*c+-1*a*d)^5+15//13*b^2*d^-7*(c+d*x)^13*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^5*(c+d*x)^10, x) == :(-1//11*d^-6*(c+d*x)^11*(b*c+-1*a*d)^5+1//16*b^5*d^-6*(c+d*x)^16+-10//13*b^2*d^-6*(c+d*x)^13*(b*c+-1*a*d)^3+-1//3*b^4*d^-6*(c+d*x)^15*(b*c+-1*a*d)+5//7*b^3*d^-6*(c+d*x)^14*(b*c+-1*a*d)^2+5//12*b*d^-6*(c+d*x)^12*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^4*(c+d*x)^10, x) == :(1//11*d^-5*(c+d*x)^11*(b*c+-1*a*d)^4+1//15*b^4*d^-5*(c+d*x)^15+-2//7*b^3*d^-5*(c+d*x)^14*(b*c+-1*a*d)+-1//3*b*d^-5*(c+d*x)^12*(b*c+-1*a*d)^3+6//13*b^2*d^-5*(c+d*x)^13*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^10, x) == :(-1//11*d^-4*(c+d*x)^11*(b*c+-1*a*d)^3+1//14*b^3*d^-4*(c+d*x)^14+-3//13*b^2*d^-4*(c+d*x)^13*(b*c+-1*a*d)+1//4*b*d^-4*(c+d*x)^12*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^10, x) == :(1//11*d^-3*(c+d*x)^11*(b*c+-1*a*d)^2+1//13*b^2*d^-3*(c+d*x)^13+-1//6*b*d^-3*(c+d*x)^12*(b*c+-1*a*d))
@test integrate((c+d*x)^10*(a+b*x), x) == :(-1//11*d^-2*(c+d*x)^11*(b*c+-1*a*d)+1//12*b*d^-2*(c+d*x)^12)
@test integrate((c+d*x)^10, x) == :(1//11*d^-1*(c+d*x)^11)
@test integrate((a+b*x)^-1*(c+d*x)^10, x) == :(1//10*b^-1*(c+d*x)^10+b^-11*(b*c+-1*a*d)^10*log(a+b*x)+(1/2)*b^-9*(c+d*x)^2*(b*c+-1*a*d)^8+1//3*b^-8*(c+d*x)^3*(b*c+-1*a*d)^7+1//4*b^-7*(c+d*x)^4*(b*c+-1*a*d)^6+1//5*b^-6*(c+d*x)^5*(b*c+-1*a*d)^5+1//6*b^-5*(c+d*x)^6*(b*c+-1*a*d)^4+1//7*b^-4*(c+d*x)^7*(b*c+-1*a*d)^3+1//8*b^-3*(c+d*x)^8*(b*c+-1*a*d)^2+1//9*b^-2*(c+d*x)^9*(b*c+-1*a*d)+d*x*b^-10*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-2*(c+d*x)^10, x) == :(-1*b^-11*(a+b*x)^-1*(b*c+-1*a*d)^10+1//9*b^-11*d^10*(a+b*x)^9+10*d*b^-11*(b*c+-1*a*d)^9*log(a+b*x)+20*b^-11*d^7*(a+b*x)^6*(b*c+-1*a*d)^3+42*b^-11*d^6*(a+b*x)^5*(b*c+-1*a*d)^4+45*x*b^-10*d^2*(b*c+-1*a*d)^8+60*b^-11*d^3*(a+b*x)^2*(b*c+-1*a*d)^7+63*b^-11*d^5*(a+b*x)^4*(b*c+-1*a*d)^5+70*b^-11*d^4*(a+b*x)^3*(b*c+-1*a*d)^6+5//4*b^-11*d^9*(a+b*x)^8*(b*c+-1*a*d)+45//7*b^-11*d^8*(a+b*x)^7*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-3*(c+d*x)^10, x) == :(-1//2*b^-11*(a+b*x)^-2*(b*c+-1*a*d)^10+1//8*b^-11*d^10*(a+b*x)^8+-10*d*b^-11*(a+b*x)^-1*(b*c+-1*a*d)^9+24*b^-11*d^7*(a+b*x)^5*(b*c+-1*a*d)^3+45*b^-11*d^2*(b*c+-1*a*d)^8*log(a+b*x)+84*b^-11*d^5*(a+b*x)^3*(b*c+-1*a*d)^5+105*b^-11*d^4*(a+b*x)^2*(b*c+-1*a*d)^6+120*x*b^-10*d^3*(b*c+-1*a*d)^7+10//7*b^-11*d^9*(a+b*x)^7*(b*c+-1*a*d)+15//2*b^-11*d^8*(a+b*x)^6*(b*c+-1*a*d)^2+105//2*b^-11*d^6*(a+b*x)^4*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^-4*(c+d*x)^10, x) == :(-1//3*b^-11*(a+b*x)^-3*(b*c+-1*a*d)^10+1//7*b^-11*d^10*(a+b*x)^7+-45*b^-11*d^2*(a+b*x)^-1*(b*c+-1*a*d)^8+-5*d*b^-11*(a+b*x)^-2*(b*c+-1*a*d)^9+9*b^-11*d^8*(a+b*x)^5*(b*c+-1*a*d)^2+30*b^-11*d^7*(a+b*x)^4*(b*c+-1*a*d)^3+70*b^-11*d^6*(a+b*x)^3*(b*c+-1*a*d)^4+120*b^-11*d^3*(b*c+-1*a*d)^7*log(a+b*x)+126*b^-11*d^5*(a+b*x)^2*(b*c+-1*a*d)^5+210*x*b^-10*d^4*(b*c+-1*a*d)^6+5//3*b^-11*d^9*(a+b*x)^6*(b*c+-1*a*d))
@test integrate((a+b*x)^-5*(c+d*x)^10, x) == :(-1//4*b^-11*(a+b*x)^-4*(b*c+-1*a*d)^10+1//6*b^-11*d^10*(a+b*x)^6+-120*b^-11*d^3*(a+b*x)^-1*(b*c+-1*a*d)^7+2*b^-11*d^9*(a+b*x)^5*(b*c+-1*a*d)+40*b^-11*d^7*(a+b*x)^3*(b*c+-1*a*d)^3+105*b^-11*d^6*(a+b*x)^2*(b*c+-1*a*d)^4+210*b^-11*d^4*(b*c+-1*a*d)^6*log(a+b*x)+252*x*b^-10*d^5*(b*c+-1*a*d)^5+-45//2*b^-11*d^2*(a+b*x)^-2*(b*c+-1*a*d)^8+-10//3*d*b^-11*(a+b*x)^-3*(b*c+-1*a*d)^9+45//4*b^-11*d^8*(a+b*x)^4*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-6*(c+d*x)^10, x) == :(-1//5*b^-11*(a+b*x)^-5*(b*c+-1*a*d)^10+1//5*b^-11*d^10*(a+b*x)^5+-210*b^-11*d^4*(a+b*x)^-1*(b*c+-1*a*d)^6+-60*b^-11*d^3*(a+b*x)^-2*(b*c+-1*a*d)^7+-15*b^-11*d^2*(a+b*x)^-3*(b*c+-1*a*d)^8+15*b^-11*d^8*(a+b*x)^3*(b*c+-1*a*d)^2+60*b^-11*d^7*(a+b*x)^2*(b*c+-1*a*d)^3+210*x*b^-10*d^6*(b*c+-1*a*d)^4+252*b^-11*d^5*(b*c+-1*a*d)^5*log(a+b*x)+-5//2*d*b^-11*(a+b*x)^-4*(b*c+-1*a*d)^9+5//2*b^-11*d^9*(a+b*x)^4*(b*c+-1*a*d))
@test integrate((a+b*x)^-7*(c+d*x)^10, x) == :(-1//6*b^-11*(a+b*x)^-6*(b*c+-1*a*d)^10+1//4*b^-11*d^10*(a+b*x)^4+-252*b^-11*d^5*(a+b*x)^-1*(b*c+-1*a*d)^5+-105*b^-11*d^4*(a+b*x)^-2*(b*c+-1*a*d)^6+-40*b^-11*d^3*(a+b*x)^-3*(b*c+-1*a*d)^7+-2*d*b^-11*(a+b*x)^-5*(b*c+-1*a*d)^9+120*x*b^-10*d^7*(b*c+-1*a*d)^3+210*b^-11*d^6*(b*c+-1*a*d)^4*log(a+b*x)+-45//4*b^-11*d^2*(a+b*x)^-4*(b*c+-1*a*d)^8+10//3*b^-11*d^9*(a+b*x)^3*(b*c+-1*a*d)+45//2*b^-11*d^8*(a+b*x)^2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-8*(c+d*x)^10, x) == :(-1//7*b^-11*(a+b*x)^-7*(b*c+-1*a*d)^10+1//3*b^-11*d^10*(a+b*x)^3+-210*b^-11*d^6*(a+b*x)^-1*(b*c+-1*a*d)^4+-126*b^-11*d^5*(a+b*x)^-2*(b*c+-1*a*d)^5+-70*b^-11*d^4*(a+b*x)^-3*(b*c+-1*a*d)^6+-30*b^-11*d^3*(a+b*x)^-4*(b*c+-1*a*d)^7+-9*b^-11*d^2*(a+b*x)^-5*(b*c+-1*a*d)^8+5*b^-11*d^9*(a+b*x)^2*(b*c+-1*a*d)+45*x*b^-10*d^8*(b*c+-1*a*d)^2+120*b^-11*d^7*(b*c+-1*a*d)^3*log(a+b*x)+-5//3*d*b^-11*(a+b*x)^-6*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-9*(c+d*x)^10, x) == :((1/2)*b^-9*d^10*x^2+-1//8*b^-11*(a+b*x)^-8*(b*c+-1*a*d)^10+x*b^-10*d^9*(-9*a*d+10*b*c)+-120*b^-11*d^7*(a+b*x)^-1*(b*c+-1*a*d)^3+-105*b^-11*d^6*(a+b*x)^-2*(b*c+-1*a*d)^4+-84*b^-11*d^5*(a+b*x)^-3*(b*c+-1*a*d)^5+-24*b^-11*d^3*(a+b*x)^-5*(b*c+-1*a*d)^7+45*b^-11*d^8*(b*c+-1*a*d)^2*log(a+b*x)+-105//2*b^-11*d^4*(a+b*x)^-4*(b*c+-1*a*d)^6+-15//2*b^-11*d^2*(a+b*x)^-6*(b*c+-1*a*d)^8+-10//7*d*b^-11*(a+b*x)^-7*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-10*(c+d*x)^10, x) == :(x*b^-10*d^10+-1//9*b^-11*(a+b*x)^-9*(b*c+-1*a*d)^10+-70*b^-11*d^6*(a+b*x)^-3*(b*c+-1*a*d)^4+-63*b^-11*d^5*(a+b*x)^-4*(b*c+-1*a*d)^5+-60*b^-11*d^7*(a+b*x)^-2*(b*c+-1*a*d)^3+-45*b^-11*d^8*(a+b*x)^-1*(b*c+-1*a*d)^2+-42*b^-11*d^4*(a+b*x)^-5*(b*c+-1*a*d)^6+-20*b^-11*d^3*(a+b*x)^-6*(b*c+-1*a*d)^7+10*b^-11*d^9*(b*c+-1*a*d)*log(a+b*x)+-45//7*b^-11*d^2*(a+b*x)^-7*(b*c+-1*a*d)^8+-5//4*d*b^-11*(a+b*x)^-8*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-11*(c+d*x)^10, x) == :(b^-11*d^10*log(a+b*x)+-1//10*b^-11*(a+b*x)^-10*(b*c+-1*a*d)^10+-40*b^-11*d^7*(a+b*x)^-3*(b*c+-1*a*d)^3+-35*b^-11*d^4*(a+b*x)^-6*(b*c+-1*a*d)^6+-10*b^-11*d^9*(a+b*x)^-1*(b*c+-1*a*d)+-252//5*b^-11*d^5*(a+b*x)^-5*(b*c+-1*a*d)^5+-120//7*b^-11*d^3*(a+b*x)^-7*(b*c+-1*a*d)^7+-105//2*b^-11*d^6*(a+b*x)^-4*(b*c+-1*a*d)^4+-45//2*b^-11*d^8*(a+b*x)^-2*(b*c+-1*a*d)^2+-45//8*b^-11*d^2*(a+b*x)^-8*(b*c+-1*a*d)^8+-10//9*d*b^-11*(a+b*x)^-9*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-12*(c+d*x)^10, x) == :(-1*(a+b*x)^-11*(c+d*x)^11*(-11*a*d+11*b*c)^-1)
@test integrate((a+b*x)^-13*(c+d*x)^10, x) == :(-1*(a+b*x)^-12*(c+d*x)^11*(-12*a*d+12*b*c)^-1+1//132*d*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-14*(c+d*x)^10, x) == :(-1*(a+b*x)^-13*(c+d*x)^11*(-13*a*d+13*b*c)^-1+-1//858*d^2*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-3+1//78*d*(a+b*x)^-12*(c+d*x)^11*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-15*(c+d*x)^10, x) == :(-1*(a+b*x)^-14*(c+d*x)^11*(-14*a*d+14*b*c)^-1+-1//364*d^2*(a+b*x)^-12*(c+d*x)^11*(b*c+-1*a*d)^-3+1//4004*d^3*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-4+3//182*d*(a+b*x)^-13*(c+d*x)^11*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-16*(c+d*x)^10, x) == :(-1*(a+b*x)^-15*(c+d*x)^11*(-15*a*d+15*b*c)^-1+-2//455*d^2*(a+b*x)^-13*(c+d*x)^11*(b*c+-1*a*d)^-3+-1//15015*d^4*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-5+1//1365*d^3*(a+b*x)^-12*(c+d*x)^11*(b*c+-1*a*d)^-4+2//105*d*(a+b*x)^-14*(c+d*x)^11*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-17*(c+d*x)^10, x) == :(-1*(a+b*x)^-16*(c+d*x)^11*(-16*a*d+16*b*c)^-1+-1//168*d^2*(a+b*x)^-14*(c+d*x)^11*(b*c+-1*a*d)^-3+-1//4368*d^4*(a+b*x)^-12*(c+d*x)^11*(b*c+-1*a*d)^-5+1//48*d*(a+b*x)^-15*(c+d*x)^11*(b*c+-1*a*d)^-2+1//728*d^3*(a+b*x)^-13*(c+d*x)^11*(b*c+-1*a*d)^-4+1//48048*d^5*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-6)
@test integrate((a+b*x)^-18*(c+d*x)^10, x) == :(-1*(a+b*x)^-17*(c+d*x)^11*(-17*a*d+17*b*c)^-1+-3//6188*d^4*(a+b*x)^-13*(c+d*x)^11*(b*c+-1*a*d)^-5+-1//136*d^2*(a+b*x)^-15*(c+d*x)^11*(b*c+-1*a*d)^-3+-1//136136*d^6*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-7+1//476*d^3*(a+b*x)^-14*(c+d*x)^11*(b*c+-1*a*d)^-4+1//12376*d^5*(a+b*x)^-12*(c+d*x)^11*(b*c+-1*a*d)^-6+3//136*d*(a+b*x)^-16*(c+d*x)^11*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-19*(c+d*x)^10, x) == :(-1*(a+b*x)^-18*(c+d*x)^11*(-18*a*d+18*b*c)^-1+-7//816*d^2*(a+b*x)^-16*(c+d*x)^11*(b*c+-1*a*d)^-3+-1//1224*d^4*(a+b*x)^-14*(c+d*x)^11*(b*c+-1*a*d)^-5+-1//31824*d^6*(a+b*x)^-12*(c+d*x)^11*(b*c+-1*a*d)^-7+1//5304*d^5*(a+b*x)^-13*(c+d*x)^11*(b*c+-1*a*d)^-6+1//350064*d^7*(a+b*x)^-11*(c+d*x)^11*(b*c+-1*a*d)^-8+7//306*d*(a+b*x)^-17*(c+d*x)^11*(b*c+-1*a*d)^-2+7//2448*d^3*(a+b*x)^-15*(c+d*x)^11*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-20*(c+d*x)^10, x) == :(-1//9*b^-11*d^10*(a+b*x)^-9+-1//19*b^-11*(a+b*x)^-19*(b*c+-1*a*d)^10+-1*b^-11*d^9*(a+b*x)^-10*(b*c+-1*a*d)+-18*b^-11*d^5*(a+b*x)^-14*(b*c+-1*a*d)^5+-14*b^-11*d^4*(a+b*x)^-15*(b*c+-1*a*d)^6+-10*b^-11*d^7*(a+b*x)^-12*(b*c+-1*a*d)^3+-210//13*b^-11*d^6*(a+b*x)^-13*(b*c+-1*a*d)^4+-45//11*b^-11*d^8*(a+b*x)^-11*(b*c+-1*a*d)^2+-45//17*b^-11*d^2*(a+b*x)^-17*(b*c+-1*a*d)^8+-15//2*b^-11*d^3*(a+b*x)^-16*(b*c+-1*a*d)^7+-5//9*d*b^-11*(a+b*x)^-18*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-21*(c+d*x)^10, x) == :(-1//10*b^-11*d^10*(a+b*x)^-10+-1//20*b^-11*(a+b*x)^-20*(b*c+-1*a*d)^10+-15*b^-11*d^6*(a+b*x)^-14*(b*c+-1*a*d)^4+-120//13*b^-11*d^7*(a+b*x)^-13*(b*c+-1*a*d)^3+-120//17*b^-11*d^3*(a+b*x)^-17*(b*c+-1*a*d)^7+-105//8*b^-11*d^4*(a+b*x)^-16*(b*c+-1*a*d)^6+-84//5*b^-11*d^5*(a+b*x)^-15*(b*c+-1*a*d)^5+-15//4*b^-11*d^8*(a+b*x)^-12*(b*c+-1*a*d)^2+-10//11*b^-11*d^9*(a+b*x)^-11*(b*c+-1*a*d)+-10//19*d*b^-11*(a+b*x)^-19*(b*c+-1*a*d)^9+-5//2*b^-11*d^2*(a+b*x)^-18*(b*c+-1*a*d)^8)
@test integrate((a+b*x)^-22*(c+d*x)^10, x) == :(-1//11*b^-11*d^10*(a+b*x)^-11+-1//21*b^-11*(a+b*x)^-21*(b*c+-1*a*d)^10+-14*b^-11*d^6*(a+b*x)^-15*(b*c+-1*a*d)^4+-210//17*b^-11*d^4*(a+b*x)^-17*(b*c+-1*a*d)^6+-63//4*b^-11*d^5*(a+b*x)^-16*(b*c+-1*a*d)^5+-60//7*b^-11*d^7*(a+b*x)^-14*(b*c+-1*a*d)^3+-45//13*b^-11*d^8*(a+b*x)^-13*(b*c+-1*a*d)^2+-45//19*b^-11*d^2*(a+b*x)^-19*(b*c+-1*a*d)^8+-20//3*b^-11*d^3*(a+b*x)^-18*(b*c+-1*a*d)^7+-5//6*b^-11*d^9*(a+b*x)^-12*(b*c+-1*a*d)+-1//2*d*b^-11*(a+b*x)^-20*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^17*(c+d*x)^15, x) == :(1//18*b^-16*(a+b*x)^18*(b*c+-1*a*d)^15+1//33*b^-16*d^15*(a+b*x)^33+15//19*d*b^-16*(a+b*x)^19*(b*c+-1*a*d)^14+15//32*b^-16*d^14*(a+b*x)^32*(b*c+-1*a*d)+21//4*b^-16*d^2*(a+b*x)^20*(b*c+-1*a*d)^13+65//3*b^-16*d^3*(a+b*x)^21*(b*c+-1*a*d)^12+91//6*b^-16*d^12*(a+b*x)^30*(b*c+-1*a*d)^3+105//31*b^-16*d^13*(a+b*x)^31*(b*c+-1*a*d)^2+429//4*b^-16*d^10*(a+b*x)^28*(b*c+-1*a*d)^5+495//2*b^-16*d^8*(a+b*x)^26*(b*c+-1*a*d)^7+1287//5*b^-16*d^7*(a+b*x)^25*(b*c+-1*a*d)^8+1365//22*b^-16*d^4*(a+b*x)^22*(b*c+-1*a*d)^11+1365//29*b^-16*d^11*(a+b*x)^29*(b*c+-1*a*d)^4+3003//23*b^-16*d^5*(a+b*x)^23*(b*c+-1*a*d)^10+5005//24*b^-16*d^6*(a+b*x)^24*(b*c+-1*a*d)^9+5005//27*b^-16*d^9*(a+b*x)^27*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^16*(c+d*x)^15, x) == :(1//17*b^-16*(a+b*x)^17*(b*c+-1*a*d)^15+1//32*b^-16*d^15*(a+b*x)^32+65*b^-16*d^4*(a+b*x)^21*(b*c+-1*a*d)^11+5//6*d*b^-16*(a+b*x)^18*(b*c+-1*a*d)^14+7//2*b^-16*d^13*(a+b*x)^30*(b*c+-1*a*d)^2+15//31*b^-16*d^14*(a+b*x)^31*(b*c+-1*a*d)+91//4*b^-16*d^3*(a+b*x)^20*(b*c+-1*a*d)^12+105//19*b^-16*d^2*(a+b*x)^19*(b*c+-1*a*d)^13+195//4*b^-16*d^11*(a+b*x)^28*(b*c+-1*a*d)^4+273//2*b^-16*d^5*(a+b*x)^22*(b*c+-1*a*d)^10+385//2*b^-16*d^9*(a+b*x)^26*(b*c+-1*a*d)^6+455//29*b^-16*d^12*(a+b*x)^29*(b*c+-1*a*d)^3+1001//9*b^-16*d^10*(a+b*x)^27*(b*c+-1*a*d)^5+1287//5*b^-16*d^8*(a+b*x)^25*(b*c+-1*a*d)^7+2145//8*b^-16*d^7*(a+b*x)^24*(b*c+-1*a*d)^8+5005//23*b^-16*d^6*(a+b*x)^23*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^15*(c+d*x)^15, x) == :(1//16*b^-16*(a+b*x)^16*(b*c+-1*a*d)^15+1//31*b^-16*d^15*(a+b*x)^31+(1/2)*b^-16*d^14*(a+b*x)^30*(b*c+-1*a*d)+143*b^-16*d^5*(a+b*x)^21*(b*c+-1*a*d)^10+15//17*d*b^-16*(a+b*x)^17*(b*c+-1*a*d)^14+35//6*b^-16*d^2*(a+b*x)^18*(b*c+-1*a*d)^13+65//4*b^-16*d^12*(a+b*x)^28*(b*c+-1*a*d)^3+105//29*b^-16*d^13*(a+b*x)^29*(b*c+-1*a*d)^2+231//2*b^-16*d^10*(a+b*x)^26*(b*c+-1*a*d)^5+273//4*b^-16*d^4*(a+b*x)^20*(b*c+-1*a*d)^11+455//2*b^-16*d^6*(a+b*x)^22*(b*c+-1*a*d)^9+455//9*b^-16*d^11*(a+b*x)^27*(b*c+-1*a*d)^4+455//19*b^-16*d^3*(a+b*x)^19*(b*c+-1*a*d)^12+1001//5*b^-16*d^9*(a+b*x)^25*(b*c+-1*a*d)^6+2145//8*b^-16*d^8*(a+b*x)^24*(b*c+-1*a*d)^7+6435//23*b^-16*d^7*(a+b*x)^23*(b*c+-1*a*d)^8)
@test integrate((a+b*x)^14*(c+d*x)^15, x) == :(1//16*d^-15*(c+d*x)^16*(b*c+-1*a*d)^14+1//30*b^14*d^-15*(c+d*x)^30+-3432//23*b^7*d^-15*(c+d*x)^23*(b*c+-1*a*d)^7+-2002//25*b^9*d^-15*(c+d*x)^25*(b*c+-1*a*d)^5+-364//19*b^3*d^-15*(c+d*x)^19*(b*c+-1*a*d)^11+-364//27*b^11*d^-15*(c+d*x)^27*(b*c+-1*a*d)^3+-286//3*b^5*d^-15*(c+d*x)^21*(b*c+-1*a*d)^9+-14//17*b*d^-15*(c+d*x)^17*(b*c+-1*a*d)^13+-14//29*b^13*d^-15*(c+d*x)^29*(b*c+-1*a*d)+13//4*b^12*d^-15*(c+d*x)^28*(b*c+-1*a*d)^2+77//2*b^10*d^-15*(c+d*x)^26*(b*c+-1*a*d)^4+91//18*b^2*d^-15*(c+d*x)^18*(b*c+-1*a*d)^12+273//2*b^6*d^-15*(c+d*x)^22*(b*c+-1*a*d)^8+1001//8*b^8*d^-15*(c+d*x)^24*(b*c+-1*a*d)^6+1001//20*b^4*d^-15*(c+d*x)^20*(b*c+-1*a*d)^10)
@test integrate((a+b*x)^13*(c+d*x)^15, x) == :(-1//16*d^-14*(c+d*x)^16*(b*c+-1*a*d)^13+1//29*b^13*d^-14*(c+d*x)^29+-78*b^6*d^-14*(c+d*x)^22*(b*c+-1*a*d)^7+-11*b^10*d^-14*(c+d*x)^26*(b*c+-1*a*d)^3+-429//8*b^8*d^-14*(c+d*x)^24*(b*c+-1*a*d)^5+-143//4*b^4*d^-14*(c+d*x)^20*(b*c+-1*a*d)^9+-13//3*b^2*d^-14*(c+d*x)^18*(b*c+-1*a*d)^11+-13//28*b^12*d^-14*(c+d*x)^28*(b*c+-1*a*d)+13//17*b*d^-14*(c+d*x)^17*(b*c+-1*a*d)^12+26//9*b^11*d^-14*(c+d*x)^27*(b*c+-1*a*d)^2+143//5*b^9*d^-14*(c+d*x)^25*(b*c+-1*a*d)^4+286//19*b^3*d^-14*(c+d*x)^19*(b*c+-1*a*d)^10+429//7*b^5*d^-14*(c+d*x)^21*(b*c+-1*a*d)^8+1716//23*b^7*d^-14*(c+d*x)^23*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^12*(c+d*x)^15, x) == :(1//16*d^-13*(c+d*x)^16*(b*c+-1*a*d)^12+1//28*b^12*d^-13*(c+d*x)^28+42*b^6*d^-13*(c+d*x)^22*(b*c+-1*a*d)^6+-792//23*b^7*d^-13*(c+d*x)^23*(b*c+-1*a*d)^5+-264//7*b^5*d^-13*(c+d*x)^21*(b*c+-1*a*d)^7+-220//19*b^3*d^-13*(c+d*x)^19*(b*c+-1*a*d)^9+-44//5*b^9*d^-13*(c+d*x)^25*(b*c+-1*a*d)^3+-12//17*b*d^-13*(c+d*x)^17*(b*c+-1*a*d)^11+-4//9*b^11*d^-13*(c+d*x)^27*(b*c+-1*a*d)+11//3*b^2*d^-13*(c+d*x)^18*(b*c+-1*a*d)^10+33//13*b^10*d^-13*(c+d*x)^26*(b*c+-1*a*d)^2+99//4*b^4*d^-13*(c+d*x)^20*(b*c+-1*a*d)^8+165//8*b^8*d^-13*(c+d*x)^24*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^11*(c+d*x)^15, x) == :(-1//16*d^-12*(c+d*x)^16*(b*c+-1*a*d)^11+1//27*b^11*d^-12*(c+d*x)^27+-21*b^6*d^-12*(c+d*x)^22*(b*c+-1*a*d)^5+22*b^5*d^-12*(c+d*x)^21*(b*c+-1*a*d)^6+-55//8*b^8*d^-12*(c+d*x)^24*(b*c+-1*a*d)^3+-55//18*b^2*d^-12*(c+d*x)^18*(b*c+-1*a*d)^9+-33//2*b^4*d^-12*(c+d*x)^20*(b*c+-1*a*d)^7+-11//26*b^10*d^-12*(c+d*x)^26*(b*c+-1*a*d)+11//5*b^9*d^-12*(c+d*x)^25*(b*c+-1*a*d)^2+11//17*b*d^-12*(c+d*x)^17*(b*c+-1*a*d)^10+165//19*b^3*d^-12*(c+d*x)^19*(b*c+-1*a*d)^8+330//23*b^7*d^-12*(c+d*x)^23*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^10*(c+d*x)^15, x) == :(1//16*d^-11*(c+d*x)^16*(b*c+-1*a*d)^10+1//26*b^10*d^-11*(c+d*x)^26+-12*b^5*d^-11*(c+d*x)^21*(b*c+-1*a*d)^5+-120//19*b^3*d^-11*(c+d*x)^19*(b*c+-1*a*d)^7+-120//23*b^7*d^-11*(c+d*x)^23*(b*c+-1*a*d)^3+-10//17*b*d^-11*(c+d*x)^17*(b*c+-1*a*d)^9+-2//5*b^9*d^-11*(c+d*x)^25*(b*c+-1*a*d)+5//2*b^2*d^-11*(c+d*x)^18*(b*c+-1*a*d)^8+15//8*b^8*d^-11*(c+d*x)^24*(b*c+-1*a*d)^2+21//2*b^4*d^-11*(c+d*x)^20*(b*c+-1*a*d)^6+105//11*b^6*d^-11*(c+d*x)^22*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^9*(c+d*x)^15, x) == :(-1//16*d^-10*(c+d*x)^16*(b*c+-1*a*d)^9+1//25*b^9*d^-10*(c+d*x)^25+-2*b^2*d^-10*(c+d*x)^18*(b*c+-1*a*d)^7+6*b^5*d^-10*(c+d*x)^21*(b*c+-1*a*d)^4+-63//10*b^4*d^-10*(c+d*x)^20*(b*c+-1*a*d)^5+-42//11*b^6*d^-10*(c+d*x)^22*(b*c+-1*a*d)^3+-3//8*b^8*d^-10*(c+d*x)^24*(b*c+-1*a*d)+9//17*b*d^-10*(c+d*x)^17*(b*c+-1*a*d)^8+36//23*b^7*d^-10*(c+d*x)^23*(b*c+-1*a*d)^2+84//19*b^3*d^-10*(c+d*x)^19*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^8*(c+d*x)^15, x) == :(1//16*d^-9*(c+d*x)^16*(b*c+-1*a*d)^8+1//24*b^8*d^-9*(c+d*x)^24+-56//19*b^3*d^-9*(c+d*x)^19*(b*c+-1*a*d)^5+-8//3*b^5*d^-9*(c+d*x)^21*(b*c+-1*a*d)^3+-8//17*b*d^-9*(c+d*x)^17*(b*c+-1*a*d)^7+-8//23*b^7*d^-9*(c+d*x)^23*(b*c+-1*a*d)+7//2*b^4*d^-9*(c+d*x)^20*(b*c+-1*a*d)^4+14//9*b^2*d^-9*(c+d*x)^18*(b*c+-1*a*d)^6+14//11*b^6*d^-9*(c+d*x)^22*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^7*(c+d*x)^15, x) == :(-1//16*d^-8*(c+d*x)^16*(b*c+-1*a*d)^7+1//23*b^7*d^-8*(c+d*x)^23+b^5*d^-8*(c+d*x)^21*(b*c+-1*a*d)^2+-7//4*b^4*d^-8*(c+d*x)^20*(b*c+-1*a*d)^3+-7//6*b^2*d^-8*(c+d*x)^18*(b*c+-1*a*d)^5+-7//22*b^6*d^-8*(c+d*x)^22*(b*c+-1*a*d)+7//17*b*d^-8*(c+d*x)^17*(b*c+-1*a*d)^6+35//19*b^3*d^-8*(c+d*x)^19*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^6*(c+d*x)^15, x) == :(1//16*d^-7*(c+d*x)^16*(b*c+-1*a*d)^6+1//22*b^6*d^-7*(c+d*x)^22+-20//19*b^3*d^-7*(c+d*x)^19*(b*c+-1*a*d)^3+-6//17*b*d^-7*(c+d*x)^17*(b*c+-1*a*d)^5+-2//7*b^5*d^-7*(c+d*x)^21*(b*c+-1*a*d)+3//4*b^4*d^-7*(c+d*x)^20*(b*c+-1*a*d)^2+5//6*b^2*d^-7*(c+d*x)^18*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^5*(c+d*x)^15, x) == :(-1//16*d^-6*(c+d*x)^16*(b*c+-1*a*d)^5+1//21*b^5*d^-6*(c+d*x)^21+-5//9*b^2*d^-6*(c+d*x)^18*(b*c+-1*a*d)^3+-1//4*b^4*d^-6*(c+d*x)^20*(b*c+-1*a*d)+5//17*b*d^-6*(c+d*x)^17*(b*c+-1*a*d)^4+10//19*b^3*d^-6*(c+d*x)^19*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^15, x) == :(1//16*d^-5*(c+d*x)^16*(b*c+-1*a*d)^4+1//20*b^4*d^-5*(c+d*x)^20+-4//17*b*d^-5*(c+d*x)^17*(b*c+-1*a*d)^3+-4//19*b^3*d^-5*(c+d*x)^19*(b*c+-1*a*d)+1//3*b^2*d^-5*(c+d*x)^18*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^15, x) == :(-1//16*d^-4*(c+d*x)^16*(b*c+-1*a*d)^3+1//19*b^3*d^-4*(c+d*x)^19+-1//6*b^2*d^-4*(c+d*x)^18*(b*c+-1*a*d)+3//17*b*d^-4*(c+d*x)^17*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^15, x) == :(1//16*d^-3*(c+d*x)^16*(b*c+-1*a*d)^2+1//18*b^2*d^-3*(c+d*x)^18+-2//17*b*d^-3*(c+d*x)^17*(b*c+-1*a*d))
@test integrate((c+d*x)^15*(a+b*x), x) == :(-1//16*d^-2*(c+d*x)^16*(b*c+-1*a*d)+1//17*b*d^-2*(c+d*x)^17)
@test integrate((c+d*x)^15, x) == :(1//16*d^-1*(c+d*x)^16)
@test integrate((a+b*x)^-1*(c+d*x)^15, x) == :(1//15*b^-1*(c+d*x)^15+b^-16*(b*c+-1*a*d)^15*log(a+b*x)+(1/2)*b^-14*(c+d*x)^2*(b*c+-1*a*d)^13+1//3*b^-13*(c+d*x)^3*(b*c+-1*a*d)^12+1//4*b^-12*(c+d*x)^4*(b*c+-1*a*d)^11+1//5*b^-11*(c+d*x)^5*(b*c+-1*a*d)^10+1//6*b^-10*(c+d*x)^6*(b*c+-1*a*d)^9+1//7*b^-9*(c+d*x)^7*(b*c+-1*a*d)^8+1//8*b^-8*(c+d*x)^8*(b*c+-1*a*d)^7+1//9*b^-7*(c+d*x)^9*(b*c+-1*a*d)^6+1//10*b^-6*(c+d*x)^10*(b*c+-1*a*d)^5+1//11*b^-5*(c+d*x)^11*(b*c+-1*a*d)^4+1//12*b^-4*(c+d*x)^12*(b*c+-1*a*d)^3+1//13*b^-3*(c+d*x)^13*(b*c+-1*a*d)^2+1//14*b^-2*(c+d*x)^14*(b*c+-1*a*d)+d*x*b^-15*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^-2*(c+d*x)^15, x) == :(-1*b^-16*(a+b*x)^-1*(b*c+-1*a*d)^15+1//14*b^-16*d^15*(a+b*x)^14+15*d*b^-16*(b*c+-1*a*d)^14*log(a+b*x)+105*x*b^-15*d^2*(b*c+-1*a*d)^13+455*b^-16*d^4*(a+b*x)^3*(b*c+-1*a*d)^11+1001*b^-16*d^6*(a+b*x)^5*(b*c+-1*a*d)^9+15//13*b^-16*d^14*(a+b*x)^13*(b*c+-1*a*d)+35//4*b^-16*d^13*(a+b*x)^12*(b*c+-1*a*d)^2+273//2*b^-16*d^11*(a+b*x)^10*(b*c+-1*a*d)^4+455//2*b^-16*d^3*(a+b*x)^2*(b*c+-1*a*d)^12+455//11*b^-16*d^12*(a+b*x)^11*(b*c+-1*a*d)^3+1001//3*b^-16*d^10*(a+b*x)^9*(b*c+-1*a*d)^5+2145//2*b^-16*d^7*(a+b*x)^6*(b*c+-1*a*d)^8+3003//4*b^-16*d^5*(a+b*x)^4*(b*c+-1*a*d)^10+5005//8*b^-16*d^9*(a+b*x)^8*(b*c+-1*a*d)^6+6435//7*b^-16*d^8*(a+b*x)^7*(b*c+-1*a*d)^7)
@test integrate((a+b*x)^-3*(c+d*x)^15, x) == :(-1//2*b^-16*(a+b*x)^-2*(b*c+-1*a*d)^15+1//13*b^-16*d^15*(a+b*x)^13+-15*d*b^-16*(a+b*x)^-1*(b*c+-1*a*d)^14+105*b^-16*d^2*(b*c+-1*a*d)^13*log(a+b*x)+455*x*b^-15*d^3*(b*c+-1*a*d)^12+715*b^-16*d^9*(a+b*x)^7*(b*c+-1*a*d)^6+1001*b^-16*d^5*(a+b*x)^3*(b*c+-1*a*d)^10+1287*b^-16*d^7*(a+b*x)^5*(b*c+-1*a*d)^8+5//4*b^-16*d^14*(a+b*x)^12*(b*c+-1*a*d)+91//2*b^-16*d^12*(a+b*x)^10*(b*c+-1*a*d)^3+105//11*b^-16*d^13*(a+b*x)^11*(b*c+-1*a*d)^2+455//3*b^-16*d^11*(a+b*x)^9*(b*c+-1*a*d)^4+1365//2*b^-16*d^4*(a+b*x)^2*(b*c+-1*a*d)^11+2145//2*b^-16*d^8*(a+b*x)^6*(b*c+-1*a*d)^7+3003//8*b^-16*d^10*(a+b*x)^8*(b*c+-1*a*d)^5+5005//4*b^-16*d^6*(a+b*x)^4*(b*c+-1*a*d)^9)
@test integrate((a+b*x)^-4*(c+d*x)^15, x) == :(-1//3*b^-16*(a+b*x)^-3*(b*c+-1*a*d)^15+1//12*b^-16*d^15*(a+b*x)^12+-105*b^-16*d^2*(a+b*x)^-1*(b*c+-1*a*d)^13+429*b^-16*d^10*(a+b*x)^7*(b*c+-1*a*d)^5+455*b^-16*d^3*(b*c+-1*a*d)^12*log(a+b*x)+1287*b^-16*d^8*(a+b*x)^5*(b*c+-1*a*d)^7+1365*x*b^-15*d^4*(b*c+-1*a*d)^11+-15//2*d*b^-16*(a+b*x)^-2*(b*c+-1*a*d)^14+15//11*b^-16*d^14*(a+b*x)^11*(b*c+-1*a*d)+21//2*b^-16*d^13*(a+b*x)^10*(b*c+-1*a*d)^2+455//9*b^-16*d^12*(a+b*x)^9*(b*c+-1*a*d)^3+1365//8*b^-16*d^11*(a+b*x)^8*(b*c+-1*a*d)^4+3003//2*b^-16*d^5*(a+b*x)^2*(b*c+-1*a*d)^10+5005//3*b^-16*d^6*(a+b*x)^3*(b*c+-1*a*d)^9+5005//6*b^-16*d^9*(a+b*x)^6*(b*c+-1*a*d)^6+6435//4*b^-16*d^7*(a+b*x)^4*(b*c+-1*a*d)^8)
@test integrate((a+b*x)^-5*(c+d*x)^15, x) == :(-1//4*b^-16*(a+b*x)^-4*(b*c+-1*a*d)^15+1//11*b^-16*d^15*(a+b*x)^11+-455*b^-16*d^3*(a+b*x)^-1*(b*c+-1*a*d)^12+-5*d*b^-16*(a+b*x)^-3*(b*c+-1*a*d)^14+195*b^-16*d^11*(a+b*x)^7*(b*c+-1*a*d)^4+1001*b^-16*d^9*(a+b*x)^5*(b*c+-1*a*d)^6+1365*b^-16*d^4*(b*c+-1*a*d)^11*log(a+b*x)+2145*b^-16*d^7*(a+b*x)^3*(b*c+-1*a*d)^8+3003*x*b^-15*d^5*(b*c+-1*a*d)^10+-105//2*b^-16*d^2*(a+b*x)^-2*(b*c+-1*a*d)^13+3//2*b^-16*d^14*(a+b*x)^10*(b*c+-1*a*d)+35//3*b^-16*d^13*(a+b*x)^9*(b*c+-1*a*d)^2+455//8*b^-16*d^12*(a+b*x)^8*(b*c+-1*a*d)^3+1001//2*b^-16*d^10*(a+b*x)^6*(b*c+-1*a*d)^5+5005//2*b^-16*d^6*(a+b*x)^2*(b*c+-1*a*d)^9+6435//4*b^-16*d^8*(a+b*x)^4*(b*c+-1*a*d)^7)
@test integrate((a+b*x)^-6*(c+d*x)^15, x) == :(-1//5*b^-16*(a+b*x)^-5*(b*c+-1*a*d)^15+1//10*b^-16*d^15*(a+b*x)^10+-1365*b^-16*d^4*(a+b*x)^-1*(b*c+-1*a*d)^11+-35*b^-16*d^2*(a+b*x)^-3*(b*c+-1*a*d)^13+65*b^-16*d^12*(a+b*x)^7*(b*c+-1*a*d)^3+2145*b^-16*d^8*(a+b*x)^3*(b*c+-1*a*d)^7+3003*b^-16*d^5*(b*c+-1*a*d)^10*log(a+b*x)+5005*x*b^-15*d^6*(b*c+-1*a*d)^9+-455//2*b^-16*d^3*(a+b*x)^-2*(b*c+-1*a*d)^12+-15//4*d*b^-16*(a+b*x)^-4*(b*c+-1*a*d)^14+5//3*b^-16*d^14*(a+b*x)^9*(b*c+-1*a*d)+105//8*b^-16*d^13*(a+b*x)^8*(b*c+-1*a*d)^2+455//2*b^-16*d^11*(a+b*x)^6*(b*c+-1*a*d)^4+3003//5*b^-16*d^10*(a+b*x)^5*(b*c+-1*a*d)^5+5005//4*b^-16*d^9*(a+b*x)^4*(b*c+-1*a*d)^6+6435//2*b^-16*d^7*(a+b*x)^2*(b*c+-1*a*d)^8)
@test integrate((a+b*x)^-7*(c+d*x)^15, x) == :(-1//6*b^-16*(a+b*x)^-6*(b*c+-1*a*d)^15+1//9*b^-16*d^15*(a+b*x)^9+-3003*b^-16*d^5*(a+b*x)^-1*(b*c+-1*a*d)^10+-3*d*b^-16*(a+b*x)^-5*(b*c+-1*a*d)^14+15*b^-16*d^13*(a+b*x)^7*(b*c+-1*a*d)^2+273*b^-16*d^11*(a+b*x)^5*(b*c+-1*a*d)^4+5005*b^-16*d^6*(b*c+-1*a*d)^9*log(a+b*x)+6435*x*b^-15*d^7*(b*c+-1*a*d)^8+-1365//2*b^-16*d^4*(a+b*x)^-2*(b*c+-1*a*d)^11+-455//3*b^-16*d^3*(a+b*x)^-3*(b*c+-1*a*d)^12+-105//4*b^-16*d^2*(a+b*x)^-4*(b*c+-1*a*d)^13+15//8*b^-16*d^14*(a+b*x)^8*(b*c+-1*a*d)+455//6*b^-16*d^12*(a+b*x)^6*(b*c+-1*a*d)^3+3003//4*b^-16*d^10*(a+b*x)^4*(b*c+-1*a*d)^5+5005//3*b^-16*d^9*(a+b*x)^3*(b*c+-1*a*d)^6+6435//2*b^-16*d^8*(a+b*x)^2*(b*c+-1*a*d)^7)
@test integrate((a+b*x)^-8*(c+d*x)^15, x) == :(-1//7*b^-16*(a+b*x)^-7*(b*c+-1*a*d)^15+1//8*b^-16*d^15*(a+b*x)^8+-5005*b^-16*d^6*(a+b*x)^-1*(b*c+-1*a*d)^9+-455*b^-16*d^4*(a+b*x)^-3*(b*c+-1*a*d)^11+-21*b^-16*d^2*(a+b*x)^-5*(b*c+-1*a*d)^13+91*b^-16*d^12*(a+b*x)^5*(b*c+-1*a*d)^3+1001*b^-16*d^10*(a+b*x)^3*(b*c+-1*a*d)^5+6435*x*b^-15*d^8*(b*c+-1*a*d)^7+6435*b^-16*d^7*(b*c+-1*a*d)^8*log(a+b*x)+-3003//2*b^-16*d^5*(a+b*x)^-2*(b*c+-1*a*d)^10+-455//4*b^-16*d^3*(a+b*x)^-4*(b*c+-1*a*d)^12+-5//2*d*b^-16*(a+b*x)^-6*(b*c+-1*a*d)^14+15//7*b^-16*d^14*(a+b*x)^7*(b*c+-1*a*d)+35//2*b^-16*d^13*(a+b*x)^6*(b*c+-1*a*d)^2+1365//4*b^-16*d^11*(a+b*x)^4*(b*c+-1*a*d)^4+5005//2*b^-16*d^9*(a+b*x)^2*(b*c+-1*a*d)^6)
@test integrate((a+b*x)^-9*(c+d*x)^15, x) == :(-1//8*b^-16*(a+b*x)^-8*(b*c+-1*a*d)^15+1//7*b^-16*d^15*(a+b*x)^7+-6435*b^-16*d^7*(a+b*x)^-1*(b*c+-1*a*d)^8+-1001*b^-16*d^5*(a+b*x)^-3*(b*c+-1*a*d)^10+-91*b^-16*d^3*(a+b*x)^-5*(b*c+-1*a*d)^12+21*b^-16*d^13*(a+b*x)^5*(b*c+-1*a*d)^2+455*b^-16*d^11*(a+b*x)^3*(b*c+-1*a*d)^4+5005*x*b^-15*d^9*(b*c+-1*a*d)^6+6435*b^-16*d^8*(b*c+-1*a*d)^7*log(a+b*x)+-5005//2*b^-16*d^6*(a+b*x)^-2*(b*c+-1*a*d)^9+-1365//4*b^-16*d^4*(a+b*x)^-4*(b*c+-1*a*d)^11+-35//2*b^-16*d^2*(a+b*x)^-6*(b*c+-1*a*d)^13+-15//7*d*b^-16*(a+b*x)^-7*(b*c+-1*a*d)^14+5//2*b^-16*d^14*(a+b*x)^6*(b*c+-1*a*d)+455//4*b^-16*d^12*(a+b*x)^4*(b*c+-1*a*d)^3+3003//2*b^-16*d^10*(a+b*x)^2*(b*c+-1*a*d)^5)
@test integrate((a+b*x)^-10*(c+d*x)^15, x) == :(-1//9*b^-16*(a+b*x)^-9*(b*c+-1*a*d)^15+1//6*b^-16*d^15*(a+b*x)^6+-6435*b^-16*d^8*(a+b*x)^-1*(b*c+-1*a*d)^7+-273*b^-16*d^4*(a+b*x)^-5*(b*c+-1*a*d)^11+-15*b^-16*d^2*(a+b*x)^-7*(b*c+-1*a*d)^13+3*b^-16*d^14*(a+b*x)^5*(b*c+-1*a*d)+3003*x*b^-15*d^10*(b*c+-1*a*d)^5+5005*b^-16*d^9*(b*c+-1*a*d)^6*log(a+b*x)+-6435//2*b^-16*d^7*(a+b*x)^-2*(b*c+-1*a*d)^8+-5005//3*b^-16*d^6*(a+b*x)^-3*(b*c+-1*a*d)^9+-3003//4*b^-16*d^5*(a+b*x)^-4*(b*c+-1*a*d)^10+-455//6*b^-16*d^3*(a+b*x)^-6*(b*c+-1*a*d)^12+-15//8*d*b^-16*(a+b*x)^-8*(b*c+-1*a*d)^14+105//4*b^-16*d^13*(a+b*x)^4*(b*c+-1*a*d)^2+455//3*b^-16*d^12*(a+b*x)^3*(b*c+-1*a*d)^3+1365//2*b^-16*d^11*(a+b*x)^2*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^-11*(c+d*x)^15, x) == :(-1//10*b^-16*(a+b*x)^-10*(b*c+-1*a*d)^15+1//5*b^-16*d^15*(a+b*x)^5+-5005*b^-16*d^9*(a+b*x)^-1*(b*c+-1*a*d)^6+-2145*b^-16*d^7*(a+b*x)^-3*(b*c+-1*a*d)^8+-65*b^-16*d^3*(a+b*x)^-7*(b*c+-1*a*d)^12+35*b^-16*d^13*(a+b*x)^3*(b*c+-1*a*d)^2+1365*x*b^-15*d^11*(b*c+-1*a*d)^4+3003*b^-16*d^10*(b*c+-1*a*d)^5*log(a+b*x)+-6435//2*b^-16*d^8*(a+b*x)^-2*(b*c+-1*a*d)^7+-5005//4*b^-16*d^6*(a+b*x)^-4*(b*c+-1*a*d)^9+-3003//5*b^-16*d^5*(a+b*x)^-5*(b*c+-1*a*d)^10+-455//2*b^-16*d^4*(a+b*x)^-6*(b*c+-1*a*d)^11+-105//8*b^-16*d^2*(a+b*x)^-8*(b*c+-1*a*d)^13+-5//3*d*b^-16*(a+b*x)^-9*(b*c+-1*a*d)^14+15//4*b^-16*d^14*(a+b*x)^4*(b*c+-1*a*d)+455//2*b^-16*d^12*(a+b*x)^2*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^-12*(c+d*x)^15, x) == :(-1//11*b^-16*(a+b*x)^-11*(b*c+-1*a*d)^15+1//4*b^-16*d^15*(a+b*x)^4+-3003*b^-16*d^10*(a+b*x)^-1*(b*c+-1*a*d)^5+-2145*b^-16*d^8*(a+b*x)^-3*(b*c+-1*a*d)^7+-1001*b^-16*d^6*(a+b*x)^-5*(b*c+-1*a*d)^9+-195*b^-16*d^4*(a+b*x)^-7*(b*c+-1*a*d)^11+5*b^-16*d^14*(a+b*x)^3*(b*c+-1*a*d)+455*x*b^-15*d^12*(b*c+-1*a*d)^3+1365*b^-16*d^11*(b*c+-1*a*d)^4*log(a+b*x)+-6435//4*b^-16*d^7*(a+b*x)^-4*(b*c+-1*a*d)^8+-5005//2*b^-16*d^9*(a+b*x)^-2*(b*c+-1*a*d)^6+-1001//2*b^-16*d^5*(a+b*x)^-6*(b*c+-1*a*d)^10+-455//8*b^-16*d^3*(a+b*x)^-8*(b*c+-1*a*d)^12+-35//3*b^-16*d^2*(a+b*x)^-9*(b*c+-1*a*d)^13+-3//2*d*b^-16*(a+b*x)^-10*(b*c+-1*a*d)^14+105//2*b^-16*d^13*(a+b*x)^2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-13*(c+d*x)^15, x) == :(-1//12*b^-16*(a+b*x)^-12*(b*c+-1*a*d)^15+1//3*b^-16*d^15*(a+b*x)^3+-1365*b^-16*d^11*(a+b*x)^-1*(b*c+-1*a*d)^4+-1287*b^-16*d^7*(a+b*x)^-5*(b*c+-1*a*d)^8+-429*b^-16*d^5*(a+b*x)^-7*(b*c+-1*a*d)^10+105*x*b^-15*d^13*(b*c+-1*a*d)^2+455*b^-16*d^12*(b*c+-1*a*d)^3*log(a+b*x)+-6435//4*b^-16*d^8*(a+b*x)^-4*(b*c+-1*a*d)^7+-5005//3*b^-16*d^9*(a+b*x)^-3*(b*c+-1*a*d)^6+-5005//6*b^-16*d^6*(a+b*x)^-6*(b*c+-1*a*d)^9+-3003//2*b^-16*d^10*(a+b*x)^-2*(b*c+-1*a*d)^5+-1365//8*b^-16*d^4*(a+b*x)^-8*(b*c+-1*a*d)^11+-455//9*b^-16*d^3*(a+b*x)^-9*(b*c+-1*a*d)^12+-21//2*b^-16*d^2*(a+b*x)^-10*(b*c+-1*a*d)^13+-15//11*d*b^-16*(a+b*x)^-11*(b*c+-1*a*d)^14+15//2*b^-16*d^14*(a+b*x)^2*(b*c+-1*a*d))
@test integrate((a+b*x)^-14*(c+d*x)^15, x) == :((1/2)*b^-14*d^15*x^2+-1//13*b^-16*(a+b*x)^-13*(b*c+-1*a*d)^15+x*b^-15*d^14*(-14*a*d+15*b*c)+-1287*b^-16*d^8*(a+b*x)^-5*(b*c+-1*a*d)^7+-1001*b^-16*d^10*(a+b*x)^-3*(b*c+-1*a*d)^5+-715*b^-16*d^6*(a+b*x)^-7*(b*c+-1*a*d)^9+-455*b^-16*d^12*(a+b*x)^-1*(b*c+-1*a*d)^3+105*b^-16*d^13*(b*c+-1*a*d)^2*log(a+b*x)+-5005//4*b^-16*d^9*(a+b*x)^-4*(b*c+-1*a*d)^6+-3003//8*b^-16*d^5*(a+b*x)^-8*(b*c+-1*a*d)^10+-2145//2*b^-16*d^7*(a+b*x)^-6*(b*c+-1*a*d)^8+-1365//2*b^-16*d^11*(a+b*x)^-2*(b*c+-1*a*d)^4+-455//3*b^-16*d^4*(a+b*x)^-9*(b*c+-1*a*d)^11+-105//11*b^-16*d^2*(a+b*x)^-11*(b*c+-1*a*d)^13+-91//2*b^-16*d^3*(a+b*x)^-10*(b*c+-1*a*d)^12+-5//4*d*b^-16*(a+b*x)^-12*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^-15*(c+d*x)^15, x) == :(x*b^-15*d^15+-1//14*b^-16*(a+b*x)^-14*(b*c+-1*a*d)^15+-1001*b^-16*d^9*(a+b*x)^-5*(b*c+-1*a*d)^6+-455*b^-16*d^11*(a+b*x)^-3*(b*c+-1*a*d)^4+-105*b^-16*d^13*(a+b*x)^-1*(b*c+-1*a*d)^2+15*b^-16*d^14*(b*c+-1*a*d)*log(a+b*x)+-6435//7*b^-16*d^7*(a+b*x)^-7*(b*c+-1*a*d)^8+-5005//8*b^-16*d^6*(a+b*x)^-8*(b*c+-1*a*d)^9+-3003//4*b^-16*d^10*(a+b*x)^-4*(b*c+-1*a*d)^5+-2145//2*b^-16*d^8*(a+b*x)^-6*(b*c+-1*a*d)^7+-1001//3*b^-16*d^5*(a+b*x)^-9*(b*c+-1*a*d)^10+-455//2*b^-16*d^12*(a+b*x)^-2*(b*c+-1*a*d)^3+-455//11*b^-16*d^3*(a+b*x)^-11*(b*c+-1*a*d)^12+-273//2*b^-16*d^4*(a+b*x)^-10*(b*c+-1*a*d)^11+-35//4*b^-16*d^2*(a+b*x)^-12*(b*c+-1*a*d)^13+-15//13*d*b^-16*(a+b*x)^-13*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^-16*(c+d*x)^15, x) == :(b^-16*d^15*log(a+b*x)+-1//15*b^-16*(a+b*x)^-15*(b*c+-1*a*d)^15+-15*b^-16*d^14*(a+b*x)^-1*(b*c+-1*a*d)+-6435//7*b^-16*d^8*(a+b*x)^-7*(b*c+-1*a*d)^7+-6435//8*b^-16*d^7*(a+b*x)^-8*(b*c+-1*a*d)^8+-5005//6*b^-16*d^9*(a+b*x)^-6*(b*c+-1*a*d)^6+-5005//9*b^-16*d^6*(a+b*x)^-9*(b*c+-1*a*d)^9+-3003//5*b^-16*d^10*(a+b*x)^-5*(b*c+-1*a*d)^5+-3003//10*b^-16*d^5*(a+b*x)^-10*(b*c+-1*a*d)^10+-1365//4*b^-16*d^11*(a+b*x)^-4*(b*c+-1*a*d)^4+-1365//11*b^-16*d^4*(a+b*x)^-11*(b*c+-1*a*d)^11+-455//3*b^-16*d^12*(a+b*x)^-3*(b*c+-1*a*d)^3+-455//12*b^-16*d^3*(a+b*x)^-12*(b*c+-1*a*d)^12+-105//2*b^-16*d^13*(a+b*x)^-2*(b*c+-1*a*d)^2+-105//13*b^-16*d^2*(a+b*x)^-13*(b*c+-1*a*d)^13+-15//14*d*b^-16*(a+b*x)^-14*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^-17*(c+d*x)^15, x) == :(-1*(a+b*x)^-16*(c+d*x)^16*(-16*a*d+16*b*c)^-1)
@test integrate((a+b*x)^-18*(c+d*x)^15, x) == :(-1*(a+b*x)^-17*(c+d*x)^16*(-17*a*d+17*b*c)^-1+1//272*d*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-19*(c+d*x)^15, x) == :(-1*(a+b*x)^-18*(c+d*x)^16*(-18*a*d+18*b*c)^-1+-1//2448*d^2*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-3+1//153*d*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-20*(c+d*x)^15, x) == :(-1*(a+b*x)^-19*(c+d*x)^16*(-19*a*d+19*b*c)^-1+-1//969*d^2*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-3+1//114*d*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-2+1//15504*d^3*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-21*(c+d*x)^15, x) == :(-1*(a+b*x)^-20*(c+d*x)^16*(-20*a*d+20*b*c)^-1+-1//570*d^2*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-3+-1//77520*d^4*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-5+1//95*d*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-2+1//4845*d^3*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-22*(c+d*x)^15, x) == :(-1*(a+b*x)^-21*(c+d*x)^16*(-21*a*d+21*b*c)^-1+-1//399*d^2*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-3+-1//20349*d^4*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-5+1//84*d*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-2+1//2394*d^3*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-4+1//325584*d^5*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-6)
@test integrate((a+b*x)^-23*(c+d*x)^15, x) == :(-1*(a+b*x)^-22*(c+d*x)^16*(-22*a*d+22*b*c)^-1+-1//308*d^2*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-3+-1//8778*d^4*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-5+-1//1193808*d^6*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-7+1//77*d*(a+b*x)^-21*(c+d*x)^16*(b*c+-1*a*d)^-2+1//1463*d^3*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-4+1//74613*d^5*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-6)
@test integrate((a+b*x)^-24*(c+d*x)^15, x) == :(-1*(a+b*x)^-23*(c+d*x)^16*(-23*a*d+23*b*c)^-1+-1//253*d^2*(a+b*x)^-21*(c+d*x)^16*(b*c+-1*a*d)^-3+-1//4807*d^4*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-5+-1//245157*d^6*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-7+1//1012*d^3*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-4+1//28842*d^5*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-6+1//3922512*d^7*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-8+7//506*d*(a+b*x)^-22*(c+d*x)^16*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-25*(c+d*x)^15, x) == :(-1*(a+b*x)^-24*(c+d*x)^16*(-24*a*d+24*b*c)^-1+-7//1518*d^2*(a+b*x)^-22*(c+d*x)^16*(b*c+-1*a*d)^-3+-1//3036*d^4*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-5+-1//86526*d^6*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-7+-1//11767536*d^8*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-9+1//69*d*(a+b*x)^-23*(c+d*x)^16*(b*c+-1*a*d)^-2+1//759*d^3*(a+b*x)^-21*(c+d*x)^16*(b*c+-1*a*d)^-4+1//14421*d^5*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-6+1//735471*d^7*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-8)
@test integrate((a+b*x)^-26*(c+d*x)^15, x) == :(-1*(a+b*x)^-25*(c+d*x)^16*(-25*a*d+25*b*c)^-1+-3//575*d^2*(a+b*x)^-23*(c+d*x)^16*(b*c+-1*a*d)^-3+-3//6325*d^4*(a+b*x)^-21*(c+d*x)^16*(b*c+-1*a*d)^-5+-3//120175*d^6*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-7+-1//2042975*d^8*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-9+1//240350*d^7*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-8+1//32687600*d^9*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-10+3//200*d*(a+b*x)^-24*(c+d*x)^16*(b*c+-1*a*d)^-2+3//25300*d^5*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-6+21//12650*d^3*(a+b*x)^-22*(c+d*x)^16*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-27*(c+d*x)^15, x) == :(-1*(a+b*x)^-26*(c+d*x)^16*(-26*a*d+26*b*c)^-1+-21//32890*d^4*(a+b*x)^-22*(c+d*x)^16*(b*c+-1*a*d)^-5+-3//520*d^2*(a+b*x)^-24*(c+d*x)^16*(b*c+-1*a*d)^-3+-3//65780*d^6*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-7+-1//624910*d^8*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-9+-1//84987760*d^10*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-11+1//65*d*(a+b*x)^-25*(c+d*x)^16*(b*c+-1*a*d)^-2+1//5311735*d^9*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-10+3//1495*d^3*(a+b*x)^-23*(c+d*x)^16*(b*c+-1*a*d)^-4+3//16445*d^5*(a+b*x)^-21*(c+d*x)^16*(b*c+-1*a*d)^-6+3//312455*d^7*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-8)
@test integrate((a+b*x)^-28*(c+d*x)^15, x) == :(-1*(a+b*x)^-27*(c+d*x)^16*(-27*a*d+27*b*c)^-1+-11//1755*d^2*(a+b*x)^-25*(c+d*x)^16*(b*c+-1*a*d)^-3+-11//13455*d^4*(a+b*x)^-23*(c+d*x)^16*(b*c+-1*a*d)^-5+-1//13455*d^6*(a+b*x)^-21*(c+d*x)^16*(b*c+-1*a*d)^-7+-1//255645*d^8*(a+b*x)^-19*(c+d*x)^16*(b*c+-1*a*d)^-9+-1//13037895*d^10*(a+b*x)^-17*(c+d*x)^16*(b*c+-1*a*d)^-11+1//53820*d^7*(a+b*x)^-20*(c+d*x)^16*(b*c+-1*a*d)^-8+1//1533870*d^9*(a+b*x)^-18*(c+d*x)^16*(b*c+-1*a*d)^-10+1//208606320*d^11*(a+b*x)^-16*(c+d*x)^16*(b*c+-1*a*d)^-12+7//26910*d^5*(a+b*x)^-22*(c+d*x)^16*(b*c+-1*a*d)^-6+11//702*d*(a+b*x)^-26*(c+d*x)^16*(b*c+-1*a*d)^-2+11//4680*d^3*(a+b*x)^-24*(c+d*x)^16*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-29*(c+d*x)^15, x) == :(-1//13*b^-16*d^15*(a+b*x)^-13+-1//28*b^-16*(a+b*x)^-28*(b*c+-1*a*d)^15+-7*b^-16*d^13*(a+b*x)^-15*(b*c+-1*a*d)^2+-5005//19*b^-16*d^9*(a+b*x)^-19*(b*c+-1*a*d)^6+-3003//23*b^-16*d^5*(a+b*x)^-23*(b*c+-1*a*d)^10+-2145//7*b^-16*d^7*(a+b*x)^-21*(b*c+-1*a*d)^8+-1365//17*b^-16*d^11*(a+b*x)^-17*(b*c+-1*a*d)^4+-1287//4*b^-16*d^8*(a+b*x)^-20*(b*c+-1*a*d)^7+-1001//6*b^-16*d^10*(a+b*x)^-18*(b*c+-1*a*d)^5+-455//2*b^-16*d^6*(a+b*x)^-22*(b*c+-1*a*d)^9+-455//8*b^-16*d^4*(a+b*x)^-24*(b*c+-1*a*d)^11+-455//16*b^-16*d^12*(a+b*x)^-16*(b*c+-1*a*d)^3+-105//26*b^-16*d^2*(a+b*x)^-26*(b*c+-1*a*d)^13+-91//5*b^-16*d^3*(a+b*x)^-25*(b*c+-1*a*d)^12+-15//14*b^-16*d^14*(a+b*x)^-14*(b*c+-1*a*d)+-5//9*d*b^-16*(a+b*x)^-27*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^-30*(c+d*x)^15, x) == :(-1//14*b^-16*d^15*(a+b*x)^-14+-1//29*b^-16*(a+b*x)^-29*(b*c+-1*a*d)^15+-1*b^-16*d^14*(a+b*x)^-15*(b*c+-1*a*d)+-5005//23*b^-16*d^6*(a+b*x)^-23*(b*c+-1*a*d)^9+-3003//19*b^-16*d^10*(a+b*x)^-19*(b*c+-1*a*d)^5+-2145//7*b^-16*d^8*(a+b*x)^-21*(b*c+-1*a*d)^7+-1001//4*b^-16*d^9*(a+b*x)^-20*(b*c+-1*a*d)^6+-1001//8*b^-16*d^5*(a+b*x)^-24*(b*c+-1*a*d)^10+-585//2*b^-16*d^7*(a+b*x)^-22*(b*c+-1*a*d)^8+-455//6*b^-16*d^11*(a+b*x)^-18*(b*c+-1*a*d)^4+-455//17*b^-16*d^12*(a+b*x)^-17*(b*c+-1*a*d)^3+-273//5*b^-16*d^4*(a+b*x)^-25*(b*c+-1*a*d)^11+-105//16*b^-16*d^13*(a+b*x)^-16*(b*c+-1*a*d)^2+-35//2*b^-16*d^3*(a+b*x)^-26*(b*c+-1*a*d)^12+-35//9*b^-16*d^2*(a+b*x)^-27*(b*c+-1*a*d)^13+-15//28*d*b^-16*(a+b*x)^-28*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^-31*(c+d*x)^15, x) == :(-1//15*b^-16*d^15*(a+b*x)^-15+-1//30*b^-16*(a+b*x)^-30*(b*c+-1*a*d)^15+-6435//23*b^-16*d^7*(a+b*x)^-23*(b*c+-1*a*d)^8+-5005//24*b^-16*d^6*(a+b*x)^-24*(b*c+-1*a*d)^9+-3003//20*b^-16*d^10*(a+b*x)^-20*(b*c+-1*a*d)^5+-3003//25*b^-16*d^5*(a+b*x)^-25*(b*c+-1*a*d)^10+-1365//19*b^-16*d^11*(a+b*x)^-19*(b*c+-1*a*d)^4+-715//3*b^-16*d^9*(a+b*x)^-21*(b*c+-1*a*d)^6+-585//2*b^-16*d^8*(a+b*x)^-22*(b*c+-1*a*d)^7+-455//18*b^-16*d^12*(a+b*x)^-18*(b*c+-1*a*d)^3+-455//27*b^-16*d^3*(a+b*x)^-27*(b*c+-1*a*d)^12+-105//2*b^-16*d^4*(a+b*x)^-26*(b*c+-1*a*d)^11+-105//17*b^-16*d^13*(a+b*x)^-17*(b*c+-1*a*d)^2+-15//4*b^-16*d^2*(a+b*x)^-28*(b*c+-1*a*d)^13+-15//16*b^-16*d^14*(a+b*x)^-16*(b*c+-1*a*d)+-15//29*d*b^-16*(a+b*x)^-29*(b*c+-1*a*d)^14)
@test integrate((a+b*x)^5*(c+d*x)^-1, x) == :(1//5*d^-1*(a+b*x)^5+-1*d^-6*(b*c+-1*a*d)^5*log(c+d*x)+-1//2*d^-4*(a+b*x)^2*(b*c+-1*a*d)^3+-1//4*d^-2*(a+b*x)^4*(b*c+-1*a*d)+1//3*d^-3*(a+b*x)^3*(b*c+-1*a*d)^2+b*x*d^-5*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^4*(c+d*x)^-1, x) == :(1//4*d^-1*(a+b*x)^4+d^-5*(b*c+-1*a*d)^4*log(c+d*x)+(1/2)*d^-3*(a+b*x)^2*(b*c+-1*a*d)^2+-1//3*d^-2*(a+b*x)^3*(b*c+-1*a*d)+-1*b*x*d^-4*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^3*(c+d*x)^-1, x) == :(1//3*d^-1*(a+b*x)^3+-1*d^-4*(b*c+-1*a*d)^3*log(c+d*x)+-1//2*d^-2*(a+b*x)^2*(b*c+-1*a*d)+b*x*d^-3*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^-1, x) == :((1/2)*d^-1*(a+b*x)^2+d^-3*(b*c+-1*a*d)^2*log(c+d*x)+-1*b*x*d^-2*(b*c+-1*a*d))
@test integrate((c+d*x)^-1*(a+b*x), x) == :(b*x*d^-1+-1*d^-2*(b*c+-1*a*d)*log(c+d*x))
@test integrate((c+d*x)^-1, x) == :(d^-1*log(c+d*x))
@test integrate((a+b*x)^-1*(c+d*x)^-1, x) == :((b*c+-1*a*d)^-1*log(a+b*x)+-1*(b*c+-1*a*d)^-1*log(c+d*x))
@test integrate((a+b*x)^-2*(c+d*x)^-1, x) == :(-1*(a+b*x)^-1*(b*c+-1*a*d)^-1+d*(b*c+-1*a*d)^-2*log(c+d*x)+-1*d*(b*c+-1*a*d)^-2*log(a+b*x))
@test integrate((a+b*x)^-3*(c+d*x)^-1, x) == :(-1*(a+b*x)^-2*(-2*a*d+2*b*c)^-1+d*(a+b*x)^-1*(b*c+-1*a*d)^-2+d^2*(b*c+-1*a*d)^-3*log(a+b*x)+-1*d^2*(b*c+-1*a*d)^-3*log(c+d*x))
@test integrate((a+b*x)^5*(c+d*x)^-2, x) == :(d^-6*(c+d*x)^-1*(b*c+-1*a*d)^5+1//4*b^5*d^-6*(c+d*x)^4+-10*x*b^2*d^-5*(b*c+-1*a*d)^3+5*b*d^-6*(b*c+-1*a*d)^4*log(c+d*x)+5*b^3*d^-6*(c+d*x)^2*(b*c+-1*a*d)^2+-5//3*b^4*d^-6*(c+d*x)^3*(b*c+-1*a*d))
@test integrate((a+b*x)^4*(c+d*x)^-2, x) == :(-1*d^-5*(c+d*x)^-1*(b*c+-1*a*d)^4+1//3*b^4*d^-5*(c+d*x)^3+-4*b*d^-5*(b*c+-1*a*d)^3*log(c+d*x)+-2*b^3*d^-5*(c+d*x)^2*(b*c+-1*a*d)+6*x*b^2*d^-4*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^-2, x) == :(d^-4*(c+d*x)^-1*(b*c+-1*a*d)^3+(1/2)*b^3*d^-2*x^2+-1*x*b^2*d^-3*(-3*a*d+2*b*c)+3*b*d^-4*(b*c+-1*a*d)^2*log(c+d*x))
@test integrate((a+b*x)^2*(c+d*x)^-2, x) == :(x*b^2*d^-2+-1*d^-3*(c+d*x)^-1*(b*c+-1*a*d)^2+-2*b*d^-3*(b*c+-1*a*d)*log(c+d*x))
@test integrate((c+d*x)^-2*(a+b*x), x) == :(b*d^-2*log(c+d*x)+d^-2*(c+d*x)^-1*(b*c+-1*a*d))
@test integrate((c+d*x)^-2, x) == :(-1*d^-1*(c+d*x)^-1)
@test integrate((a+b*x)^-1*(c+d*x)^-2, x) == :((c+d*x)^-1*(b*c+-1*a*d)^-1+b*(b*c+-1*a*d)^-2*log(a+b*x)+-1*b*(b*c+-1*a*d)^-2*log(c+d*x))
@test integrate((a+b*x)^-2*(c+d*x)^-2, x) == :(-1*b*(a+b*x)^-1*(b*c+-1*a*d)^-2+-1*d*(c+d*x)^-1*(b*c+-1*a*d)^-2+-2*b*d*(b*c+-1*a*d)^-3*log(a+b*x)+2*b*d*(b*c+-1*a*d)^-3*log(c+d*x))
@test integrate((a+b*x)^-3*(c+d*x)^-2, x) == :(d^2*(c+d*x)^-1*(b*c+-1*a*d)^-3+-1//2*b*(a+b*x)^-2*(b*c+-1*a*d)^-2+-3*b*d^2*(b*c+-1*a*d)^-4*log(c+d*x)+2*b*d*(a+b*x)^-1*(b*c+-1*a*d)^-3+3*b*d^2*(b*c+-1*a*d)^-4*log(a+b*x))
@test integrate((a+b*x)^6*(c+d*x)^-3, x) == :(-1//2*d^-7*(c+d*x)^-2*(b*c+-1*a*d)^6+1//4*b^6*d^-7*(c+d*x)^4+-20*x*b^3*d^-6*(b*c+-1*a*d)^3+-2*b^5*d^-7*(c+d*x)^3*(b*c+-1*a*d)+6*b*d^-7*(c+d*x)^-1*(b*c+-1*a*d)^5+15*b^2*d^-7*(b*c+-1*a*d)^4*log(c+d*x)+15//2*b^4*d^-7*(c+d*x)^2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^5*(c+d*x)^-3, x) == :((1/2)*d^-6*(c+d*x)^-2*(b*c+-1*a*d)^5+1//3*b^5*d^-6*(c+d*x)^3+-10*b^2*d^-6*(b*c+-1*a*d)^3*log(c+d*x)+-5*b*d^-6*(c+d*x)^-1*(b*c+-1*a*d)^4+10*x*b^3*d^-5*(b*c+-1*a*d)^2+-5//2*b^4*d^-6*(c+d*x)^2*(b*c+-1*a*d))
@test integrate((a+b*x)^4*(c+d*x)^-3, x) == :((1/2)*b^4*d^-3*x^2+-1//2*d^-5*(c+d*x)^-2*(b*c+-1*a*d)^4+-1*x*b^3*d^-4*(-4*a*d+3*b*c)+4*b*d^-5*(c+d*x)^-1*(b*c+-1*a*d)^3+6*b^2*d^-5*(b*c+-1*a*d)^2*log(c+d*x))
@test integrate((a+b*x)^3*(c+d*x)^-3, x) == :(x*b^3*d^-3+(1/2)*d^-4*(c+d*x)^-2*(b*c+-1*a*d)^3+-3*b*d^-4*(c+d*x)^-1*(b*c+-1*a*d)^2+-3*b^2*d^-4*(b*c+-1*a*d)*log(c+d*x))
@test integrate((a+b*x)^2*(c+d*x)^-3, x) == :(b^2*d^-3*log(c+d*x)+-1//2*d^-3*(c+d*x)^-2*(b*c+-1*a*d)^2+2*b*d^-3*(c+d*x)^-1*(b*c+-1*a*d))
@test integrate((c+d*x)^-3*(a+b*x), x) == :((a+b*x)^2*(c+d*x)^-2*(-2*a*d+2*b*c)^-1)
@test integrate((c+d*x)^-3, x) == :(-1//2*d^-1*(c+d*x)^-2)
@test integrate((a+b*x)^-1*(c+d*x)^-3, x) == :((c+d*x)^-2*(-2*a*d+2*b*c)^-1+b*(c+d*x)^-1*(b*c+-1*a*d)^-2+b^2*(b*c+-1*a*d)^-3*log(a+b*x)+-1*b^2*(b*c+-1*a*d)^-3*log(c+d*x))
@test integrate((a+b*x)^-2*(c+d*x)^-3, x) == :(-1*b^2*(a+b*x)^-1*(b*c+-1*a*d)^-3+-1//2*d*(c+d*x)^-2*(b*c+-1*a*d)^-2+-3*d*b^2*(b*c+-1*a*d)^-4*log(a+b*x)+-2*b*d*(c+d*x)^-1*(b*c+-1*a*d)^-3+3*d*b^2*(b*c+-1*a*d)^-4*log(c+d*x))
@test integrate((a+b*x)^-3*(c+d*x)^-3, x) == :((1/2)*d^2*(c+d*x)^-2*(b*c+-1*a*d)^-3+-1//2*b^2*(a+b*x)^-2*(b*c+-1*a*d)^-3+-6*b^2*d^2*(b*c+-1*a*d)^-5*log(c+d*x)+3*b*d^2*(c+d*x)^-1*(b*c+-1*a*d)^-4+3*d*b^2*(a+b*x)^-1*(b*c+-1*a*d)^-4+6*b^2*d^2*(b*c+-1*a*d)^-5*log(a+b*x))
@test integrate((a+b*x)^9*(c+d*x)^-8, x) == :((1/2)*b^9*d^-8*x^2+1//7*d^-10*(c+d*x)^-7*(b*c+-1*a*d)^9+-1*x*b^8*d^-9*(-9*a*d+8*b*c)+-63*b^5*d^-10*(c+d*x)^-2*(b*c+-1*a*d)^4+-21*b^3*d^-10*(c+d*x)^-4*(b*c+-1*a*d)^6+36*b^7*d^-10*(b*c+-1*a*d)^2*log(c+d*x)+42*b^4*d^-10*(c+d*x)^-3*(b*c+-1*a*d)^5+84*b^6*d^-10*(c+d*x)^-1*(b*c+-1*a*d)^3+-3//2*b*d^-10*(c+d*x)^-6*(b*c+-1*a*d)^8+36//5*b^2*d^-10*(c+d*x)^-5*(b*c+-1*a*d)^7)
@test integrate((a+b*x)^8*(c+d*x)^-8, x) == :(x*b^8*d^-8+-1//7*d^-9*(c+d*x)^-7*(b*c+-1*a*d)^8+-28*b^6*d^-9*(c+d*x)^-1*(b*c+-1*a*d)^2+-8*b^7*d^-9*(b*c+-1*a*d)*log(c+d*x)+14*b^3*d^-9*(c+d*x)^-4*(b*c+-1*a*d)^5+28*b^5*d^-9*(c+d*x)^-2*(b*c+-1*a*d)^3+-70//3*b^4*d^-9*(c+d*x)^-3*(b*c+-1*a*d)^4+-28//5*b^2*d^-9*(c+d*x)^-5*(b*c+-1*a*d)^6+4//3*b*d^-9*(c+d*x)^-6*(b*c+-1*a*d)^7)
@test integrate((a+b*x)^7*(c+d*x)^-8, x) == :(b^7*d^-8*log(c+d*x)+1//7*d^-8*(c+d*x)^-7*(b*c+-1*a*d)^7+7*b^6*d^-8*(c+d*x)^-1*(b*c+-1*a*d)+-35//4*b^3*d^-8*(c+d*x)^-4*(b*c+-1*a*d)^4+-21//2*b^5*d^-8*(c+d*x)^-2*(b*c+-1*a*d)^2+-7//6*b*d^-8*(c+d*x)^-6*(b*c+-1*a*d)^6+21//5*b^2*d^-8*(c+d*x)^-5*(b*c+-1*a*d)^5+35//3*b^4*d^-8*(c+d*x)^-3*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^6*(c+d*x)^-8, x) == :((a+b*x)^7*(c+d*x)^-7*(-7*a*d+7*b*c)^-1)
@test integrate((a+b*x)^5*(c+d*x)^-8, x) == :((a+b*x)^6*(c+d*x)^-7*(-7*a*d+7*b*c)^-1+1//42*b*(a+b*x)^6*(c+d*x)^-6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^4*(c+d*x)^-8, x) == :((a+b*x)^5*(c+d*x)^-7*(-7*a*d+7*b*c)^-1+1//21*b*(a+b*x)^5*(c+d*x)^-6*(b*c+-1*a*d)^-2+1//105*b^2*(a+b*x)^5*(c+d*x)^-5*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^3*(c+d*x)^-8, x) == :(-1//4*b^3*d^-4*(c+d*x)^-4+1//7*d^-4*(c+d*x)^-7*(b*c+-1*a*d)^3+-1//2*b*d^-4*(c+d*x)^-6*(b*c+-1*a*d)^2+3//5*b^2*d^-4*(c+d*x)^-5*(b*c+-1*a*d))
@test integrate((a+b*x)^2*(c+d*x)^-8, x) == :(-1//5*b^2*d^-3*(c+d*x)^-5+-1//7*d^-3*(c+d*x)^-7*(b*c+-1*a*d)^2+1//3*b*d^-3*(c+d*x)^-6*(b*c+-1*a*d))
@test integrate((c+d*x)^-8*(a+b*x), x) == :(-1//6*b*d^-2*(c+d*x)^-6+1//7*d^-2*(c+d*x)^-7*(b*c+-1*a*d))
@test integrate((c+d*x)^-8, x) == :(-1//7*d^-1*(c+d*x)^-7)
@test integrate((a+b*x)^-1*(c+d*x)^-8, x) == :((c+d*x)^-7*(-7*a*d+7*b*c)^-1+b^6*(c+d*x)^-1*(b*c+-1*a*d)^-7+b^7*(b*c+-1*a*d)^-8*log(a+b*x)+(1/2)*b^5*(c+d*x)^-2*(b*c+-1*a*d)^-6+-1*b^7*(b*c+-1*a*d)^-8*log(c+d*x)+1//3*b^4*(c+d*x)^-3*(b*c+-1*a*d)^-5+1//4*b^3*(c+d*x)^-4*(b*c+-1*a*d)^-4+1//5*b^2*(c+d*x)^-5*(b*c+-1*a*d)^-3+1//6*b*(c+d*x)^-6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-2*(c+d*x)^-8, x) == :(-1*b^7*(a+b*x)^-1*(b*c+-1*a*d)^-8+-1//7*d*(c+d*x)^-7*(b*c+-1*a*d)^-2+-1*d*b^3*(c+d*x)^-4*(b*c+-1*a*d)^-5+-8*d*b^7*(b*c+-1*a*d)^-9*log(a+b*x)+-7*d*b^6*(c+d*x)^-1*(b*c+-1*a*d)^-8+-3*d*b^5*(c+d*x)^-2*(b*c+-1*a*d)^-7+8*d*b^7*(b*c+-1*a*d)^-9*log(c+d*x)+-5//3*d*b^4*(c+d*x)^-3*(b*c+-1*a*d)^-6+-3//5*d*b^2*(c+d*x)^-5*(b*c+-1*a*d)^-4+-1//3*b*d*(c+d*x)^-6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-3*(c+d*x)^-8, x) == :(-1//2*b^7*(a+b*x)^-2*(b*c+-1*a*d)^-8+1//7*d^2*(c+d*x)^-7*(b*c+-1*a*d)^-3+(1/2)*b*d^2*(c+d*x)^-6*(b*c+-1*a*d)^-4+-36*b^7*d^2*(b*c+-1*a*d)^-10*log(c+d*x)+5*b^4*d^2*(c+d*x)^-3*(b*c+-1*a*d)^-7+8*d*b^7*(a+b*x)^-1*(b*c+-1*a*d)^-9+28*b^6*d^2*(c+d*x)^-1*(b*c+-1*a*d)^-9+36*b^7*d^2*(b*c+-1*a*d)^-10*log(a+b*x)+5//2*b^3*d^2*(c+d*x)^-4*(b*c+-1*a*d)^-6+6//5*b^2*d^2*(c+d*x)^-5*(b*c+-1*a*d)^-5+21//2*b^5*d^2*(c+d*x)^-2*(b*c+-1*a*d)^-8)
@test integrate((a+b*x)^5*(c+d*x)^(1/2), x) == :(-2//3*d^-6*(c+d*x)^3//2*(b*c+-1*a*d)^5+2//13*b^5*d^-6*(c+d*x)^13//2+2*b*d^-6*(c+d*x)^5//2*(b*c+-1*a*d)^4+-20//7*b^2*d^-6*(c+d*x)^7//2*(b*c+-1*a*d)^3+-10//11*b^4*d^-6*(c+d*x)^11//2*(b*c+-1*a*d)+20//9*b^3*d^-6*(c+d*x)^9//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^(1/2), x) == :(2//3*d^-5*(c+d*x)^3//2*(b*c+-1*a*d)^4+2//11*b^4*d^-5*(c+d*x)^11//2+-8//5*b*d^-5*(c+d*x)^5//2*(b*c+-1*a*d)^3+-8//9*b^3*d^-5*(c+d*x)^9//2*(b*c+-1*a*d)+12//7*b^2*d^-5*(c+d*x)^7//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^(1/2), x) == :(-2//3*d^-4*(c+d*x)^3//2*(b*c+-1*a*d)^3+2//9*b^3*d^-4*(c+d*x)^9//2+-6//7*b^2*d^-4*(c+d*x)^7//2*(b*c+-1*a*d)+6//5*b*d^-4*(c+d*x)^5//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^(1/2), x) == :(2//3*d^-3*(c+d*x)^3//2*(b*c+-1*a*d)^2+2//7*b^2*d^-3*(c+d*x)^7//2+-4//5*b*d^-3*(c+d*x)^5//2*(b*c+-1*a*d))
@test integrate((c+d*x)^(1/2)*(a+b*x), x) == :(-1//3*d^-2*(c+d*x)^3//2*(-2*a*d+2*b*c)+2//5*b*d^-2*(c+d*x)^5//2)
@test integrate((c+d*x)^(1/2), x) == :(2//3*d^-1*(c+d*x)^3//2)
@test integrate((a+b*x)^-1*(c+d*x)^(1/2), x) == :(2*b^-1*(c+d*x)^(1/2)+-2*b^-3//2*(b*c+-1*a*d)^(1/2)*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-2*(c+d*x)^(1/2), x) == :(-1*b^-1*(a+b*x)^-1*(c+d*x)^(1/2)+-1*d*b^-3//2*(b*c+-1*a*d)^-1//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-3*(c+d*x)^(1/2), x) == :(-1//2*b^-1*(a+b*x)^-2*(c+d*x)^(1/2)+1//4*b^-3//2*d^2*(b*c+-1*a*d)^-3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-1//4*d*b^-1*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-4*(c+d*x)^(1/2), x) == :(-1//3*b^-1*(a+b*x)^-3*(c+d*x)^(1/2)+-1//8*b^-3//2*d^3*(b*c+-1*a*d)^-5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-1//12*d*b^-1*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+1//8*b^-1*d^2*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-5*(c+d*x)^(1/2), x) == :(-1//4*b^-1*(a+b*x)^-4*(c+d*x)^(1/2)+5//64*b^-3//2*d^4*(b*c+-1*a*d)^-7//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-5//64*b^-1*d^3*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+-1//24*d*b^-1*(a+b*x)^-3*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+5//96*b^-1*d^2*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-6*(c+d*x)^(1/2), x) == :(-1//5*b^-1*(a+b*x)^-5*(c+d*x)^(1/2)+-7//128*b^-3//2*d^5*(b*c+-1*a*d)^-9//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-7//192*b^-1*d^3*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+-1//40*d*b^-1*(a+b*x)^-4*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+7//128*b^-1*d^4*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-4+7//240*b^-1*d^2*(a+b*x)^-3*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^5*(c+d*x)^3//2, x) == :(-2//5*d^-6*(c+d*x)^5//2*(b*c+-1*a*d)^5+2//15*b^5*d^-6*(c+d*x)^15//2+-20//9*b^2*d^-6*(c+d*x)^9//2*(b*c+-1*a*d)^3+-10//13*b^4*d^-6*(c+d*x)^13//2*(b*c+-1*a*d)+10//7*b*d^-6*(c+d*x)^7//2*(b*c+-1*a*d)^4+20//11*b^3*d^-6*(c+d*x)^11//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^3//2, x) == :(2//5*d^-5*(c+d*x)^5//2*(b*c+-1*a*d)^4+2//13*b^4*d^-5*(c+d*x)^13//2+-8//7*b*d^-5*(c+d*x)^7//2*(b*c+-1*a*d)^3+-8//11*b^3*d^-5*(c+d*x)^11//2*(b*c+-1*a*d)+4//3*b^2*d^-5*(c+d*x)^9//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^3//2, x) == :(-2//5*d^-4*(c+d*x)^5//2*(b*c+-1*a*d)^3+2//11*b^3*d^-4*(c+d*x)^11//2+-2//3*b^2*d^-4*(c+d*x)^9//2*(b*c+-1*a*d)+6//7*b*d^-4*(c+d*x)^7//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^3//2, x) == :(2//5*d^-3*(c+d*x)^5//2*(b*c+-1*a*d)^2+2//9*b^2*d^-3*(c+d*x)^9//2+-4//7*b*d^-3*(c+d*x)^7//2*(b*c+-1*a*d))
@test integrate((c+d*x)^3//2*(a+b*x), x) == :(-1//5*d^-2*(c+d*x)^5//2*(-2*a*d+2*b*c)+2//7*b*d^-2*(c+d*x)^7//2)
@test integrate((c+d*x)^3//2, x) == :(2//5*d^-1*(c+d*x)^5//2)
@test integrate((a+b*x)^-1*(c+d*x)^3//2, x) == :(2//3*b^-1*(c+d*x)^3//2+b^-2*(c+d*x)^(1/2)*(-2*a*d+2*b*c)+-2*b^-5//2*(b*c+-1*a*d)^3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-2*(c+d*x)^3//2, x) == :(-1*b^-1*(a+b*x)^-1*(c+d*x)^3//2+3*d*b^-2*(c+d*x)^(1/2)+-3*d*b^-5//2*(b*c+-1*a*d)^(1/2)*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-3*(c+d*x)^3//2, x) == :(-1//2*b^-1*(a+b*x)^-2*(c+d*x)^3//2+-3//4*d*b^-2*(a+b*x)^-1*(c+d*x)^(1/2)+-3//4*b^-5//2*d^2*(b*c+-1*a*d)^-1//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-4*(c+d*x)^3//2, x) == :(-1//3*b^-1*(a+b*x)^-3*(c+d*x)^3//2+-1//4*d*b^-2*(a+b*x)^-2*(c+d*x)^(1/2)+1//8*b^-5//2*d^3*(b*c+-1*a*d)^-3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-1//8*b^-2*d^2*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-5*(c+d*x)^3//2, x) == :(-1//4*b^-1*(a+b*x)^-4*(c+d*x)^3//2+-3//64*b^-5//2*d^4*(b*c+-1*a*d)^-5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-1//8*d*b^-2*(a+b*x)^-3*(c+d*x)^(1/2)+-1//32*b^-2*d^2*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+3//64*b^-2*d^3*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-6*(c+d*x)^3//2, x) == :(-1//5*b^-1*(a+b*x)^-5*(c+d*x)^3//2+-3//40*d*b^-2*(a+b*x)^-4*(c+d*x)^(1/2)+3//128*b^-5//2*d^5*(b*c+-1*a*d)^-7//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-3//128*b^-2*d^4*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+-1//80*b^-2*d^2*(a+b*x)^-3*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+1//64*b^-2*d^3*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^5*(c+d*x)^5//2, x) == :(-2//7*d^-6*(c+d*x)^7//2*(b*c+-1*a*d)^5+2//17*b^5*d^-6*(c+d*x)^17//2+-20//11*b^2*d^-6*(c+d*x)^11//2*(b*c+-1*a*d)^3+-2//3*b^4*d^-6*(c+d*x)^15//2*(b*c+-1*a*d)+10//9*b*d^-6*(c+d*x)^9//2*(b*c+-1*a*d)^4+20//13*b^3*d^-6*(c+d*x)^13//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^5//2, x) == :(2//7*d^-5*(c+d*x)^7//2*(b*c+-1*a*d)^4+2//15*b^4*d^-5*(c+d*x)^15//2+-8//9*b*d^-5*(c+d*x)^9//2*(b*c+-1*a*d)^3+-8//13*b^3*d^-5*(c+d*x)^13//2*(b*c+-1*a*d)+12//11*b^2*d^-5*(c+d*x)^11//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^5//2, x) == :(-2//7*d^-4*(c+d*x)^7//2*(b*c+-1*a*d)^3+2//13*b^3*d^-4*(c+d*x)^13//2+-6//11*b^2*d^-4*(c+d*x)^11//2*(b*c+-1*a*d)+2//3*b*d^-4*(c+d*x)^9//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^5//2, x) == :(2//7*d^-3*(c+d*x)^7//2*(b*c+-1*a*d)^2+2//11*b^2*d^-3*(c+d*x)^11//2+-4//9*b*d^-3*(c+d*x)^9//2*(b*c+-1*a*d))
@test integrate((c+d*x)^5//2*(a+b*x), x) == :(-1//7*d^-2*(c+d*x)^7//2*(-2*a*d+2*b*c)+2//9*b*d^-2*(c+d*x)^9//2)
@test integrate((c+d*x)^5//2, x) == :(2//7*d^-1*(c+d*x)^7//2)
@test integrate((a+b*x)^-1*(c+d*x)^5//2, x) == :(2//5*b^-1*(c+d*x)^5//2+-2*b^-7//2*(b*c+-1*a*d)^5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+2*b^-3*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+1//3*b^-2*(c+d*x)^3//2*(-2*a*d+2*b*c))
@test integrate((a+b*x)^-2*(c+d*x)^5//2, x) == :(-1*b^-1*(a+b*x)^-1*(c+d*x)^5//2+5//3*d*b^-2*(c+d*x)^3//2+-5*d*b^-7//2*(b*c+-1*a*d)^3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+5*d*b^-3*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^-3*(c+d*x)^5//2, x) == :(-1//2*b^-1*(a+b*x)^-2*(c+d*x)^5//2+15//4*b^-3*d^2*(c+d*x)^(1/2)+-15//4*b^-7//2*d^2*(b*c+-1*a*d)^(1/2)*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-5//4*d*b^-2*(a+b*x)^-1*(c+d*x)^3//2)
@test integrate((a+b*x)^-4*(c+d*x)^5//2, x) == :(-1//3*b^-1*(a+b*x)^-3*(c+d*x)^5//2+-5//8*b^-3*d^2*(a+b*x)^-1*(c+d*x)^(1/2)+-5//8*b^-7//2*d^3*(b*c+-1*a*d)^-1//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-5//12*d*b^-2*(a+b*x)^-2*(c+d*x)^3//2)
@test integrate((a+b*x)^-5*(c+d*x)^5//2, x) == :(-1//4*b^-1*(a+b*x)^-4*(c+d*x)^5//2+-5//24*d*b^-2*(a+b*x)^-3*(c+d*x)^3//2+-5//32*b^-3*d^2*(a+b*x)^-2*(c+d*x)^(1/2)+5//64*b^-7//2*d^4*(b*c+-1*a*d)^-3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-5//64*b^-3*d^3*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-6*(c+d*x)^5//2, x) == :(-1//5*b^-1*(a+b*x)^-5*(c+d*x)^5//2+-3//128*b^-7//2*d^5*(b*c+-1*a*d)^-5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-1//8*d*b^-2*(a+b*x)^-4*(c+d*x)^3//2+-1//16*b^-3*d^2*(a+b*x)^-3*(c+d*x)^(1/2)+-1//64*b^-3*d^3*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+3//128*b^-3*d^4*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((1+x)^-2*(-1+x)^(1/2), x) == :((1/2)*2^(1/2)*arctan((1/2)*2^(1/2)*(-1+x)^(1/2))+-1*(1+x)^-1*(-1+x)^(1/2))
@test integrate((1+x)^-3*(-1+x)^(1/2), x) == :((-1+x)^(1/2)*(8+8x)^-1+-1//2*(1+x)^-2*(-1+x)^(1/2)+1//16*2^(1/2)*arctan((1/2)*2^(1/2)*(-1+x)^(1/2)))
@test integrate((a+b*x)^5*(c+d*x)^-1//2, x) == :(-2*d^-6*(c+d*x)^(1/2)*(b*c+-1*a*d)^5+2//11*b^5*d^-6*(c+d*x)^11//2+-4*b^2*d^-6*(c+d*x)^5//2*(b*c+-1*a*d)^3+-10//9*b^4*d^-6*(c+d*x)^9//2*(b*c+-1*a*d)+10//3*b*d^-6*(c+d*x)^3//2*(b*c+-1*a*d)^4+20//7*b^3*d^-6*(c+d*x)^7//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^-1//2, x) == :(2*d^-5*(c+d*x)^(1/2)*(b*c+-1*a*d)^4+2//9*b^4*d^-5*(c+d*x)^9//2+-8//3*b*d^-5*(c+d*x)^3//2*(b*c+-1*a*d)^3+-8//7*b^3*d^-5*(c+d*x)^7//2*(b*c+-1*a*d)+12//5*b^2*d^-5*(c+d*x)^5//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3*(c+d*x)^-1//2, x) == :(-2*d^-4*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+2//7*b^3*d^-4*(c+d*x)^7//2+2*b*d^-4*(c+d*x)^3//2*(b*c+-1*a*d)^2+-6//5*b^2*d^-4*(c+d*x)^5//2*(b*c+-1*a*d))
@test integrate((a+b*x)^2*(c+d*x)^-1//2, x) == :(2*d^-3*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+2//5*b^2*d^-3*(c+d*x)^5//2+-4//3*b*d^-3*(c+d*x)^3//2*(b*c+-1*a*d))
@test integrate((c+d*x)^-1//2*(a+b*x), x) == :(-1*d^-2*(c+d*x)^(1/2)*(-2*a*d+2*b*c)+2//3*b*d^-2*(c+d*x)^3//2)
@test integrate((c+d*x)^-1//2, x) == :(2*d^-1*(c+d*x)^(1/2))
@test integrate((a+b*x)^-1*(c+d*x)^-1//2, x) == :(-2*b^-1//2*(b*c+-1*a*d)^-1//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-2*(c+d*x)^-1//2, x) == :(-1*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1+d*b^-1//2*(b*c+-1*a*d)^-3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-3*(c+d*x)^-1//2, x) == :(-1*(a+b*x)^-2*(c+d*x)^(1/2)*(-2*a*d+2*b*c)^-1+-3//4*b^-1//2*d^2*(b*c+-1*a*d)^-5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+3//4*d*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-4*(c+d*x)^-1//2, x) == :(-1*(a+b*x)^-3*(c+d*x)^(1/2)*(-3*a*d+3*b*c)^-1+-5//8*d^2*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+5//8*b^-1//2*d^3*(b*c+-1*a*d)^-7//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+5//12*d*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-5*(c+d*x)^-1//2, x) == :(-1*(a+b*x)^-4*(c+d*x)^(1/2)*(-4*a*d+4*b*c)^-1+-35//64*b^-1//2*d^4*(b*c+-1*a*d)^-9//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+-35//96*d^2*(a+b*x)^-2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+7//24*d*(a+b*x)^-3*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2+35//64*d^3*(a+b*x)^-1*(c+d*x)^(1/2)*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^5*(c+d*x)^-3//2, x) == :(2*d^-6*(c+d*x)^-1//2*(b*c+-1*a*d)^5+2//9*b^5*d^-6*(c+d*x)^9//2+4*b^3*d^-6*(c+d*x)^5//2*(b*c+-1*a*d)^2+10*b*d^-6*(c+d*x)^(1/2)*(b*c+-1*a*d)^4+-20//3*b^2*d^-6*(c+d*x)^3//2*(b*c+-1*a*d)^3+-10//7*b^4*d^-6*(c+d*x)^7//2*(b*c+-1*a*d))
@test integrate((a+b*x)^4*(c+d*x)^-3//2, x) == :(-2*d^-5*(c+d*x)^-1//2*(b*c+-1*a*d)^4+2//7*b^4*d^-5*(c+d*x)^7//2+-8*b*d^-5*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+4*b^2*d^-5*(c+d*x)^3//2*(b*c+-1*a*d)^2+-8//5*b^3*d^-5*(c+d*x)^5//2*(b*c+-1*a*d))
@test integrate((a+b*x)^3*(c+d*x)^-3//2, x) == :(2*d^-4*(c+d*x)^-1//2*(b*c+-1*a*d)^3+2//5*b^3*d^-4*(c+d*x)^5//2+-2*b^2*d^-4*(c+d*x)^3//2*(b*c+-1*a*d)+6*b*d^-4*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^-3//2, x) == :(-2*d^-3*(c+d*x)^-1//2*(b*c+-1*a*d)^2+2//3*b^2*d^-3*(c+d*x)^3//2+-4*b*d^-3*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((c+d*x)^-3//2*(a+b*x), x) == :(d^-2*(c+d*x)^-1//2*(-2*a*d+2*b*c)+2*b*d^-2*(c+d*x)^(1/2))
@test integrate((c+d*x)^-3//2, x) == :(-2*d^-1*(c+d*x)^-1//2)
@test integrate((a+b*x)^-1*(c+d*x)^-3//2, x) == :(2*(c+d*x)^-1//2*(b*c+-1*a*d)^-1+-2*b^(1/2)*(b*c+-1*a*d)^-3//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-2*(c+d*x)^-3//2, x) == :(-1*(a+b*x)^-1*(c+d*x)^-1//2*(b*c+-1*a*d)^-1+-3*d*(c+d*x)^-1//2*(b*c+-1*a*d)^-2+3*d*b^(1/2)*(b*c+-1*a*d)^-5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-3*(c+d*x)^-3//2, x) == :(-1*(a+b*x)^-2*(c+d*x)^-1//2*(-2*a*d+2*b*c)^-1+15//4*d^2*(c+d*x)^-1//2*(b*c+-1*a*d)^-3+-15//4*b^(1/2)*d^2*(b*c+-1*a*d)^-7//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+5//4*d*(a+b*x)^-1*(c+d*x)^-1//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-4*(c+d*x)^-3//2, x) == :(-1*(a+b*x)^-3*(c+d*x)^-1//2*(-3*a*d+3*b*c)^-1+-35//8*d^3*(c+d*x)^-1//2*(b*c+-1*a*d)^-4+-35//24*d^2*(a+b*x)^-1*(c+d*x)^-1//2*(b*c+-1*a*d)^-3+7//12*d*(a+b*x)^-2*(c+d*x)^-1//2*(b*c+-1*a*d)^-2+35//8*b^(1/2)*d^3*(b*c+-1*a*d)^-9//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^5*(c+d*x)^-5//2, x) == :(2//3*d^-6*(c+d*x)^-3//2*(b*c+-1*a*d)^5+2//7*b^5*d^-6*(c+d*x)^7//2+-20*b^2*d^-6*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+-10*b*d^-6*(c+d*x)^-1//2*(b*c+-1*a*d)^4+-2*b^4*d^-6*(c+d*x)^5//2*(b*c+-1*a*d)+20//3*b^3*d^-6*(c+d*x)^3//2*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^4*(c+d*x)^-5//2, x) == :(-2//3*d^-5*(c+d*x)^-3//2*(b*c+-1*a*d)^4+2//5*b^4*d^-5*(c+d*x)^5//2+8*b*d^-5*(c+d*x)^-1//2*(b*c+-1*a*d)^3+12*b^2*d^-5*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+-8//3*b^3*d^-5*(c+d*x)^3//2*(b*c+-1*a*d))
@test integrate((a+b*x)^3*(c+d*x)^-5//2, x) == :(2//3*b^3*d^-4*(c+d*x)^3//2+2//3*d^-4*(c+d*x)^-3//2*(b*c+-1*a*d)^3+-6*b*d^-4*(c+d*x)^-1//2*(b*c+-1*a*d)^2+-6*b^2*d^-4*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^2*(c+d*x)^-5//2, x) == :(2*b^2*d^-3*(c+d*x)^(1/2)+-2//3*d^-3*(c+d*x)^-3//2*(b*c+-1*a*d)^2+4*b*d^-3*(c+d*x)^-1//2*(b*c+-1*a*d))
@test integrate((c+d*x)^-5//2*(a+b*x), x) == :(-2*b*d^-2*(c+d*x)^-1//2+1//3*d^-2*(c+d*x)^-3//2*(-2*a*d+2*b*c))
@test integrate((c+d*x)^-5//2, x) == :(-2//3*d^-1*(c+d*x)^-3//2)
@test integrate((a+b*x)^-1*(c+d*x)^-5//2, x) == :(2*(c+d*x)^-3//2*(-3*a*d+3*b*c)^-1+-2*b^3//2*(b*c+-1*a*d)^-5//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+2*b*(c+d*x)^-1//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-2*(c+d*x)^-5//2, x) == :(-1*(a+b*x)^-1*(c+d*x)^-3//2*(b*c+-1*a*d)^-1+-5//3*d*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+-5*b*d*(c+d*x)^-1//2*(b*c+-1*a*d)^-3+5*d*b^3//2*(b*c+-1*a*d)^-7//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^-3*(c+d*x)^-5//2, x) == :(-1*(a+b*x)^-2*(c+d*x)^-3//2*(-2*a*d+2*b*c)^-1+35//12*d^2*(c+d*x)^-3//2*(b*c+-1*a*d)^-3+-35//4*b^3//2*d^2*(b*c+-1*a*d)^-9//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2)+7//4*d*(a+b*x)^-1*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+35//4*b*d^2*(c+d*x)^-1//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-4*(c+d*x)^-5//2, x) == :(-1*(a+b*x)^-3*(c+d*x)^-3//2*(-3*a*d+3*b*c)^-1+-35//8*d^3*(c+d*x)^-3//2*(b*c+-1*a*d)^-4+-105//8*b*d^3*(c+d*x)^-1//2*(b*c+-1*a*d)^-5+-21//8*d^2*(a+b*x)^-1*(c+d*x)^-3//2*(b*c+-1*a*d)^-3+3//4*d*(a+b*x)^-2*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+105//8*b^3//2*d^3*(b*c+-1*a*d)^-11//2*arctanh(b^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1//2))
@test integrate((a+b*x)^5*(a*c+b*c*x)^3//2, x) == :(2//15*b^-1*c^-6*(a*c+b*c*x)^15//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^(1/2), x) == :(2//13*b^-1*c^-6*(a*c+b*c*x)^13//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-1//2, x) == :(2//11*b^-1*c^-6*(a*c+b*c*x)^11//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-3//2, x) == :(2//9*b^-1*c^-6*(a*c+b*c*x)^9//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-5//2, x) == :(2//7*b^-1*c^-6*(a*c+b*c*x)^7//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-7//2, x) == :(2//5*b^-1*c^-6*(a*c+b*c*x)^5//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-9//2, x) == :(2//3*b^-1*c^-6*(a*c+b*c*x)^3//2)
@test integrate((a+b*x)^5*(a*c+b*c*x)^-11//2, x) == :(2*b^-1*c^-6*(a*c+b*c*x)^(1/2))
@test integrate((a+b*x)^5*(a*c+b*c*x)^-13//2, x) == :(-2*b^-1*c^-6*(a*c+b*c*x)^-1//2)
@test integrate((-2+x)^-1*(2+x)^-1//2, x) == :(-1*arctanh((1/2)*(2+x)^(1/2)))
@test integrate((1+5x)^-1//2*(2+3x)^-1, x) == :(2//21*21^(1/2)*arctan(1//7*21^(1/2)*(1+5x)^(1/2)))
@test integrate((1+x)^-1*(1+-1x)^1//3, x) == :(3*(1+-1x)^1//3+-1//2*2^1//3*log(1+x)+3//2*2^1//3*log(2^1//3+-1*(1+-1x)^1//3)+-1*2^1//3*3^(1/2)*arctan(1//3*3^(1/2)*(1+2^2//3*(1+-1x)^1//3)))
@test integrate((3+-2x)^1//3*(7+x), x) == :(-51//16*(3+-2x)^4//3+3//28*(3+-2x)^7//3)
@test integrate((1+x)^2*(1+-1x)^1//3, x) == :(-3*(1+-1x)^4//3+-3//10*(1+-1x)^10//3+12//7*(1+-1x)^7//3)
@test integrate((a+b*x)^-1*(c+d*x)^-1//3, x) == :(-1//2*b^-2//3*(b*c+-1*a*d)^-1//3*log(a+b*x)+3//2*b^-2//3*(b*c+-1*a*d)^-1//3*log((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)+3^(1/2)*b^-2//3*(b*c+-1*a*d)^-1//3*arctan(1//3*3^(1/2)*(1+2*b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^-1//3)))
@test integrate((a+b*x)^-1*(c+d*x)^-2//3, x) == :(-1//2*b^-1//3*(b*c+-1*a*d)^-2//3*log(a+b*x)+3//2*b^-1//3*(b*c+-1*a*d)^-2//3*log((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)+-1*3^(1/2)*b^-1//3*(b*c+-1*a*d)^-2//3*arctan(1//3*3^(1/2)*(1+2*b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^-1//3)))
@test integrate((a+b*x)^7//2*(c+d*x)^(1/2), x) == :(1//5*b^-1*(a+b*x)^9//2*(c+d*x)^(1/2)+7//128*b^-3//2*d^-9//2*(b*c+-1*a*d)^5*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-7//128*b^-1*d^-4*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^4+-7//240*b^-1*d^-2*(a+b*x)^5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+1//40*b^-1*d^-1*(a+b*x)^7//2*(c+d*x)^(1/2)*(b*c+-1*a*d)+7//192*b^-1*d^-3*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^5//2*(c+d*x)^(1/2), x) == :(1//4*b^-1*(a+b*x)^7//2*(c+d*x)^(1/2)+-5//64*b^-3//2*d^-7//2*(b*c+-1*a*d)^4*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-5//96*b^-1*d^-2*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+1//24*b^-1*d^-1*(a+b*x)^5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)+5//64*b^-1*d^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^3//2*(c+d*x)^(1/2), x) == :(1//3*b^-1*(a+b*x)^5//2*(c+d*x)^(1/2)+1//8*b^-3//2*d^-5//2*(b*c+-1*a*d)^3*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-1//8*b^-1*d^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+1//12*b^-1*d^-1*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^(1/2)*(c+d*x)^(1/2), x) == :((1/2)*b^-1*(a+b*x)^3//2*(c+d*x)^(1/2)+-1//4*b^-3//2*d^-3//2*(b*c+-1*a*d)^2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+1//4*b^-1*d^-1*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^-1//2*(c+d*x)^(1/2), x) == :(b^-1*(a+b*x)^(1/2)*(c+d*x)^(1/2)+b^-3//2*d^-1//2*(b*c+-1*a*d)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-3//2*(c+d*x)^(1/2), x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^(1/2)+2*b^-3//2*d^(1/2)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-5//2*(c+d*x)^(1/2), x) == :(-2*(a+b*x)^-3//2*(c+d*x)^3//2*(-3*a*d+3*b*c)^-1)
@test integrate((a+b*x)^-7//2*(c+d*x)^(1/2), x) == :(-2*(a+b*x)^-5//2*(c+d*x)^3//2*(-5*a*d+5*b*c)^-1+4//15*d*(a+b*x)^-3//2*(c+d*x)^3//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-9//2*(c+d*x)^(1/2), x) == :(-2*(a+b*x)^-7//2*(c+d*x)^3//2*(-7*a*d+7*b*c)^-1+-16//105*d^2*(a+b*x)^-3//2*(c+d*x)^3//2*(b*c+-1*a*d)^-3+8//35*d*(a+b*x)^-5//2*(c+d*x)^3//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-11//2*(c+d*x)^(1/2), x) == :(-2*(a+b*x)^-9//2*(c+d*x)^3//2*(-9*a*d+9*b*c)^-1+-16//105*d^2*(a+b*x)^-5//2*(c+d*x)^3//2*(b*c+-1*a*d)^-3+4//21*d*(a+b*x)^-7//2*(c+d*x)^3//2*(b*c+-1*a*d)^-2+32//315*d^3*(a+b*x)^-3//2*(c+d*x)^3//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-13//2*(c+d*x)^(1/2), x) == :(-2*(a+b*x)^-11//2*(c+d*x)^3//2*(-11*a*d+11*b*c)^-1+-256//3465*d^4*(a+b*x)^-3//2*(c+d*x)^3//2*(b*c+-1*a*d)^-5+-32//231*d^2*(a+b*x)^-7//2*(c+d*x)^3//2*(b*c+-1*a*d)^-3+16//99*d*(a+b*x)^-9//2*(c+d*x)^3//2*(b*c+-1*a*d)^-2+128//1155*d^3*(a+b*x)^-5//2*(c+d*x)^3//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^5//2*(c+d*x)^3//2, x) == :(1//5*b^-1*(a+b*x)^7//2*(c+d*x)^3//2+-3//128*b^-5//2*d^-7//2*(b*c+-1*a*d)^5*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+1//40*b^-2*(a+b*x)^7//2*(c+d*x)^(1/2)*(-3*a*d+3*b*c)+-1//64*b^-2*d^-2*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+1//80*b^-2*d^-1*(a+b*x)^5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+3//128*b^-2*d^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^4)
@test integrate((a+b*x)^3//2*(c+d*x)^3//2, x) == :(1//4*b^-1*(a+b*x)^5//2*(c+d*x)^3//2+1//8*b^-2*(a+b*x)^5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)+3//64*b^-5//2*d^-5//2*(b*c+-1*a*d)^4*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-3//64*b^-2*d^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+1//32*b^-2*d^-1*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^(1/2)*(c+d*x)^3//2, x) == :(1//3*b^-1*(a+b*x)^3//2*(c+d*x)^3//2+-1//8*b^-5//2*d^-3//2*(b*c+-1*a*d)^3*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+1//4*b^-2*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)+1//8*b^-2*d^-1*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-1//2*(c+d*x)^3//2, x) == :((1/2)*b^-1*(a+b*x)^(1/2)*(c+d*x)^3//2+1//4*b^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(-3*a*d+3*b*c)+3//4*b^-5//2*d^-1//2*(b*c+-1*a*d)^2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-3//2*(c+d*x)^3//2, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^3//2+3*d*b^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2)+3*b^-5//2*d^(1/2)*(b*c+-1*a*d)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-5//2*(c+d*x)^3//2, x) == :(2*b^-5//2*d^3//2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^3//2+-2*d*b^-2*(a+b*x)^-1//2*(c+d*x)^(1/2))
@test integrate((a+b*x)^-7//2*(c+d*x)^3//2, x) == :(-2*(a+b*x)^-5//2*(c+d*x)^5//2*(-5*a*d+5*b*c)^-1)
@test integrate((a+b*x)^-9//2*(c+d*x)^3//2, x) == :(-2*(a+b*x)^-7//2*(c+d*x)^5//2*(-7*a*d+7*b*c)^-1+4//35*d*(a+b*x)^-5//2*(c+d*x)^5//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-11//2*(c+d*x)^3//2, x) == :(-2*(a+b*x)^-9//2*(c+d*x)^5//2*(-9*a*d+9*b*c)^-1+-16//315*d^2*(a+b*x)^-5//2*(c+d*x)^5//2*(b*c+-1*a*d)^-3+8//63*d*(a+b*x)^-7//2*(c+d*x)^5//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-13//2*(c+d*x)^3//2, x) == :(-2*(a+b*x)^-11//2*(c+d*x)^5//2*(-11*a*d+11*b*c)^-1+-16//231*d^2*(a+b*x)^-7//2*(c+d*x)^5//2*(b*c+-1*a*d)^-3+4//33*d*(a+b*x)^-9//2*(c+d*x)^5//2*(b*c+-1*a*d)^-2+32//1155*d^3*(a+b*x)^-5//2*(c+d*x)^5//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^5//2*(c+d*x)^5//2, x) == :(1//6*b^-1*(a+b*x)^7//2*(c+d*x)^5//2+-5//512*b^-7//2*d^-7//2*(b*c+-1*a*d)^6*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+1//12*b^-2*(a+b*x)^7//2*(c+d*x)^3//2*(b*c+-1*a*d)+1//32*b^-3*(a+b*x)^7//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+-5//768*b^-3*d^-2*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^4+1//192*b^-3*d^-1*(a+b*x)^5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+5//512*b^-3*d^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^5)
@test integrate((a+b*x)^3//2*(c+d*x)^5//2, x) == :(1//5*b^-1*(a+b*x)^5//2*(c+d*x)^5//2+1//8*b^-2*(a+b*x)^5//2*(c+d*x)^3//2*(b*c+-1*a*d)+1//16*b^-3*(a+b*x)^5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+3//128*b^-7//2*d^-5//2*(b*c+-1*a*d)^5*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-3//128*b^-3*d^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^4+1//64*b^-3*d^-1*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^(1/2)*(c+d*x)^5//2, x) == :(1//4*b^-1*(a+b*x)^3//2*(c+d*x)^5//2+-5//64*b^-7//2*d^-3//2*(b*c+-1*a*d)^4*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+1//24*b^-2*(a+b*x)^3//2*(c+d*x)^3//2*(-5*a*d+5*b*c)+5//32*b^-3*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+5//64*b^-3*d^-1*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^3)
@test integrate((a+b*x)^-1//2*(c+d*x)^5//2, x) == :(1//3*b^-1*(a+b*x)^(1/2)*(c+d*x)^5//2+1//12*b^-2*(a+b*x)^(1/2)*(c+d*x)^3//2*(-5*a*d+5*b*c)+5//8*b^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^2+5//8*b^-7//2*d^-1//2*(b*c+-1*a*d)^3*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-3//2*(c+d*x)^5//2, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^5//2+5//2*d*b^-2*(a+b*x)^(1/2)*(c+d*x)^3//2+15//4*b^-7//2*d^(1/2)*(b*c+-1*a*d)^2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+15//4*d*b^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^-5//2*(c+d*x)^5//2, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^5//2+5*b^-3*d^2*(a+b*x)^(1/2)*(c+d*x)^(1/2)+5*b^-7//2*d^3//2*(b*c+-1*a*d)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-10//3*d*b^-2*(a+b*x)^-1//2*(c+d*x)^3//2)
@test integrate((a+b*x)^-7//2*(c+d*x)^5//2, x) == :(2*b^-7//2*d^5//2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-2//5*b^-1*(a+b*x)^-5//2*(c+d*x)^5//2+-2*b^-3*d^2*(a+b*x)^-1//2*(c+d*x)^(1/2)+-2//3*d*b^-2*(a+b*x)^-3//2*(c+d*x)^3//2)
@test integrate((a+b*x)^-9//2*(c+d*x)^5//2, x) == :(-2*(a+b*x)^-7//2*(c+d*x)^7//2*(-7*a*d+7*b*c)^-1)
@test integrate((a+b*x)^-11//2*(c+d*x)^5//2, x) == :(-2*(a+b*x)^-9//2*(c+d*x)^7//2*(-9*a*d+9*b*c)^-1+4//63*d*(a+b*x)^-7//2*(c+d*x)^7//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-13//2*(c+d*x)^5//2, x) == :(-2*(a+b*x)^-11//2*(c+d*x)^7//2*(-11*a*d+11*b*c)^-1+-16//693*d^2*(a+b*x)^-7//2*(c+d*x)^7//2*(b*c+-1*a*d)^-3+8//99*d*(a+b*x)^-9//2*(c+d*x)^7//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-15//2*(c+d*x)^5//2, x) == :(-2*(a+b*x)^-13//2*(c+d*x)^7//2*(-13*a*d+13*b*c)^-1+-16//429*d^2*(a+b*x)^-9//2*(c+d*x)^7//2*(b*c+-1*a*d)^-3+12//143*d*(a+b*x)^-11//2*(c+d*x)^7//2*(b*c+-1*a*d)^-2+32//3003*d^3*(a+b*x)^-7//2*(c+d*x)^7//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^7//2*(c+d*x)^-1//2, x) == :(1//4*d^-1*(a+b*x)^7//2*(c+d*x)^(1/2)+-35//64*d^-4*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^3+-1//24*d^-2*(a+b*x)^5//2*(c+d*x)^(1/2)*(-7*a*d+7*b*c)+35//64*b^-1//2*d^-9//2*(b*c+-1*a*d)^4*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+35//96*d^-3*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^5//2*(c+d*x)^-1//2, x) == :(1//3*d^-1*(a+b*x)^5//2*(c+d*x)^(1/2)+-5//8*b^-1//2*d^-7//2*(b*c+-1*a*d)^3*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-1//12*d^-2*(a+b*x)^3//2*(c+d*x)^(1/2)*(-5*a*d+5*b*c)+5//8*d^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^3//2*(c+d*x)^-1//2, x) == :((1/2)*d^-1*(a+b*x)^3//2*(c+d*x)^(1/2)+-1//4*d^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(-3*a*d+3*b*c)+3//4*b^-1//2*d^-5//2*(b*c+-1*a*d)^2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-1//2, x) == :(d^-1*(a+b*x)^(1/2)*(c+d*x)^(1/2)+-1*b^-1//2*d^-3//2*(b*c+-1*a*d)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-1//2*(c+d*x)^-1//2, x) == :(2*b^-1//2*d^-1//2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-3//2*(c+d*x)^-1//2, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-5//2*(c+d*x)^-1//2, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^(1/2)*(-3*a*d+3*b*c)^-1+4//3*d*(a+b*x)^-1//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-7//2*(c+d*x)^-1//2, x) == :(-2*(a+b*x)^-5//2*(c+d*x)^(1/2)*(-5*a*d+5*b*c)^-1+-16//15*d^2*(a+b*x)^-1//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+8//15*d*(a+b*x)^-3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-9//2*(c+d*x)^-1//2, x) == :(-2*(a+b*x)^-7//2*(c+d*x)^(1/2)*(-7*a*d+7*b*c)^-1+-16//35*d^2*(a+b*x)^-3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+12//35*d*(a+b*x)^-5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2+32//35*d^3*(a+b*x)^-1//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-11//2*(c+d*x)^-1//2, x) == :(-2*(a+b*x)^-9//2*(c+d*x)^(1/2)*(-9*a*d+9*b*c)^-1+-256//315*d^4*(a+b*x)^-1//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-5+-32//105*d^2*(a+b*x)^-5//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-3+16//63*d*(a+b*x)^-7//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-2+128//315*d^3*(a+b*x)^-3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^7//2*(c+d*x)^-3//2, x) == :(-2*d^-1*(a+b*x)^7//2*(c+d*x)^-1//2+-35//8*b^(1/2)*d^-9//2*(b*c+-1*a*d)^3*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+7//3*b*d^-2*(a+b*x)^5//2*(c+d*x)^(1/2)+-35//12*b*d^-3*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)+35//8*b*d^-4*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^5//2*(c+d*x)^-3//2, x) == :(-2*d^-1*(a+b*x)^5//2*(c+d*x)^-1//2+5//2*b*d^-2*(a+b*x)^3//2*(c+d*x)^(1/2)+15//4*b^(1/2)*d^-7//2*(b*c+-1*a*d)^2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-15//4*b*d^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^3//2*(c+d*x)^-3//2, x) == :(-2*d^-1*(a+b*x)^3//2*(c+d*x)^-1//2+-3*b^(1/2)*d^-5//2*(b*c+-1*a*d)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+3*b*d^-2*(a+b*x)^(1/2)*(c+d*x)^(1/2))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-3//2, x) == :(-2*d^-1*(a+b*x)^(1/2)*(c+d*x)^-1//2+2*b^(1/2)*d^-3//2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^-1//2*(c+d*x)^-3//2, x) == :(2*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-3//2*(c+d*x)^-3//2, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-1+-4*d*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-5//2*(c+d*x)^-3//2, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^-1//2*(-3*a*d+3*b*c)^-1+8//3*d*(a+b*x)^-1//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-2+16//3*d^2*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-7//2*(c+d*x)^-3//2, x) == :(-2*(a+b*x)^-5//2*(c+d*x)^-1//2*(-5*a*d+5*b*c)^-1+-32//5*d^3*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-4+-16//5*d^2*(a+b*x)^-1//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-3+4//5*d*(a+b*x)^-3//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-9//2*(c+d*x)^-3//2, x) == :(-2*(a+b*x)^-7//2*(c+d*x)^-1//2*(-7*a*d+7*b*c)^-1+-32//35*d^2*(a+b*x)^-3//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-3+16//35*d*(a+b*x)^-5//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-2+128//35*d^3*(a+b*x)^-1//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-4+256//35*d^4*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-5)
@test integrate((a+b*x)^-11//2*(c+d*x)^-3//2, x) == :(-2*(a+b*x)^-9//2*(c+d*x)^-1//2*(-9*a*d+9*b*c)^-1+-512//63*d^5*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-6+-256//63*d^4*(a+b*x)^-1//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-5+-32//63*d^2*(a+b*x)^-5//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-3+20//63*d*(a+b*x)^-7//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-2+64//63*d^3*(a+b*x)^-3//2*(c+d*x)^-1//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^9//2*(c+d*x)^-5//2, x) == :(-2//3*d^-1*(a+b*x)^9//2*(c+d*x)^-3//2+-6*b*d^-2*(a+b*x)^7//2*(c+d*x)^-1//2+7*b^2*d^-3*(a+b*x)^5//2*(c+d*x)^(1/2)+-105//8*b^3//2*d^-11//2*(b*c+-1*a*d)^3*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-35//4*b^2*d^-4*(a+b*x)^3//2*(c+d*x)^(1/2)*(b*c+-1*a*d)+105//8*b^2*d^-5*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^7//2*(c+d*x)^-5//2, x) == :(-2//3*d^-1*(a+b*x)^7//2*(c+d*x)^-3//2+-14//3*b*d^-2*(a+b*x)^5//2*(c+d*x)^-1//2+35//4*b^3//2*d^-9//2*(b*c+-1*a*d)^2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+35//6*b^2*d^-3*(a+b*x)^3//2*(c+d*x)^(1/2)+-35//4*b^2*d^-4*(a+b*x)^(1/2)*(c+d*x)^(1/2)*(b*c+-1*a*d))
@test integrate((a+b*x)^5//2*(c+d*x)^-5//2, x) == :(-2//3*d^-1*(a+b*x)^5//2*(c+d*x)^-3//2+-5*b^3//2*d^-7//2*(b*c+-1*a*d)*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+5*b^2*d^-3*(a+b*x)^(1/2)*(c+d*x)^(1/2)+-10//3*b*d^-2*(a+b*x)^3//2*(c+d*x)^-1//2)
@test integrate((a+b*x)^3//2*(c+d*x)^-5//2, x) == :(2*b^3//2*d^-5//2*arctanh(b^-1//2*d^(1/2)*(a+b*x)^(1/2)*(c+d*x)^-1//2)+-2//3*d^-1*(a+b*x)^3//2*(c+d*x)^-3//2+-2*b*d^-2*(a+b*x)^(1/2)*(c+d*x)^-1//2)
@test integrate((a+b*x)^(1/2)*(c+d*x)^-5//2, x) == :(2*(a+b*x)^3//2*(c+d*x)^-3//2*(-3*a*d+3*b*c)^-1)
@test integrate((a+b*x)^-1//2*(c+d*x)^-5//2, x) == :(2*(a+b*x)^(1/2)*(c+d*x)^-3//2*(-3*a*d+3*b*c)^-1+4//3*b*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-3//2*(c+d*x)^-5//2, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-1+-8//3*d*(a+b*x)^(1/2)*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+-16//3*b*d*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-5//2*(c+d*x)^-5//2, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^-3//2*(-3*a*d+3*b*c)^-1+4*d*(a+b*x)^-1//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+16//3*d^2*(a+b*x)^(1/2)*(c+d*x)^-3//2*(b*c+-1*a*d)^-3+32//3*b*d^2*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-7//2*(c+d*x)^-5//2, x) == :(-2*(a+b*x)^-5//2*(c+d*x)^-3//2*(-5*a*d+5*b*c)^-1+-128//15*d^3*(a+b*x)^(1/2)*(c+d*x)^-3//2*(b*c+-1*a*d)^-4+-32//5*d^2*(a+b*x)^-1//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-3+16//15*d*(a+b*x)^-3//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+-256//15*b*d^3*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-5)
@test integrate((a+b*x)^-9//2*(c+d*x)^-5//2, x) == :(-2*(a+b*x)^-7//2*(c+d*x)^-3//2*(-7*a*d+7*b*c)^-1+-32//21*d^2*(a+b*x)^-3//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-3+4//7*d*(a+b*x)^-5//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-2+64//7*d^3*(a+b*x)^-1//2*(c+d*x)^-3//2*(b*c+-1*a*d)^-4+256//21*d^4*(a+b*x)^(1/2)*(c+d*x)^-3//2*(b*c+-1*a*d)^-5+512//21*b*d^4*(a+b*x)^(1/2)*(c+d*x)^-1//2*(b*c+-1*a*d)^-6)
@test integrate((a+b*x)^-1//2*(4+a+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*(a+b*x)^(1/2)))
@test integrate((2+b*x)^-1//2*(6+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*(2+b*x)^(1/2)))
@test integrate((1+b*x)^-1//2*(5+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*(1+b*x)^(1/2)))
@test integrate((b*x)^-1//2*(4+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*(b*x)^(1/2)))
@test integrate((-1+b*x)^-1//2*(3+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*(-1+b*x)^(1/2)))
@test integrate((-2+b*x)^-1//2*(2+b*x)^-1//2, x) == :(b^-1*arccosh((1/2)*b*x))
@test integrate((1+b*x)^-1//2*(-3+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*(-3+b*x)^(1/2)))
@test integrate((2+b*x)^-1//2*(3+b*x)^-1//2, x) == :(2*b^-1*arcsinh((2+b*x)^(1/2)))
@test integrate((2+b*x)^-1, x) == :(b^-1*log(2+b*x))
@test integrate((1+b*x)^-1//2*(2+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1+b*x)^(1/2)))
@test integrate((b*x)^-1//2*(2+b*x)^-1//2, x) == :(2*b^-1*arcsinh((1/2)*2^(1/2)*(b*x)^(1/2)))
@test integrate((-1+b*x)^-1//2*(2+b*x)^-1//2, x) == :(2*b^-1*arcsinh(1//3*3^(1/2)*(-1+b*x)^(1/2)))
@test integrate((-2+b*x)^-1//2*(2+b*x)^-1//2, x) == :(b^-1*arccosh((1/2)*b*x))
@test integrate((-3+b*x)^-1//2*(2+b*x)^-1//2, x) == :(2*b^-1*arcsinh(1//5*5^(1/2)*(-3+b*x)^(1/2)))
@test integrate((2+b*x)^-1//2*(3+-1*b*x)^-1//2, x) == :(-1*b^-1*arcsin(1//5+-2//5*b*x))
@test integrate((2+b*x)^-1//2*(2+-1*b*x)^-1//2, x) == :(b^-1*arcsin((1/2)*b*x))
@test integrate((1+-1*b*x)^-1//2*(2+b*x)^-1//2, x) == :(-1*b^-1*arcsin(-1//3+-2//3*b*x))
@test integrate((-1*b*x)^-1//2*(2+b*x)^-1//2, x) == :(b^-1*arcsin(1+b*x))
@test integrate((-1+-1*b*x)^-1//2*(2+b*x)^-1//2, x) == :(b^-1*arcsin(3+2*b*x))
@test integrate((-2+-1*b*x)^-1//2*(2+b*x)^-1//2, x) == :(b^-1*(-2+-1*b*x)^-1//2*(2+b*x)^(1/2)*log(2+b*x))
@test integrate((-3+-1*b*x)^-1//2*(2+b*x)^-1//2, x) == :(-2*b^-1*arctan((-3+-1*b*x)^(1/2)*(2+b*x)^-1//2))
@test integrate((2+-1*b*x)^-1//2*(3+-1*b*x)^-1//2, x) == :(-2*b^-1*arcsinh((2+-1*b*x)^(1/2)))
@test integrate((2+-1*b*x)^-1, x) == :(-1*b^-1*log(2+-1*b*x))
@test integrate((1+-1*b*x)^-1//2*(2+-1*b*x)^-1//2, x) == :(-2*b^-1*arcsinh((1+-1*b*x)^(1/2)))
@test integrate((-1*b*x)^-1//2*(2+-1*b*x)^-1//2, x) == :(-2*b^-1*arcsinh((1/2)*2^(1/2)*(-1*b*x)^(1/2)))
@test integrate((-1+-1*b*x)^-1//2*(2+-1*b*x)^-1//2, x) == :(-2*b^-1*arcsinh(1//3*3^(1/2)*(-1+-1*b*x)^(1/2)))
@test integrate((-2+-1*b*x)^-1//2*(2+-1*b*x)^-1//2, x) == :(-1*b^-1*arccosh(-1//2*b*x))
@test integrate((-3+-1*b*x)^-1//2*(2+-1*b*x)^-1//2, x) == :(-2*b^-1*arcsinh(1//5*5^(1/2)*(-3+-1*b*x)^(1/2)))
@test integrate((-4+b*x)^-1//2*(4+b*x)^-1//2, x) == :(b^-1*arccosh(1//4*b*x))
@test integrate((c+d*x)^-1//2*(b*x+d^-1*(-1b+b*c))^-1//2, x) == :(2*b^-1//2*d^-1//2*arcsinh(b^-1//2*d^(1/2)*(b*x+-1*b*d^-1*(1+-1c))^(1/2)))
@test integrate(x^-1//2*(-3+2x)^-1//2, x) == :(2^(1/2)*arcsinh(1//3*3^(1/2)*(-3+2x)^(1/2)))
@test integrate((-3+2x)^-1//2*(2+3x)^-1//2, x) == :(1//3*6^(1/2)*arcsinh(1//13*39^(1/2)*(-3+2x)^(1/2)))
@test integrate((c+-1*d*x)^-1//2*(b*x+d^-1*(b+-1*b*c))^-1//2, x) == :(2*b^-1//2*d^-1//2*arcsin(b^-1//2*d^(1/2)*(b*x+b*d^-1*(1+-1c))^(1/2)))
@test integrate(x^-1//2*(4+-1x)^-1//2, x) == :(-1*arcsin(1+-1//2*x))
@test integrate(x^-1//2*(3+-2x)^-1//2, x) == :(2^(1/2)*arcsin(1//3*6^(1/2)*x^(1/2)))
@test integrate((3+-2x)^-1//2*(3+5x)^-1//2, x) == :(1//5*10^(1/2)*arcsin(1//21*42^(1/2)*(3+5x)^(1/2)))
@test integrate((a+-1*b*x)^-1//2*(c+d*x)^-1//2, x) == :(-2*b^-1//2*d^-1//2*arctan(b^-1//2*d^(1/2)*(a+-1*b*x)^(1/2)*(c+d*x)^-1//2))
@test integrate((a+b*x)^3//2*(c+d*x)^1//3, x) == :(6//17*b^-1*(a+b*x)^5//2*(c+d*x)^1//3+-108//935*b^-1*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//3*(b*c+-1*a*d)^2+1//187*b^-1*d^-1*(a+b*x)^3//2*(c+d*x)^1//3*(-12*a*d+12*b*c)+-108//935*3^3//4*b^-4//3*d^-3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^1//3, x) == :(6//11*b^-1*(a+b*x)^3//2*(c+d*x)^1//3+1//55*b^-1*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//3*(-12*a*d+12*b*c)+12//55*3^3//4*b^-4//3*d^-2*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^1//3, x) == :(6//5*b^-1*(a+b*x)^(1/2)*(c+d*x)^1//3+-4//5*3^3//4*b^-4//3*d^-1*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*(b*c+-1*a*d)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^1//3, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^1//3+-4//3*3^3//4*b^-4//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^1//3, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^1//3+-4//9*d*b^-1*(a+b*x)^-1//2*(c+d*x)^1//3*(b*c+-1*a*d)^-1+4//27*d*3^3//4*b^-4//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-7//2*(c+d*x)^1//3, x) == :(-2//5*b^-1*(a+b*x)^-5//2*(c+d*x)^1//3+-4//45*d*b^-1*(a+b*x)^-3//2*(c+d*x)^1//3*(b*c+-1*a*d)^-1+28//135*b^-1*d^2*(a+b*x)^-1//2*(c+d*x)^1//3*(b*c+-1*a*d)^-2+-28//405*3^3//4*b^-4//3*d^2*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^-1//3, x) == :(6//13*d^-1*(a+b*x)^3//2*(c+d*x)^2//3+-1//91*d^-2*(a+b*x)^(1/2)*(c+d*x)^2//3*(-54*a*d+54*b*c)+-162//91*b^-2//3*d^-2*(a+b*x)^(1/2)*(b*c+-1*a*d)^2*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1+-54//91*2^(1/2)*3^3//4*b^-2//3*d^-3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(b*c+-1*a*d)^7//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2))+81//91*3^1//4*b^-2//3*d^-3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-1//3, x) == :(6//7*d^-1*(a+b*x)^(1/2)*(c+d*x)^2//3+1//7*b^-2//3*d^-1*(a+b*x)^(1/2)*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*(-18*a*d+18*b*c)+-9//7*3^1//4*b^-2//3*d^-2*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2))+6//7*2^(1/2)*3^3//4*b^-2//3*d^-2*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(b*c+-1*a*d)^4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^-1//3, x) == :(-6*b^-2//3*(a+b*x)^(1/2)*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1+-2*2^(1/2)*3^3//4*b^-2//3*d^-1*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2))+3*3^1//4*b^-2//3*d^-1*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^-1//3, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^2//3*(b*c+-1*a*d)^-1+-2*d*b^-2//3*(a+b*x)^(1/2)*(b*c+-1*a*d)^-1*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1+3^1//4*b^-2//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2))+-2//3*2^(1/2)*3^3//4*b^-2//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(b*c+-1*a*d)^-2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^-1//3, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^2//3*(-3*a*d+3*b*c)^-1+10//9*d*(a+b*x)^-1//2*(c+d*x)^2//3*(b*c+-1*a*d)^-2+10//9*b^-2//3*d^2*(a+b*x)^(1/2)*(b*c+-1*a*d)^-2*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1+-5//9*d*3^1//4*b^-2//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2))+10//27*d*2^(1/2)*3^3//4*b^-2//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^-2//3, x) == :(6//11*d^-1*(a+b*x)^3//2*(c+d*x)^1//3+-1//55*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//3*(-54*a*d+54*b*c)+-54//55*3^3//4*b^-1//3*d^-3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-2//3, x) == :(6//5*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//3+6//5*3^3//4*b^-1//3*d^-2*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*(b*c+-1*a*d)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^-2//3, x) == :(-2*3^3//4*b^-1//3*d^-1*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^-2//3, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^1//3*(b*c+-1*a*d)^-1+2//3*3^3//4*b^-1//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^-2//3, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^1//3*(-3*a*d+3*b*c)^-1+14//9*d*(a+b*x)^-1//2*(c+d*x)^1//3*(b*c+-1*a*d)^-2+-14//27*d*3^3//4*b^-1//3*(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^1//3*(1+-1*3^(1/2))+-1*b^1//3*(c+d*x)^1//3)^-1*((b*c+-1*a*d)^1//3*(1+3^(1/2))+-1*b^1//3*(c+d*x)^1//3)),-7+4*3^(1/2)))
@test integrate((a+b*x)^2//3*(c+d*x)^1//3, x) == :((1/2)*b^-1*(a+b*x)^5//3*(c+d*x)^1//3+1//6*b^-4//3*d^-5//3*(b*c+-1*a*d)^2*log(-1+b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3)+1//18*b^-4//3*d^-5//3*(b*c+-1*a*d)^2*log(c+d*x)+1//6*b^-1*d^-1*(a+b*x)^2//3*(c+d*x)^1//3*(b*c+-1*a*d)+1//9*3^(1/2)*b^-4//3*d^-5//3*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3))
@test integrate((a+b*x)^-1//3*(c+d*x)^1//3, x) == :(b^-1*(a+b*x)^2//3*(c+d*x)^1//3+-1//2*b^-4//3*d^-2//3*(b*c+-1*a*d)*log(-1+b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3)+-1//6*b^-4//3*d^-2//3*(b*c+-1*a*d)*log(c+d*x)+-1//3*3^(1/2)*b^-4//3*d^-2//3*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3))
@test integrate((a+b*x)^-4//3*(c+d*x)^1//3, x) == :(-3*b^-1*(a+b*x)^-1//3*(c+d*x)^1//3+-3//2*b^-4//3*d^1//3*log(-1+b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3)+-1//2*b^-4//3*d^1//3*log(c+d*x)+-1*3^(1/2)*b^-4//3*d^1//3*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3))
@test integrate((a+b*x)^-7//3*(c+d*x)^1//3, x) == :(-3*(a+b*x)^-4//3*(c+d*x)^4//3*(-4*a*d+4*b*c)^-1)
@test integrate((a+b*x)^-10//3*(c+d*x)^1//3, x) == :(-3*(a+b*x)^-7//3*(c+d*x)^4//3*(-7*a*d+7*b*c)^-1+9//28*d*(a+b*x)^-4//3*(c+d*x)^4//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-13//3*(c+d*x)^1//3, x) == :(-3*(a+b*x)^-10//3*(c+d*x)^4//3*(-10*a*d+10*b*c)^-1+-27//140*d^2*(a+b*x)^-4//3*(c+d*x)^4//3*(b*c+-1*a*d)^-3+9//35*d*(a+b*x)^-7//3*(c+d*x)^4//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-16//3*(c+d*x)^1//3, x) == :(-3*(a+b*x)^-13//3*(c+d*x)^4//3*(-13*a*d+13*b*c)^-1+-81//455*d^2*(a+b*x)^-7//3*(c+d*x)^4//3*(b*c+-1*a*d)^-3+27//130*d*(a+b*x)^-10//3*(c+d*x)^4//3*(b*c+-1*a*d)^-2+243//1820*d^3*(a+b*x)^-4//3*(c+d*x)^4//3*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^4//3*(c+d*x)^1//3, x) == :(3//8*b^-1*(a+b*x)^7//3*(c+d*x)^1//3+-3//20*b^-1*d^-2*(a+b*x)^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^2+1//40*b^-1*d^-1*(a+b*x)^4//3*(c+d*x)^1//3*(-3*a*d+3*b*c)+1//20*2^1//3*3^3//4*b^-4//3*d^-7//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^1//3*(c+d*x)^1//3, x) == :(3//5*b^-1*(a+b*x)^4//3*(c+d*x)^1//3+1//10*b^-1*d^-1*(a+b*x)^1//3*(c+d*x)^1//3*(-3*a*d+3*b*c)+-1//10*2^1//3*3^3//4*b^-4//3*d^-4//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^2*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-2//3*(c+d*x)^1//3, x) == :(3//2*b^-1*(a+b*x)^1//3*(c+d*x)^1//3+(1/2)*2^1//3*3^3//4*b^-4//3*d^-1//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*(b*c+-1*a*d)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-5//3*(c+d*x)^1//3, x) == :(-3//2*b^-1*(a+b*x)^-2//3*(c+d*x)^1//3+(1/2)*2^1//3*3^3//4*b^-4//3*d^2//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-8//3*(c+d*x)^1//3, x) == :(-3//5*b^-1*(a+b*x)^-5//3*(c+d*x)^1//3+-3//10*d*b^-1*(a+b*x)^-2//3*(c+d*x)^1//3*(b*c+-1*a*d)^-1+-1//10*2^1//3*3^3//4*b^-4//3*d^5//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^-1*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^4//3*(c+d*x)^-1//3, x) == :((1/2)*d^-1*(a+b*x)^4//3*(c+d*x)^2//3+-1//3*b^-2//3*d^-7//3*(b*c+-1*a*d)^2*log(-1+b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3)+-1//9*b^-2//3*d^-7//3*(b*c+-1*a*d)^2*log(a+b*x)+1//3*d^-2*(a+b*x)^1//3*(c+d*x)^2//3*(-2*b*c+2*a*d)+-2//9*3^(1/2)*b^-2//3*d^-7//3*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3))
@test integrate((a+b*x)^1//3*(c+d*x)^-1//3, x) == :(d^-1*(a+b*x)^1//3*(c+d*x)^2//3+(1/2)*b^-2//3*d^-4//3*(b*c+-1*a*d)*log(-1+b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3)+1//6*b^-2//3*d^-4//3*(b*c+-1*a*d)*log(a+b*x)+1//3*3^(1/2)*b^-2//3*d^-4//3*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3))
@test integrate((a+b*x)^-2//3*(c+d*x)^-1//3, x) == :(-3//2*b^-2//3*d^-1//3*log(-1+b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3)+-1//2*b^-2//3*d^-1//3*log(a+b*x)+-1*3^(1/2)*b^-2//3*d^-1//3*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3))
@test integrate((a+b*x)^-5//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-2//3*(c+d*x)^2//3*(-2*a*d+2*b*c)^-1)
@test integrate((a+b*x)^-8//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-5//3*(c+d*x)^2//3*(-5*a*d+5*b*c)^-1+9//10*d*(a+b*x)^-2//3*(c+d*x)^2//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-11//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-8//3*(c+d*x)^2//3*(-8*a*d+8*b*c)^-1+-27//40*d^2*(a+b*x)^-2//3*(c+d*x)^2//3*(b*c+-1*a*d)^-3+9//20*d*(a+b*x)^-5//3*(c+d*x)^2//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-14//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-11//3*(c+d*x)^2//3*(-11*a*d+11*b*c)^-1+-81//220*d^2*(a+b*x)^-5//3*(c+d*x)^2//3*(b*c+-1*a*d)^-3+27//88*d*(a+b*x)^-8//3*(c+d*x)^2//3*(b*c+-1*a*d)^-2+243//440*d^3*(a+b*x)^-2//3*(c+d*x)^2//3*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^8//3*(c+d*x)^-1//3, x) == :(3//10*d^-1*(a+b*x)^8//3*(c+d*x)^2//3+-1//35*d^-2*(a+b*x)^5//3*(c+d*x)^2//3*(-12*a*d+12*b*c)+3//7*d^-3*(a+b*x)^2//3*(c+d*x)^2//3*(b*c+-1*a*d)^2+-3//7*2^2//3*b^-2//3*d^-11//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+-2//7*2^1//6*3^3//4*b^-2//3*d^-11//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^11//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+3//14*2^2//3*3^1//4*b^-2//3*d^-11//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^11//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^5//3*(c+d*x)^-1//3, x) == :(3//7*d^-1*(a+b*x)^5//3*(c+d*x)^2//3+-1//28*d^-2*(a+b*x)^2//3*(c+d*x)^2//3*(-15*a*d+15*b*c)+15//28*2^2//3*b^-2//3*d^-8//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^2*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+5//14*2^1//6*3^3//4*b^-2//3*d^-8//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^8//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-15//56*2^2//3*3^1//4*b^-2//3*d^-8//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^8//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^2//3*(c+d*x)^-1//3, x) == :(3//4*d^-1*(a+b*x)^2//3*(c+d*x)^2//3+-1//4*2^2//3*b^-2//3*d^-5//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1*(-3*a*d+3*b*c)+-1//2*2^1//6*3^3//4*b^-2//3*d^-5//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^5//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+3//8*2^2//3*3^1//4*b^-2//3*d^-5//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^5//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-1//3*(c+d*x)^-1//3, x) == :(3//2*2^2//3*b^-2//3*d^-2//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+2^1//6*3^3//4*b^-2//3*d^-2//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-3//4*2^2//3*3^1//4*b^-2//3*d^-2//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-4//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-1//3*(c+d*x)^2//3*(b*c+-1*a*d)^-1+3//2*2^2//3*b^-2//3*d^1//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+2^1//6*3^3//4*b^-2//3*d^1//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-3//4*2^2//3*3^1//4*b^-2//3*d^1//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-7//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-4//3*(c+d*x)^2//3*(-4*a*d+4*b*c)^-1+3//2*d*(a+b*x)^-1//3*(c+d*x)^2//3*(b*c+-1*a*d)^-2+-3//4*2^2//3*b^-2//3*d^4//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+-1//2*2^1//6*3^3//4*b^-2//3*d^4//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-4//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+3//8*2^2//3*3^1//4*b^-2//3*d^4//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-4//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-10//3*(c+d*x)^-1//3, x) == :(-3*(a+b*x)^-7//3*(c+d*x)^2//3*(-7*a*d+7*b*c)^-1+-15//14*d^2*(a+b*x)^-1//3*(c+d*x)^2//3*(b*c+-1*a*d)^-3+15//28*d*(a+b*x)^-4//3*(c+d*x)^2//3*(b*c+-1*a*d)^-2+15//28*2^2//3*b^-2//3*d^7//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+5//14*2^1//6*3^3//4*b^-2//3*d^7//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-7//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-15//56*2^2//3*3^1//4*b^-2//3*d^7//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-7//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^5//3*(c+d*x)^-2//3, x) == :((1/2)*d^-1*(a+b*x)^5//3*(c+d*x)^1//3+-5//6*b^-1//3*d^-8//3*(b*c+-1*a*d)^2*log(-1+b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3)+-5//18*b^-1//3*d^-8//3*(b*c+-1*a*d)^2*log(c+d*x)+1//6*d^-2*(a+b*x)^2//3*(c+d*x)^1//3*(-5*b*c+5*a*d)+-5//9*3^(1/2)*b^-1//3*d^-8//3*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3))
@test integrate((a+b*x)^2//3*(c+d*x)^-2//3, x) == :(d^-1*(a+b*x)^2//3*(c+d*x)^1//3+b^-1//3*d^-5//3*(b*c+-1*a*d)*log(-1+b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3)+1//3*b^-1//3*d^-5//3*(b*c+-1*a*d)*log(c+d*x)+1//3*3^(1/2)*b^-1//3*d^-5//3*(-2*a*d+2*b*c)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3))
@test integrate((a+b*x)^-1//3*(c+d*x)^-2//3, x) == :(-3//2*b^-1//3*d^-2//3*log(-1+b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3)+-1//2*b^-1//3*d^-2//3*log(c+d*x)+-1*3^(1/2)*b^-1//3*d^-2//3*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//3*d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3))
@test integrate((a+b*x)^-4//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-1//3*(c+d*x)^1//3*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-7//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-4//3*(c+d*x)^1//3*(-4*a*d+4*b*c)^-1+9//4*d*(a+b*x)^-1//3*(c+d*x)^1//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-10//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-7//3*(c+d*x)^1//3*(-7*a*d+7*b*c)^-1+-27//14*d^2*(a+b*x)^-1//3*(c+d*x)^1//3*(b*c+-1*a*d)^-3+9//14*d*(a+b*x)^-4//3*(c+d*x)^1//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-13//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-10//3*(c+d*x)^1//3*(-10*a*d+10*b*c)^-1+-81//140*d^2*(a+b*x)^-4//3*(c+d*x)^1//3*(b*c+-1*a*d)^-3+27//70*d*(a+b*x)^-7//3*(c+d*x)^1//3*(b*c+-1*a*d)^-2+243//140*d^3*(a+b*x)^-1//3*(c+d*x)^1//3*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^7//3*(c+d*x)^-2//3, x) == :(3//8*d^-1*(a+b*x)^7//3*(c+d*x)^1//3+-1//40*d^-2*(a+b*x)^4//3*(c+d*x)^1//3*(-21*a*d+21*b*c)+21//20*d^-3*(a+b*x)^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^2+-7//20*2^1//3*3^3//4*b^-1//3*d^-10//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^4//3*(c+d*x)^-2//3, x) == :(3//5*d^-1*(a+b*x)^4//3*(c+d*x)^1//3+-1//5*d^-2*(a+b*x)^1//3*(c+d*x)^1//3*(-6*a*d+6*b*c)+2//5*2^1//3*3^3//4*b^-1//3*d^-7//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^2*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^1//3*(c+d*x)^-2//3, x) == :(3//2*d^-1*(a+b*x)^1//3*(c+d*x)^1//3+-1//2*2^1//3*3^3//4*b^-1//3*d^-4//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*(b*c+-1*a*d)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-2//3*(c+d*x)^-2//3, x) == :(2^1//3*3^3//4*b^-1//3*d^-1//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-5//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-2//3*(c+d*x)^1//3*(-2*a*d+2*b*c)^-1+-1//2*2^1//3*3^3//4*b^-1//3*d^2//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^-1*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-8//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-5//3*(c+d*x)^1//3*(-5*a*d+5*b*c)^-1+6//5*d*(a+b*x)^-2//3*(c+d*x)^1//3*(b*c+-1*a*d)^-2+2//5*2^1//3*3^3//4*b^-1//3*d^5//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^-2*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-11//3*(c+d*x)^-2//3, x) == :(-3*(a+b*x)^-8//3*(c+d*x)^1//3*(-8*a*d+8*b*c)^-1+-21//20*d^2*(a+b*x)^-2//3*(c+d*x)^1//3*(b*c+-1*a*d)^-3+21//40*d*(a+b*x)^-5//3*(c+d*x)^1//3*(b*c+-1*a*d)^-2+-7//20*2^1//3*3^3//4*b^-1//3*d^8//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^2//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+3^(1/2))^(1/2)*(a+b*x)^-2//3*(c+d*x)^-2//3*(b*c+-1*a*d)^-3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^7//3*(c+d*x)^-4//3, x) == :(-3*d^-1*(a+b*x)^7//3*(c+d*x)^-1//3+-7//3*b^1//3*d^-10//3*(b*c+-1*a*d)^2*log(-1+b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3)+-7//9*b^1//3*d^-10//3*(b*c+-1*a*d)^2*log(a+b*x)+7//2*b*d^-2*(a+b*x)^4//3*(c+d*x)^2//3+-14//3*b*d^-3*(a+b*x)^1//3*(c+d*x)^2//3*(b*c+-1*a*d)+-14//9*3^(1/2)*b^1//3*d^-10//3*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3))
@test integrate((a+b*x)^4//3*(c+d*x)^-4//3, x) == :(-3*d^-1*(a+b*x)^4//3*(c+d*x)^-1//3+2*b^1//3*d^-7//3*(b*c+-1*a*d)*log(-1+b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3)+4*b*d^-2*(a+b*x)^1//3*(c+d*x)^2//3+2//3*b^1//3*d^-7//3*(b*c+-1*a*d)*log(a+b*x)+4//3*3^(1/2)*b^1//3*d^-7//3*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3))
@test integrate((a+b*x)^1//3*(c+d*x)^-4//3, x) == :(-3*d^-1*(a+b*x)^1//3*(c+d*x)^-1//3+-3//2*b^1//3*d^-4//3*log(-1+b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3)+-1//2*b^1//3*d^-4//3*log(a+b*x)+-1*3^(1/2)*b^1//3*d^-4//3*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^1//3*d^-1//3*(a+b*x)^-1//3*(c+d*x)^1//3))
@test integrate((a+b*x)^-2//3*(c+d*x)^-4//3, x) == :(3*(a+b*x)^1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-5//3*(c+d*x)^-4//3, x) == :(-3*(a+b*x)^-2//3*(c+d*x)^-1//3*(-2*a*d+2*b*c)^-1+-9//2*d*(a+b*x)^1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-8//3*(c+d*x)^-4//3, x) == :(-3*(a+b*x)^-5//3*(c+d*x)^-1//3*(-5*a*d+5*b*c)^-1+9//5*d*(a+b*x)^-2//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2+27//5*d^2*(a+b*x)^1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-11//3*(c+d*x)^-4//3, x) == :(-3*(a+b*x)^-8//3*(c+d*x)^-1//3*(-8*a*d+8*b*c)^-1+-243//40*d^3*(a+b*x)^1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-4+-81//40*d^2*(a+b*x)^-2//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-3+27//40*d*(a+b*x)^-5//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^8//3*(c+d*x)^-4//3, x) == :(-3*d^-1*(a+b*x)^8//3*(c+d*x)^-1//3+24//7*b*d^-2*(a+b*x)^5//3*(c+d*x)^2//3+-30//7*b*d^-3*(a+b*x)^2//3*(c+d*x)^2//3*(b*c+-1*a*d)+30//7*2^2//3*b^1//3*d^-11//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^2*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+20//7*2^1//6*3^3//4*b^1//3*d^-11//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^8//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-15//7*2^2//3*3^1//4*b^1//3*d^-11//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^8//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^5//3*(c+d*x)^-4//3, x) == :(-3*d^-1*(a+b*x)^5//3*(c+d*x)^-1//3+15//4*b*d^-2*(a+b*x)^2//3*(c+d*x)^2//3+-15//4*2^2//3*b^1//3*d^-8//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1*(b*c+-1*a*d)+-5//2*2^1//6*3^3//4*b^1//3*d^-8//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^5//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+15//8*2^2//3*3^1//4*b^1//3*d^-8//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^5//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^2//3*(c+d*x)^-4//3, x) == :(-3*d^-1*(a+b*x)^2//3*(c+d*x)^-1//3+3*2^2//3*b^1//3*d^-5//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+2*2^1//6*3^3//4*b^1//3*d^-5//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-3//2*2^2//3*3^1//4*b^1//3*d^-5//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^2//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-1//3*(c+d*x)^-4//3, x) == :(3*(a+b*x)^2//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1+-3//2*2^2//3*b^1//3*d^-2//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+-1*2^1//6*3^3//4*b^1//3*d^-2//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+3//4*2^2//3*3^1//4*b^1//3*d^-2//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-4//3*(c+d*x)^-4//3, x) == :(-3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-1+-6*d*(a+b*x)^2//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2+3*2^2//3*b^1//3*d^1//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+2*2^1//6*3^3//4*b^1//3*d^1//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-4//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+-3//2*2^2//3*3^1//4*b^1//3*d^1//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-4//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((a+b*x)^-7//3*(c+d*x)^-4//3, x) == :(-3*(a+b*x)^-4//3*(c+d*x)^-1//3*(-4*a*d+4*b*c)^-1+15//2*d^2*(a+b*x)^2//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-3+15//4*d*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-2+-15//4*2^2//3*b^1//3*d^4//3*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//3*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*(a*d+b*c+2*b*d*x)^-1+-5//2*2^1//6*3^3//4*b^1//3*d^4//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-7//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.F(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2))+15//8*2^2//3*3^1//4*b^1//3*d^4//3*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^4//3+2*2^1//3*b^2//3*d^2//3*((a+b*x)*(c+d*x))^2//3+-1*2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3*(b*c+-1*a*d)^2//3))^(1/2)*((a+b*x)*(c+d*x))^1//3*((b*c+-1*a*d)^2//3*((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-2*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3))^-1//2*(2+-1*3^(1/2))^(1/2)*(a+b*x)^-1//3*(c+d*x)^-1//3*(b*c+-1*a*d)^-7//3*(a*d+b*c+2*b*d*x)^-1*((b*c+-1*a*d)^2//3+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)*Elliptic.E(arcsin(((b*c+-1*a*d)^2//3*(1+3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)^-1*((b*c+-1*a*d)^2//3*(1+-1*3^(1/2))+2^2//3*b^1//3*d^1//3*((a+b*x)*(c+d*x))^1//3)),-7+-4*3^(1/2)))
@test integrate((1+x)^-1//3*(-1+x)^1//3, x) == :(1//3*log(-1+x)+(1+x)^2//3*(-1+x)^1//3+2//3*3^(1/2)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*(1+x)^1//3*(-1+x)^-1//3)+log(-1+(1+x)^1//3*(-1+x)^-1//3))
@test integrate((a+b*x)^3//2*(c+d*x)^1//4, x) == :(4//11*b^-1*(a+b*x)^5//2*(c+d*x)^1//4+-8//77*b^-1*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//4*(b*c+-1*a*d)^2+1//77*b^-1*d^-1*(a+b*x)^3//2*(c+d*x)^1//4*(-4*a*d+4*b*c)+16//77*b^-5//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^13//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^1//4, x) == :(4//7*b^-1*(a+b*x)^3//2*(c+d*x)^1//4+1//21*b^-1*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//4*(-4*a*d+4*b*c)+-8//21*b^-5//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^9//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^1//4, x) == :(4//3*b^-1*(a+b*x)^(1/2)*(c+d*x)^1//4+4//3*b^-5//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^1//4, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^1//4+2*b^-5//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^1//4, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^1//4+-1//3*d*b^-1*(a+b*x)^-1//2*(c+d*x)^1//4*(b*c+-1*a*d)^-1+-1//3*d*b^-5//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-7//2*(c+d*x)^1//4, x) == :(-2//5*b^-1*(a+b*x)^-5//2*(c+d*x)^1//4+-1//15*d*b^-1*(a+b*x)^-3//2*(c+d*x)^1//4*(b*c+-1*a*d)^-1+1//6*b^-1*d^2*(a+b*x)^-1//2*(c+d*x)^1//4*(b*c+-1*a*d)^-2+1//6*b^-5//4*d^2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^3//4, x) == :(4//13*b^-1*(a+b*x)^5//2*(c+d*x)^3//4+-8//65*b^-1*d^-2*(a+b*x)^(1/2)*(c+d*x)^3//4*(b*c+-1*a*d)^2+1//39*b^-1*d^-1*(a+b*x)^3//2*(c+d*x)^3//4*(-4*a*d+4*b*c)+-16//65*b^-7//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^15//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+16//65*b^-7//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^15//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^3//4, x) == :(4//9*b^-1*(a+b*x)^3//2*(c+d*x)^3//4+1//15*b^-1*d^-1*(a+b*x)^(1/2)*(c+d*x)^3//4*(-4*a*d+4*b*c)+-8//15*b^-7//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+8//15*b^-7//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^3//4, x) == :(4//5*b^-1*(a+b*x)^(1/2)*(c+d*x)^3//4+-12//5*b^-7//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+12//5*b^-7//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^3//4, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^3//4+-6*b^-7//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+6*b^-7//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^3//4, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^3//4+-1*d*b^-1*(a+b*x)^-1//2*(c+d*x)^3//4*(b*c+-1*a*d)^-1+d*b^-7//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+-1*d*b^-7//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-7//2*(c+d*x)^3//4, x) == :(-2//5*b^-1*(a+b*x)^-5//2*(c+d*x)^3//4+-1//5*d*b^-1*(a+b*x)^-3//2*(c+d*x)^3//4*(b*c+-1*a*d)^-1+3//10*b^-1*d^2*(a+b*x)^-1//2*(c+d*x)^3//4*(b*c+-1*a*d)^-2+-3//10*b^-7//4*d^2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+3//10*b^-7//4*d^2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^5//4, x) == :(4//15*b^-1*(a+b*x)^5//2*(c+d*x)^5//4+1//33*b^-2*(a+b*x)^5//2*(c+d*x)^1//4*(-4*a*d+4*b*c)+-8//231*b^-2*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//4*(b*c+-1*a*d)^3+4//231*b^-2*d^-1*(a+b*x)^3//2*(c+d*x)^1//4*(b*c+-1*a*d)^2+16//231*b^-9//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^17//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^5//4, x) == :(4//11*b^-1*(a+b*x)^3//2*(c+d*x)^5//4+1//77*b^-2*(a+b*x)^3//2*(c+d*x)^1//4*(-20*a*d+20*b*c)+20//231*b^-2*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//4*(b*c+-1*a*d)^2+-40//231*b^-9//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^13//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^5//4, x) == :(4//7*b^-1*(a+b*x)^(1/2)*(c+d*x)^5//4+1//21*b^-2*(a+b*x)^(1/2)*(c+d*x)^1//4*(-20*a*d+20*b*c)+20//21*b^-9//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^9//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^5//4, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^5//4+10//3*d*b^-2*(a+b*x)^(1/2)*(c+d*x)^1//4+10//3*b^-9//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^5//4, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^5//4+-5//3*d*b^-2*(a+b*x)^-1//2*(c+d*x)^1//4+5//3*d*b^-9//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-7//2*(c+d*x)^5//4, x) == :(-2//5*b^-1*(a+b*x)^-5//2*(c+d*x)^5//4+-1//3*d*b^-2*(a+b*x)^-3//2*(c+d*x)^1//4+-1//6*b^-2*d^2*(a+b*x)^-1//2*(c+d*x)^1//4*(b*c+-1*a*d)^-1+-1//6*b^-9//4*d^2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-9//2*(c+d*x)^5//4, x) == :(-2//7*b^-1*(a+b*x)^-7//2*(c+d*x)^5//4+-1//7*d*b^-2*(a+b*x)^-5//2*(c+d*x)^1//4+-1//42*b^-2*d^2*(a+b*x)^-3//2*(c+d*x)^1//4*(b*c+-1*a*d)^-1+5//84*b^-2*d^3*(a+b*x)^-1//2*(c+d*x)^1//4*(b*c+-1*a*d)^-2+5//84*b^-9//4*d^3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^5//2*(c+d*x)^-1//4, x) == :(4//13*d^-1*(a+b*x)^5//2*(c+d*x)^3//4+-1//117*d^-2*(a+b*x)^3//2*(c+d*x)^3//4*(-40*a*d+40*b*c)+16//39*d^-3*(a+b*x)^(1/2)*(c+d*x)^3//4*(b*c+-1*a*d)^2+-32//39*b^-3//4*d^-4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^15//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+32//39*b^-3//4*d^-4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^15//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^-1//4, x) == :(4//9*d^-1*(a+b*x)^3//2*(c+d*x)^3//4+1//15*d^-2*(a+b*x)^(1/2)*(c+d*x)^3//4*(-8*b*c+8*a*d)+-16//15*b^-3//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+16//15*b^-3//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-1//4, x) == :(4//5*d^-1*(a+b*x)^(1/2)*(c+d*x)^3//4+-8//5*b^-3//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+8//5*b^-3//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^-1//4, x) == :(-4*b^-3//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+4*b^-3//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^-1//4, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^3//4*(b*c+-1*a*d)^-1+-2*b^-3//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+2*b^-3//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^-1//4, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^3//4*(-3*a*d+3*b*c)^-1+d*(a+b*x)^-1//2*(c+d*x)^3//4*(b*c+-1*a*d)^-2+d*b^-3//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+-1*d*b^-3//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^-3//4, x) == :(4//7*d^-1*(a+b*x)^3//2*(c+d*x)^1//4+1//7*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//4*(-8*b*c+8*a*d)+16//7*b^-1//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^9//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-3//4, x) == :(4//3*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//4+-8//3*b^-1//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^-3//4, x) == :(4*b^-1//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^-3//4, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^1//4*(b*c+-1*a*d)^-1+-2*b^-1//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^-3//4, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^1//4*(-3*a*d+3*b*c)^-1+5//3*d*(a+b*x)^-1//2*(c+d*x)^1//4*(b*c+-1*a*d)^-2+5//3*d*b^-1//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^5//2*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^5//2*(c+d*x)^-1//4+40//9*b*d^-2*(a+b*x)^3//2*(c+d*x)^3//4+-16//3*b*d^-3*(a+b*x)^(1/2)*(c+d*x)^3//4*(b*c+-1*a*d)+-32//3*b^1//4*d^-4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+32//3*b^1//4*d^-4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^3//2*(c+d*x)^-1//4+24//5*b*d^-2*(a+b*x)^(1/2)*(c+d*x)^3//4+-48//5*b^1//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+48//5*b^1//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^(1/2)*(c+d*x)^-1//4+-8*b^1//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+8*b^1//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^-5//4, x) == :(4*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-1+-4*b^1//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+4*b^1//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^-5//4, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^-1//4*(b*c+-1*a*d)^-1+-6*d*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-2+-6*b^1//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+6*b^1//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^-5//4, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^-1//4*(-3*a*d+3*b*c)^-1+7*d^2*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-3+7//3*d*(a+b*x)^-1//2*(c+d*x)^-1//4*(b*c+-1*a*d)^-2+-7*d*b^1//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-9//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+7*d*b^1//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-9//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^7//2*(c+d*x)^-7//4, x) == :(-4//3*d^-1*(a+b*x)^7//2*(c+d*x)^-3//4+56//33*b*d^-2*(a+b*x)^5//2*(c+d*x)^1//4+-80//33*b*d^-3*(a+b*x)^3//2*(c+d*x)^1//4*(b*c+-1*a*d)+160//33*b*d^-4*(a+b*x)^(1/2)*(c+d*x)^1//4*(b*c+-1*a*d)^2+-320//33*b^3//4*d^-5*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^13//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^-7//4, x) == :(-4//3*d^-1*(a+b*x)^3//2*(c+d*x)^-3//4+8//3*b*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//4+-16//3*b^3//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-7//4, x) == :(-4//3*d^-1*(a+b*x)^(1/2)*(c+d*x)^-3//4+8//3*b^3//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^-7//4, x) == :(4*(a+b*x)^(1/2)*(c+d*x)^-3//4*(-3*a*d+3*b*c)^-1+4//3*b^3//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^-7//4, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^-3//4*(b*c+-1*a*d)^-1+-10//3*d*(a+b*x)^(1/2)*(c+d*x)^-3//4*(b*c+-1*a*d)^-2+-10//3*b^3//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^-7//4, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^-3//4*(-3*a*d+3*b*c)^-1+3*d*(a+b*x)^-1//2*(c+d*x)^-3//4*(b*c+-1*a*d)^-2+5*d^2*(a+b*x)^(1/2)*(c+d*x)^-3//4*(b*c+-1*a*d)^-3+5*d*b^3//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-11//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^7//2*(c+d*x)^-9//4, x) == :(-4//5*d^-1*(a+b*x)^7//2*(c+d*x)^-5//4+-56//5*b*d^-2*(a+b*x)^5//2*(c+d*x)^-1//4+112//9*b^2*d^-3*(a+b*x)^3//2*(c+d*x)^3//4+-224//15*b^2*d^-4*(a+b*x)^(1/2)*(c+d*x)^3//4*(b*c+-1*a*d)+-448//15*b^5//4*d^-5*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+448//15*b^5//4*d^-5*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^11//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^5//2*(c+d*x)^-9//4, x) == :(-4//5*d^-1*(a+b*x)^5//2*(c+d*x)^-5//4+-8*b*d^-2*(a+b*x)^3//2*(c+d*x)^-1//4+48//5*b^2*d^-3*(a+b*x)^(1/2)*(c+d*x)^3//4+-96//5*b^5//4*d^-4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+96//5*b^5//4*d^-4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^7//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//2*(c+d*x)^-9//4, x) == :(-4//5*d^-1*(a+b*x)^3//2*(c+d*x)^-5//4+-24//5*b*d^-2*(a+b*x)^(1/2)*(c+d*x)^-1//4+-48//5*b^5//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+48//5*b^5//4*d^-3*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^3//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-9//4, x) == :(-4//5*d^-1*(a+b*x)^(1/2)*(c+d*x)^-5//4+8//5*b*d^-1*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-1+-8//5*b^5//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+8//5*b^5//4*d^-2*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-1//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-1//2*(c+d*x)^-9//4, x) == :(4*(a+b*x)^(1/2)*(c+d*x)^-5//4*(-5*a*d+5*b*c)^-1+12//5*b*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-2+-12//5*b^5//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+12//5*b^5//4*d^-1*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-5//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-3//2*(c+d*x)^-9//4, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^-5//4*(b*c+-1*a*d)^-1+-14//5*d*(a+b*x)^(1/2)*(c+d*x)^-5//4*(b*c+-1*a*d)^-2+-42//5*b*d*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-3+-42//5*b^5//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-9//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+42//5*b^5//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-9//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^-5//2*(c+d*x)^-9//4, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^-5//4*(-3*a*d+3*b*c)^-1+11//3*d*(a+b*x)^-1//2*(c+d*x)^-5//4*(b*c+-1*a*d)^-2+77//15*d^2*(a+b*x)^(1/2)*(c+d*x)^-5//4*(b*c+-1*a*d)^-3+77//5*b*d^2*(a+b*x)^(1/2)*(c+d*x)^-1//4*(b*c+-1*a*d)^-4+-77//5*d*b^5//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-13//4*Elliptic.E(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1)+77//5*d*b^5//4*(-1*d*(b*c+-1*a*d)^-1*(a+b*x))^(1/2)*(a+b*x)^-1//2*(b*c+-1*a*d)^-13//4*Elliptic.F(arcsin(b^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1//4),-1))
@test integrate((a+b*x)^3//4*(c+d*x)^5//4, x) == :(1//3*b^-1*(a+b*x)^7//4*(c+d*x)^5//4+-5//64*b^-9//4*d^-7//4*(b*c+-1*a*d)^3*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+1//24*b^-2*(a+b*x)^7//4*(c+d*x)^1//4*(-5*a*d+5*b*c)+5//64*b^-9//4*d^-7//4*(b*c+-1*a*d)^3*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+5//96*b^-2*d^-1*(a+b*x)^3//4*(c+d*x)^1//4*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^-1//4*(c+d*x)^5//4, x) == :((1/2)*b^-1*(a+b*x)^3//4*(c+d*x)^5//4+-5//16*b^-9//4*d^-3//4*(b*c+-1*a*d)^2*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+1//8*b^-2*(a+b*x)^3//4*(c+d*x)^1//4*(-5*a*d+5*b*c)+5//16*b^-9//4*d^-3//4*(b*c+-1*a*d)^2*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-5//4*(c+d*x)^5//4, x) == :(-4*b^-1*(a+b*x)^-1//4*(c+d*x)^5//4+5*d*b^-2*(a+b*x)^3//4*(c+d*x)^1//4+-5//2*b^-9//4*d^1//4*(b*c+-1*a*d)*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+5//2*b^-9//4*d^1//4*(b*c+-1*a*d)*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-9//4*(c+d*x)^5//4, x) == :(-2*b^-9//4*d^5//4*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+2*b^-9//4*d^5//4*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+-4//5*b^-1*(a+b*x)^-5//4*(c+d*x)^5//4+-4*d*b^-2*(a+b*x)^-1//4*(c+d*x)^1//4)
@test integrate((a+b*x)^-13//4*(c+d*x)^5//4, x) == :(-4*(a+b*x)^-9//4*(c+d*x)^9//4*(-9*a*d+9*b*c)^-1)
@test integrate((a+b*x)^-17//4*(c+d*x)^5//4, x) == :(-4*(a+b*x)^-13//4*(c+d*x)^9//4*(-13*a*d+13*b*c)^-1+16//117*d*(a+b*x)^-9//4*(c+d*x)^9//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-21//4*(c+d*x)^5//4, x) == :(-4*(a+b*x)^-17//4*(c+d*x)^9//4*(-17*a*d+17*b*c)^-1+-128//1989*d^2*(a+b*x)^-9//4*(c+d*x)^9//4*(b*c+-1*a*d)^-3+32//221*d*(a+b*x)^-13//4*(c+d*x)^9//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-25//4*(c+d*x)^5//4, x) == :(-4*(a+b*x)^-21//4*(c+d*x)^9//4*(-21*a*d+21*b*c)^-1+-128//1547*d^2*(a+b*x)^-13//4*(c+d*x)^9//4*(b*c+-1*a*d)^-3+16//119*d*(a+b*x)^-17//4*(c+d*x)^9//4*(b*c+-1*a*d)^-2+512//13923*d^3*(a+b*x)^-9//4*(c+d*x)^9//4*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^5//4*(c+d*x)^5//4, x) == :(2//7*b^-1*(a+b*x)^9//4*(c+d*x)^5//4+1//7*b^-2*(a+b*x)^9//4*(c+d*x)^1//4*(b*c+-1*a*d)+-5//84*b^-2*d^-2*(a+b*x)^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^3+1//42*b^-2*d^-1*(a+b*x)^5//4*(c+d*x)^1//4*(b*c+-1*a*d)^2+5//336*2^(1/2)*b^-9//4*d^-9//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^9//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^1//4*(c+d*x)^5//4, x) == :(2//5*b^-1*(a+b*x)^5//4*(c+d*x)^5//4+1//3*b^-2*(a+b*x)^5//4*(c+d*x)^1//4*(b*c+-1*a*d)+1//6*b^-2*d^-1*(a+b*x)^1//4*(c+d*x)^1//4*(b*c+-1*a*d)^2+-1//24*2^(1/2)*b^-9//4*d^-5//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^7//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-3//4*(c+d*x)^5//4, x) == :(2//3*b^-1*(a+b*x)^1//4*(c+d*x)^5//4+1//3*b^-2*(a+b*x)^1//4*(c+d*x)^1//4*(-5*a*d+5*b*c)+5//12*2^(1/2)*b^-9//4*d^-1//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^5//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-7//4*(c+d*x)^5//4, x) == :(-4//3*b^-1*(a+b*x)^-3//4*(c+d*x)^5//4+10//3*d*b^-2*(a+b*x)^1//4*(c+d*x)^1//4+5//6*2^(1/2)*b^-9//4*d^3//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-11//4*(c+d*x)^5//4, x) == :(-4//7*b^-1*(a+b*x)^-7//4*(c+d*x)^5//4+-20//21*d*b^-2*(a+b*x)^-3//4*(c+d*x)^1//4+5//21*2^(1/2)*b^-9//4*d^7//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^(1/2)*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-15//4*(c+d*x)^5//4, x) == :(-4//11*b^-1*(a+b*x)^-11//4*(c+d*x)^5//4+-20//77*d*b^-2*(a+b*x)^-7//4*(c+d*x)^1//4+-20//231*b^-2*d^2*(a+b*x)^-3//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1+-10//231*2^(1/2)*b^-9//4*d^11//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^-1//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-19//4*(c+d*x)^5//4, x) == :(-4//15*b^-1*(a+b*x)^-15//4*(c+d*x)^5//4+-4//33*d*b^-2*(a+b*x)^-11//4*(c+d*x)^1//4+-4//231*b^-2*d^2*(a+b*x)^-7//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1+8//231*b^-2*d^3*(a+b*x)^-3//4*(c+d*x)^1//4*(b*c+-1*a*d)^-2+4//231*2^(1/2)*b^-9//4*d^15//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^-3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^5//4*(c+d*x)^-1//4, x) == :((1/2)*d^-1*(a+b*x)^5//4*(c+d*x)^3//4+1//8*d^-2*(a+b*x)^1//4*(c+d*x)^3//4*(-5*b*c+5*a*d)+5//16*b^-3//4*d^-9//4*(b*c+-1*a*d)^2*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+5//16*b^-3//4*d^-9//4*(b*c+-1*a*d)^2*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^1//4*(c+d*x)^-1//4, x) == :(d^-1*(a+b*x)^1//4*(c+d*x)^3//4+-1//2*b^-3//4*d^-5//4*(b*c+-1*a*d)*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+-1//2*b^-3//4*d^-5//4*(b*c+-1*a*d)*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-3//4*(c+d*x)^-1//4, x) == :(2*b^-3//4*d^-1//4*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+2*b^-3//4*d^-1//4*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-7//4*(c+d*x)^-1//4, x) == :(-4*(a+b*x)^-3//4*(c+d*x)^3//4*(-3*a*d+3*b*c)^-1)
@test integrate((a+b*x)^-11//4*(c+d*x)^-1//4, x) == :(-4*(a+b*x)^-7//4*(c+d*x)^3//4*(-7*a*d+7*b*c)^-1+16//21*d*(a+b*x)^-3//4*(c+d*x)^3//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-15//4*(c+d*x)^-1//4, x) == :(-4*(a+b*x)^-11//4*(c+d*x)^3//4*(-11*a*d+11*b*c)^-1+-128//231*d^2*(a+b*x)^-3//4*(c+d*x)^3//4*(b*c+-1*a*d)^-3+32//77*d*(a+b*x)^-7//4*(c+d*x)^3//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-19//4*(c+d*x)^-1//4, x) == :(-4*(a+b*x)^-15//4*(c+d*x)^3//4*(-15*a*d+15*b*c)^-1+-128//385*d^2*(a+b*x)^-7//4*(c+d*x)^3//4*(b*c+-1*a*d)^-3+16//55*d*(a+b*x)^-11//4*(c+d*x)^3//4*(b*c+-1*a*d)^-2+512//1155*d^3*(a+b*x)^-3//4*(c+d*x)^3//4*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^7//4*(c+d*x)^-1//4, x) == :(2//5*d^-1*(a+b*x)^7//4*(c+d*x)^3//4+-1//15*d^-2*(a+b*x)^3//4*(c+d*x)^3//4*(-7*a*d+7*b*c)+1//10*b^-1//2*d^-5//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(a*d+b*c+2*b*d*x)^-1*(-7*a*d+7*b*c)+-7//20*2^(1/2)*b^-3//4*d^-11//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^7//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+7//40*2^(1/2)*b^-3//4*d^-11//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^7//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^3//4*(c+d*x)^-1//4, x) == :(2//3*d^-1*(a+b*x)^3//4*(c+d*x)^3//4+-1*b^-1//2*d^-3//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(a*d+b*c+2*b*d*x)^-1+(1/2)*2^(1/2)*b^-3//4*d^-7//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^5//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+-1//4*2^(1/2)*b^-3//4*d^-7//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^5//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-1//4*(c+d*x)^-1//4, x) == :(2*b^-1//2*d^-1//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1*(a*d+b*c+2*b*d*x)^-1+(1/2)*2^(1/2)*b^-3//4*d^-3//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+-1*2^(1/2)*b^-3//4*d^-3//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-5//4*(c+d*x)^-1//4, x) == :(-4*(a+b*x)^-1//4*(c+d*x)^3//4*(b*c+-1*a*d)^-1+4*b^-1//2*d^(1/2)*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2*(a*d+b*c+2*b*d*x)^-1+2^(1/2)*b^-3//4*d^1//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^(1/2)*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+-2*2^(1/2)*b^-3//4*d^1//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^(1/2)*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-9//4*(c+d*x)^-1//4, x) == :(-4*(a+b*x)^-5//4*(c+d*x)^3//4*(-5*a*d+5*b*c)^-1+8//5*d*(a+b*x)^-1//4*(c+d*x)^3//4*(b*c+-1*a*d)^-2+-8//5*b^-1//2*d^3//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3*(a*d+b*c+2*b*d*x)^-1+-2//5*2^(1/2)*b^-3//4*d^5//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+4//5*2^(1/2)*b^-3//4*d^5//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^7//4*(c+d*x)^-3//4, x) == :((1/2)*d^-1*(a+b*x)^7//4*(c+d*x)^1//4+-21//16*b^-1//4*d^-11//4*(b*c+-1*a*d)^2*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+1//8*d^-2*(a+b*x)^3//4*(c+d*x)^1//4*(-7*b*c+7*a*d)+21//16*b^-1//4*d^-11//4*(b*c+-1*a*d)^2*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^3//4*(c+d*x)^-3//4, x) == :(d^-1*(a+b*x)^3//4*(c+d*x)^1//4+(1/2)*b^-1//4*d^-7//4*(-3*a*d+3*b*c)*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+-1//2*b^-1//4*d^-7//4*(-3*a*d+3*b*c)*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-1//4*(c+d*x)^-3//4, x) == :(-2*b^-1//4*d^-3//4*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+2*b^-1//4*d^-3//4*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-5//4*(c+d*x)^-3//4, x) == :(-4*(a+b*x)^-1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-9//4*(c+d*x)^-3//4, x) == :(-4*(a+b*x)^-5//4*(c+d*x)^1//4*(-5*a*d+5*b*c)^-1+16//5*d*(a+b*x)^-1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-13//4*(c+d*x)^-3//4, x) == :(-4*(a+b*x)^-9//4*(c+d*x)^1//4*(-9*a*d+9*b*c)^-1+-128//45*d^2*(a+b*x)^-1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-3+32//45*d*(a+b*x)^-5//4*(c+d*x)^1//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-17//4*(c+d*x)^-3//4, x) == :(-4*(a+b*x)^-13//4*(c+d*x)^1//4*(-13*a*d+13*b*c)^-1+-128//195*d^2*(a+b*x)^-5//4*(c+d*x)^1//4*(b*c+-1*a*d)^-3+16//39*d*(a+b*x)^-9//4*(c+d*x)^1//4*(b*c+-1*a*d)^-2+512//195*d^3*(a+b*x)^-1//4*(c+d*x)^1//4*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^5//4*(c+d*x)^-3//4, x) == :(2//3*d^-1*(a+b*x)^5//4*(c+d*x)^1//4+-1//3*d^-2*(a+b*x)^1//4*(c+d*x)^1//4*(-5*a*d+5*b*c)+5//12*2^(1/2)*b^-1//4*d^-9//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^5//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^1//4*(c+d*x)^-3//4, x) == :(2*d^-1*(a+b*x)^1//4*(c+d*x)^1//4+-1//2*2^(1/2)*b^-1//4*d^-5//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-3//4*(c+d*x)^-3//4, x) == :(2^(1/2)*b^-1//4*d^-1//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^(1/2)*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-7//4*(c+d*x)^-3//4, x) == :(-4*(a+b*x)^-3//4*(c+d*x)^1//4*(-3*a*d+3*b*c)^-1+-2//3*2^(1/2)*b^-1//4*d^3//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^-1//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-11//4*(c+d*x)^-3//4, x) == :(-4*(a+b*x)^-7//4*(c+d*x)^1//4*(-7*a*d+7*b*c)^-1+8//7*d*(a+b*x)^-3//4*(c+d*x)^1//4*(b*c+-1*a*d)^-2+4//7*2^(1/2)*b^-1//4*d^7//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^3//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-3//4*(c+d*x)^-3//4*(b*c+-1*a*d)^-3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^5//4*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^5//4*(c+d*x)^-1//4+5*b*d^-2*(a+b*x)^1//4*(c+d*x)^3//4+-5//2*b^1//4*d^-9//4*(b*c+-1*a*d)*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+-5//2*b^1//4*d^-9//4*(b*c+-1*a*d)*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^1//4*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^1//4*(c+d*x)^-1//4+2*b^1//4*d^-5//4*arctan(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4)+2*b^1//4*d^-5//4*arctanh(b^-1//4*d^1//4*(a+b*x)^1//4*(c+d*x)^-1//4))
@test integrate((a+b*x)^-3//4*(c+d*x)^-5//4, x) == :(4*(a+b*x)^1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-7//4*(c+d*x)^-5//4, x) == :(-4*(a+b*x)^-3//4*(c+d*x)^-1//4*(-3*a*d+3*b*c)^-1+-16//3*d*(a+b*x)^1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-11//4*(c+d*x)^-5//4, x) == :(-4*(a+b*x)^-7//4*(c+d*x)^-1//4*(-7*a*d+7*b*c)^-1+32//21*d*(a+b*x)^-3//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2+128//21*d^2*(a+b*x)^1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-15//4*(c+d*x)^-5//4, x) == :(-4*(a+b*x)^-11//4*(c+d*x)^-1//4*(-11*a*d+11*b*c)^-1+-512//77*d^3*(a+b*x)^1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-4+-128//77*d^2*(a+b*x)^-3//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3+48//77*d*(a+b*x)^-7//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^11//4*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^11//4*(c+d*x)^-1//4+22//5*b*d^-2*(a+b*x)^7//4*(c+d*x)^3//4+-77//15*b*d^-3*(a+b*x)^3//4*(c+d*x)^3//4*(b*c+-1*a*d)+77//10*b^(1/2)*d^-7//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(a*d+b*c+2*b*d*x)^-1*(b*c+-1*a*d)+-77//20*2^(1/2)*b^1//4*d^-15//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^7//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+77//40*2^(1/2)*b^1//4*d^-15//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^7//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^7//4*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^7//4*(c+d*x)^-1//4+14//3*b*d^-2*(a+b*x)^3//4*(c+d*x)^3//4+-7*b^(1/2)*d^-5//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(a*d+b*c+2*b*d*x)^-1+-7//4*2^(1/2)*b^1//4*d^-11//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^5//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+7//2*2^(1/2)*b^1//4*d^-11//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^5//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^3//4*(c+d*x)^-5//4, x) == :(-4*d^-1*(a+b*x)^3//4*(c+d*x)^-1//4+6*b^(1/2)*d^-3//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1*(a*d+b*c+2*b*d*x)^-1+-3*2^(1/2)*b^1//4*d^-7//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+3//2*2^(1/2)*b^1//4*d^-7//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-1//4*(c+d*x)^-5//4, x) == :(4*(a+b*x)^3//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1+-4*b^(1/2)*d^-1//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2*(a*d+b*c+2*b*d*x)^-1+-1*2^(1/2)*b^1//4*d^-3//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^(1/2)*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+2*2^(1/2)*b^1//4*d^-3//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^(1/2)*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-5//4*(c+d*x)^-5//4, x) == :(-4*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1+-8*d*(a+b*x)^3//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2+8*b^(1/2)*d^(1/2)*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3*(a*d+b*c+2*b*d*x)^-1+-4*2^(1/2)*b^1//4*d^1//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+2*2^(1/2)*b^1//4*d^1//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-1//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((a+b*x)^-9//4*(c+d*x)^-5//4, x) == :(-4*(a+b*x)^-5//4*(c+d*x)^-1//4*(-5*a*d+5*b*c)^-1+24//5*d*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-2+48//5*d^2*(a+b*x)^3//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3+-48//5*b^(1/2)*d^3//2*((a*d+b*(c+2*d*x))^2)^(1/2)*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-1*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-4*(a*d+b*c+2*b*d*x)^-1+-12//5*2^(1/2)*b^1//4*d^5//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.F(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2)+24//5*2^(1/2)*b^1//4*d^5//4*((a*d+b*(c+2*d*x))^2)^-1//2*((a*d+b*c+2*b*d*x)^2)^(1/2)*((a+b*x)*(c+d*x))^1//4*((1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)^-2*(a*d+b*(c+2*d*x))^2*(b*c+-1*a*d)^-2)^(1/2)*(a+b*x)^-1//4*(c+d*x)^-1//4*(b*c+-1*a*d)^-3//2*(a*d+b*c+2*b*d*x)^-1*(1+2*b^(1/2)*d^(1/2)*((a+b*x)*(c+d*x))^(1/2)*(b*c+-1*a*d)^-1)*Elliptic.E(2*arctan(2^(1/2)*b^1//4*d^1//4*((a+b*x)*(c+d*x))^1//4*(b*c+-1*a*d)^-1//2),1/2))
@test integrate((1+b*x)^-3//4*(1+-1*a*x)^-1//4, x) == :(2^(1/2)*a^-1//4*b^-3//4*arctan(1+-1*2^(1/2)*a^-1//4*b^1//4*(1+b*x)^-1//4*(1+-1*a*x)^1//4)+(1/2)*2^(1/2)*a^-1//4*b^-3//4*log(a^(1/2)+b^(1/2)*(1+b*x)^-1//2*(1+-1*a*x)^(1/2)+2^(1/2)*a^1//4*b^1//4*(1+b*x)^-1//4*(1+-1*a*x)^1//4)+-1*2^(1/2)*a^-1//4*b^-3//4*arctan(1+2^(1/2)*a^-1//4*b^1//4*(1+b*x)^-1//4*(1+-1*a*x)^1//4)+-1//2*2^(1/2)*a^-1//4*b^-3//4*log(a^(1/2)+b^(1/2)*(1+b*x)^-1//2*(1+-1*a*x)^(1/2)+-1*2^(1/2)*a^1//4*b^1//4*(1+b*x)^-1//4*(1+-1*a*x)^1//4))
@test integrate((1+a*x)^-3//4*(1+-1*a*x)^-1//4, x) == :(2^(1/2)*a^-1*arctan(1+-1*2^(1/2)*(1+a*x)^-1//4*(1+-1*a*x)^1//4)+(1/2)*2^(1/2)*a^-1*log(1+(1+a*x)^-1//2*(1+-1*a*x)^(1/2)+2^(1/2)*(1+a*x)^-1//4*(1+-1*a*x)^1//4)+-1*2^(1/2)*a^-1*arctan(1+2^(1/2)*(1+a*x)^-1//4*(1+-1*a*x)^1//4)+-1//2*2^(1/2)*a^-1*log(1+(1+a*x)^-1//2*(1+-1*a*x)^(1/2)+-1*2^(1/2)*(1+a*x)^-1//4*(1+-1*a*x)^1//4))
@test integrate((a+b*x)^5//2*(c+d*x)^1//6, x) == :(3//11*b^-1*(a+b*x)^7//2*(c+d*x)^1//6+-9//352*b^-1*d^-2*(a+b*x)^3//2*(c+d*x)^1//6*(b*c+-1*a*d)^2+1//176*b^-1*d^-1*(a+b*x)^5//2*(c+d*x)^1//6*(-3*a*d+3*b*c)+81//1408*b^-1*d^-3*(a+b*x)^(1/2)*(c+d*x)^1//6*(b*c+-1*a*d)^3+-81//2816*3^3//4*b^-1*d^-4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^11//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^1//6, x) == :(3//8*b^-1*(a+b*x)^5//2*(c+d*x)^1//6+-27//320*b^-1*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//6*(b*c+-1*a*d)^2+1//80*b^-1*d^-1*(a+b*x)^3//2*(c+d*x)^1//6*(-3*a*d+3*b*c)+27//640*3^3//4*b^-1*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^8//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^1//6, x) == :(3//5*b^-1*(a+b*x)^3//2*(c+d*x)^1//6+1//20*b^-1*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//6*(-3*a*d+3*b*c)+-3//40*3^3//4*b^-1*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^1//6, x) == :(3//2*b^-1*(a+b*x)^(1/2)*(c+d*x)^1//6+1//4*3^3//4*b^-1*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^1//6, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^1//6+1//3*3^3//4*b^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^1//6, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^1//6+-2//9*d*b^-1*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-1+-2//27*d*3^3//4*b^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^5//6, x) == :(3//10*b^-1*(a+b*x)^5//2*(c+d*x)^5//6+-27//224*b^-1*d^-2*(a+b*x)^(1/2)*(c+d*x)^5//6*(b*c+-1*a*d)^2+1//28*b^-1*d^-1*(a+b*x)^3//2*(c+d*x)^5//6*(-3*a*d+3*b*c)+-1//448*b^-5//3*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^3*(81+81*3^(1/2))+-81//448*3^1//4*b^-5//3*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^10//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-27//896*3^3//4*b^-5//3*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^10//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^5//6, x) == :(3//7*b^-1*(a+b*x)^3//2*(c+d*x)^5//6+1//56*b^-1*d^-1*(a+b*x)^(1/2)*(c+d*x)^5//6*(-15*a*d+15*b*c)+1//112*b^-5//3*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^2*(45+45*3^(1/2))+45//112*3^1//4*b^-5//3*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^7//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+15//224*3^3//4*b^-5//3*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^7//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^5//6, x) == :(3//4*b^-1*(a+b*x)^(1/2)*(c+d*x)^5//6+-1//8*b^-5//3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(15+15*3^(1/2))*(b*c+-1*a*d)+-15//8*3^1//4*b^-5//3*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-5//16*3^3//4*b^-5//3*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^4//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^5//6, x) == :(-2*b^-1*(a+b*x)^-1//2*(c+d*x)^5//6+-1*d*b^-5//3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(5+5*3^(1/2))+-5*3^1//4*b^-5//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-1//6*3^3//4*b^-5//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^1//3*(5+-5*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^5//6, x) == :(-2//3*b^-1*(a+b*x)^-3//2*(c+d*x)^5//6+-10//9*d*b^-1*(a+b*x)^-1//2*(c+d*x)^5//6*(b*c+-1*a*d)^-1+-1//9*b^-5//3*d^2*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-1*(10+10*3^(1/2))+-10//9*d*3^1//4*b^-5//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-1//27*d*3^3//4*b^-5//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2//3*(5+-5*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-7//2*(c+d*x)^5//6, x) == :(-2//5*b^-1*(a+b*x)^-5//2*(c+d*x)^5//6+-2//9*d*b^-1*(a+b*x)^-3//2*(c+d*x)^5//6*(b*c+-1*a*d)^-1+8//27*b^-1*d^2*(a+b*x)^-1//2*(c+d*x)^5//6*(b*c+-1*a*d)^-2+1//27*b^-5//3*d^3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-2*(8+8*3^(1/2))+8//27*3^1//4*b^-5//3*d^2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+1//81*3^3//4*b^-5//3*d^2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-5//3*(4+-4*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^5//2*(c+d*x)^-1//6, x) == :(3//10*d^-1*(a+b*x)^5//2*(c+d*x)^5//6+-1//28*d^-2*(a+b*x)^3//2*(c+d*x)^5//6*(-9*a*d+9*b*c)+81//224*d^-3*(a+b*x)^(1/2)*(c+d*x)^5//6*(b*c+-1*a*d)^2+1//448*b^-2//3*d^-3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^3*(243+243*3^(1/2))+243//448*3^1//4*b^-2//3*d^-4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^10//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+81//896*3^3//4*b^-2//3*d^-4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^10//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^-1//6, x) == :(3//7*d^-1*(a+b*x)^3//2*(c+d*x)^5//6+-1//56*d^-2*(a+b*x)^(1/2)*(c+d*x)^5//6*(-27*a*d+27*b*c)+-1//112*b^-2//3*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^2*(81+81*3^(1/2))+-81//112*3^1//4*b^-2//3*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^7//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-27//224*3^3//4*b^-2//3*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^7//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-1//6, x) == :(3//4*d^-1*(a+b*x)^(1/2)*(c+d*x)^5//6+1//8*b^-2//3*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(9+9*3^(1/2))*(b*c+-1*a*d)+9//8*3^1//4*b^-2//3*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+3//16*3^3//4*b^-2//3*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^4//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^-1//6, x) == :(-1*b^-2//3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(3+3*3^(1/2))+-3*3^1//4*b^-2//3*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-1//2*3^3//4*b^-2//3*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^1//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^-1//6, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^5//6*(b*c+-1*a*d)^-1+-1*d*b^-2//3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-1*(2+2*3^(1/2))+-2*3^1//4*b^-2//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-1//3*3^3//4*b^-2//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^-1//6, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^5//6*(-3*a*d+3*b*c)^-1+8//9*d*(a+b*x)^-1//2*(c+d*x)^5//6*(b*c+-1*a*d)^-2+1//9*b^-2//3*d^2*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-2*(8+8*3^(1/2))+8//9*d*3^1//4*b^-2//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+1//27*d*3^3//4*b^-2//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-5//3*(4+-4*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^5//2*(c+d*x)^-5//6, x) == :(3//8*d^-1*(a+b*x)^5//2*(c+d*x)^1//6+-1//16*d^-2*(a+b*x)^3//2*(c+d*x)^1//6*(-9*a*d+9*b*c)+81//64*d^-3*(a+b*x)^(1/2)*(c+d*x)^1//6*(b*c+-1*a*d)^2+-81//128*3^3//4*d^-4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^8//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^-5//6, x) == :(3//5*d^-1*(a+b*x)^3//2*(c+d*x)^1//6+-1//20*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//6*(-27*a*d+27*b*c)+27//40*3^3//4*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-5//6, x) == :(3//2*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//6+-3//4*3^3//4*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^-5//6, x) == :(3^3//4*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^-5//6, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-1+-2//3*3^3//4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^-5//6, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^1//6*(-3*a*d+3*b*c)^-1+16//9*d*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2+16//27*d*3^3//4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-7//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^5//2*(c+d*x)^-7//6, x) == :(-6*d^-1*(a+b*x)^5//2*(c+d*x)^-1//6+45//7*b*d^-2*(a+b*x)^3//2*(c+d*x)^5//6+-405//56*b*d^-3*(a+b*x)^(1/2)*(c+d*x)^5//6*(b*c+-1*a*d)+-1//112*b^1//3*d^-3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^2*(1215+1215*3^(1/2))+-1215//112*3^1//4*b^1//3*d^-4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^7//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-405//224*3^3//4*b^1//3*d^-4*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^7//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^3//2*(c+d*x)^-7//6, x) == :(-6*d^-1*(a+b*x)^3//2*(c+d*x)^-1//6+27//4*b*d^-2*(a+b*x)^(1/2)*(c+d*x)^5//6+1//8*b^1//3*d^-2*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(81+81*3^(1/2))*(b*c+-1*a*d)+81//8*3^1//4*b^1//3*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^4//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+27//16*3^3//4*b^1//3*d^-3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^4//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^(1/2)*(c+d*x)^-7//6, x) == :(-6*d^-1*(a+b*x)^(1/2)*(c+d*x)^-1//6+-1*b^1//3*d^-1*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(9+9*3^(1/2))+-9*3^1//4*b^1//3*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-3//2*3^3//4*b^1//3*d^-2*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^1//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-1//2*(c+d*x)^-7//6, x) == :(6*(a+b*x)^(1/2)*(c+d*x)^-1//6*(b*c+-1*a*d)^-1+b^1//3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-1*(6+6*3^(1/2))+6*3^1//4*b^1//3*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+3^3//4*b^1//3*d^-1*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-2//3*(1+-1*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-3//2*(c+d*x)^-7//6, x) == :(-2*(a+b*x)^-1//2*(c+d*x)^-1//6*(b*c+-1*a*d)^-1+-8*d*(a+b*x)^(1/2)*(c+d*x)^-1//6*(b*c+-1*a*d)^-2+-1*d*b^1//3*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-2*(8+8*3^(1/2))+-8*3^1//4*b^1//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-5//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+-1//3*3^3//4*b^1//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-5//3*(4+-4*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^-5//2*(c+d*x)^-7//6, x) == :(-2*(a+b*x)^-3//2*(c+d*x)^-1//6*(-3*a*d+3*b*c)^-1+20//9*d*(a+b*x)^-1//2*(c+d*x)^-1//6*(b*c+-1*a*d)^-2+80//9*d^2*(a+b*x)^(1/2)*(c+d*x)^-1//6*(b*c+-1*a*d)^-3+1//9*b^1//3*d^2*(a+b*x)^(1/2)*(c+d*x)^1//6*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*(b*c+-1*a*d)^-3*(80+80*3^(1/2))+80//9*d*3^1//4*b^1//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-8//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.E(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2))+1//27*d*3^3//4*b^1//3*(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^2//3+b^2//3*(c+d*x)^2//3+b^1//3*(c+d*x)^1//3*(b*c+-1*a*d)^1//3))^(1/2)*(-1*b^1//3*(c+d*x)^1//3*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-2*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3))^-1//2*(a+b*x)^-1//2*(c+d*x)^1//6*(b*c+-1*a*d)^-8//3*(40+-40*3^(1/2))*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3)*Elliptic.F(arccos(((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+3^(1/2)))^-1*((b*c+-1*a*d)^1//3+-1*b^1//3*(c+d*x)^1//3*(1+-1*3^(1/2)))),1/2+1//4*3^(1/2)))
@test integrate((a+b*x)^1//6*(c+d*x)^5//6, x) == :((1/2)*b^-1*(a+b*x)^7//6*(c+d*x)^5//6+-5//36*b^-11//6*d^-7//6*(b*c+-1*a*d)^2*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-5//144*b^-11//6*d^-7//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+5//144*b^-11//6*d^-7//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-5//72*3^(1/2)*b^-11//6*d^-7//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-1*d^-1*(a+b*x)^1//6*(c+d*x)^5//6*(-5*a*d+5*b*c)+5//72*3^(1/2)*b^-11//6*d^-7//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^1//6*(c+d*x)^-1//6, x) == :(d^-1*(a+b*x)^1//6*(c+d*x)^5//6+-1//3*b^-5//6*d^-7//6*(b*c+-1*a*d)*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//12*b^-5//6*d^-7//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-5//6*d^-7//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//6*3^(1/2)*b^-5//6*d^-7//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//6*3^(1/2)*b^-5//6*d^-7//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^1//6*(c+d*x)^-7//6, x) == :((1/2)*b^1//6*d^-7//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-6*d^-1*(a+b*x)^1//6*(c+d*x)^-1//6+2*b^1//6*d^-7//6*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//2*b^1//6*d^-7//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+3^(1/2)*b^1//6*d^-7//6*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1*3^(1/2)*b^1//6*d^-7//6*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^1//6*(c+d*x)^-13//6, x) == :(6*(a+b*x)^7//6*(c+d*x)^-7//6*(-7*a*d+7*b*c)^-1)
@test integrate((a+b*x)^1//6*(c+d*x)^-19//6, x) == :(6*(a+b*x)^7//6*(c+d*x)^-13//6*(-13*a*d+13*b*c)^-1+36//91*b*(a+b*x)^7//6*(c+d*x)^-7//6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^1//6*(c+d*x)^-25//6, x) == :(6*(a+b*x)^7//6*(c+d*x)^-19//6*(-19*a*d+19*b*c)^-1+72//247*b*(a+b*x)^7//6*(c+d*x)^-13//6*(b*c+-1*a*d)^-2+432//1729*b^2*(a+b*x)^7//6*(c+d*x)^-7//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^1//6*(c+d*x)^-31//6, x) == :(6*(a+b*x)^7//6*(c+d*x)^-25//6*(-25*a*d+25*b*c)^-1+108//475*b*(a+b*x)^7//6*(c+d*x)^-19//6*(b*c+-1*a*d)^-2+1296//6175*b^2*(a+b*x)^7//6*(c+d*x)^-13//6*(b*c+-1*a*d)^-3+7776//43225*b^3*(a+b*x)^7//6*(c+d*x)^-7//6*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^5//6*(c+d*x)^1//6, x) == :((1/2)*b^-1*(a+b*x)^11//6*(c+d*x)^1//6+-5//36*b^-7//6*d^-11//6*(b*c+-1*a*d)^2*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-5//144*b^-7//6*d^-11//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+5//144*b^-7//6*d^-11//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-5//72*3^(1/2)*b^-7//6*d^-11//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-1*d^-1*(a+b*x)^5//6*(c+d*x)^1//6*(b*c+-1*a*d)+5//72*3^(1/2)*b^-7//6*d^-11//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^5//6*(c+d*x)^-5//6, x) == :(d^-1*(a+b*x)^5//6*(c+d*x)^1//6+-1//3*b^-1//6*d^-11//6*(-5*a*d+5*b*c)*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//12*b^-1//6*d^-11//6*(-5*a*d+5*b*c)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-1//6*d^-11//6*(-5*a*d+5*b*c)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//6*3^(1/2)*b^-1//6*d^-11//6*(-5*a*d+5*b*c)*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//6*3^(1/2)*b^-1//6*d^-11//6*(-5*a*d+5*b*c)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^5//6*(c+d*x)^-11//6, x) == :((1/2)*b^5//6*d^-11//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+2*b^5//6*d^-11//6*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-6//5*d^-1*(a+b*x)^5//6*(c+d*x)^-5//6+-1//2*b^5//6*d^-11//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+3^(1/2)*b^5//6*d^-11//6*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1*3^(1/2)*b^5//6*d^-11//6*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^5//6*(c+d*x)^-17//6, x) == :(6*(a+b*x)^11//6*(c+d*x)^-11//6*(-11*a*d+11*b*c)^-1)
@test integrate((a+b*x)^5//6*(c+d*x)^-23//6, x) == :(6*(a+b*x)^11//6*(c+d*x)^-17//6*(-17*a*d+17*b*c)^-1+36//187*b*(a+b*x)^11//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^5//6*(c+d*x)^-29//6, x) == :(6*(a+b*x)^11//6*(c+d*x)^-23//6*(-23*a*d+23*b*c)^-1+72//391*b*(a+b*x)^11//6*(c+d*x)^-17//6*(b*c+-1*a*d)^-2+432//4301*b^2*(a+b*x)^11//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^5//6*(c+d*x)^-35//6, x) == :(6*(a+b*x)^11//6*(c+d*x)^-29//6*(-29*a*d+29*b*c)^-1+108//667*b*(a+b*x)^11//6*(c+d*x)^-23//6*(b*c+-1*a*d)^-2+1296//11339*b^2*(a+b*x)^11//6*(c+d*x)^-17//6*(b*c+-1*a*d)^-3+7776//124729*b^3*(a+b*x)^11//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^7//6*(c+d*x)^-1//6, x) == :((1/2)*d^-1*(a+b*x)^7//6*(c+d*x)^5//6+-7//144*b^-5//6*d^-13//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//12*d^-2*(a+b*x)^1//6*(c+d*x)^5//6*(-7*a*d+7*b*c)+7//36*b^-5//6*d^-13//6*(b*c+-1*a*d)^2*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//144*b^-5//6*d^-13//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-7//72*3^(1/2)*b^-5//6*d^-13//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//72*3^(1/2)*b^-5//6*d^-13//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^7//6*(c+d*x)^-7//6, x) == :(-6*d^-1*(a+b*x)^7//6*(c+d*x)^-1//6+7*b*d^-2*(a+b*x)^1//6*(c+d*x)^5//6+-7//3*b^1//6*d^-13//6*(b*c+-1*a*d)*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-7//12*b^1//6*d^-13//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//12*b^1//6*d^-13//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-7//6*3^(1/2)*b^1//6*d^-13//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//6*3^(1/2)*b^1//6*d^-13//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^7//6*(c+d*x)^-13//6, x) == :((1/2)*b^7//6*d^-13//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+2*b^7//6*d^-13//6*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-6//7*d^-1*(a+b*x)^7//6*(c+d*x)^-7//6+-1//2*b^7//6*d^-13//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+3^(1/2)*b^7//6*d^-13//6*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1*3^(1/2)*b^7//6*d^-13//6*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-6*b*d^-2*(a+b*x)^1//6*(c+d*x)^-1//6)
@test integrate((a+b*x)^7//6*(c+d*x)^-19//6, x) == :(6*(a+b*x)^13//6*(c+d*x)^-13//6*(-13*a*d+13*b*c)^-1)
@test integrate((a+b*x)^7//6*(c+d*x)^-25//6, x) == :(6*(a+b*x)^13//6*(c+d*x)^-19//6*(-19*a*d+19*b*c)^-1+36//247*b*(a+b*x)^13//6*(c+d*x)^-13//6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^7//6*(c+d*x)^-31//6, x) == :(6*(a+b*x)^13//6*(c+d*x)^-25//6*(-25*a*d+25*b*c)^-1+72//475*b*(a+b*x)^13//6*(c+d*x)^-19//6*(b*c+-1*a*d)^-2+432//6175*b^2*(a+b*x)^13//6*(c+d*x)^-13//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^7//6*(c+d*x)^-37//6, x) == :(6*(a+b*x)^13//6*(c+d*x)^-31//6*(-31*a*d+31*b*c)^-1+108//775*b*(a+b*x)^13//6*(c+d*x)^-25//6*(b*c+-1*a*d)^-2+1296//14725*b^2*(a+b*x)^13//6*(c+d*x)^-19//6*(b*c+-1*a*d)^-3+7776//191425*b^3*(a+b*x)^13//6*(c+d*x)^-13//6*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-1//6*(c+d*x)^7//6, x) == :((1/2)*b^-1*(a+b*x)^5//6*(c+d*x)^7//6+-7//144*b^-13//6*d^-5//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-2*(a+b*x)^5//6*(c+d*x)^1//6*(-7*a*d+7*b*c)+7//36*b^-13//6*d^-5//6*(b*c+-1*a*d)^2*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//144*b^-13//6*d^-5//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-7//72*3^(1/2)*b^-13//6*d^-5//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//72*3^(1/2)*b^-13//6*d^-5//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-1//6*(c+d*x)^1//6, x) == :(b^-1*(a+b*x)^5//6*(c+d*x)^1//6+-1//12*b^-7//6*d^-5//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//3*b^-7//6*d^-5//6*(b*c+-1*a*d)*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-7//6*d^-5//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//6*3^(1/2)*b^-7//6*d^-5//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//6*3^(1/2)*b^-7//6*d^-5//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-1//6*(c+d*x)^-5//6, x) == :((1/2)*b^-1//6*d^-5//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+2*b^-1//6*d^-5//6*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//2*b^-1//6*d^-5//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+3^(1/2)*b^-1//6*d^-5//6*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1*3^(1/2)*b^-1//6*d^-5//6*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-1//6*(c+d*x)^-11//6, x) == :(6*(a+b*x)^5//6*(c+d*x)^-5//6*(-5*a*d+5*b*c)^-1)
@test integrate((a+b*x)^-1//6*(c+d*x)^-17//6, x) == :(6*(a+b*x)^5//6*(c+d*x)^-11//6*(-11*a*d+11*b*c)^-1+36//55*b*(a+b*x)^5//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-1//6*(c+d*x)^-23//6, x) == :(6*(a+b*x)^5//6*(c+d*x)^-17//6*(-17*a*d+17*b*c)^-1+72//187*b*(a+b*x)^5//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-2+432//935*b^2*(a+b*x)^5//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-1//6*(c+d*x)^-29//6, x) == :(6*(a+b*x)^5//6*(c+d*x)^-23//6*(-23*a*d+23*b*c)^-1+108//391*b*(a+b*x)^5//6*(c+d*x)^-17//6*(b*c+-1*a*d)^-2+1296//4301*b^2*(a+b*x)^5//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-3+7776//21505*b^3*(a+b*x)^5//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-5//6*(c+d*x)^11//6, x) == :((1/2)*b^-1*(a+b*x)^1//6*(c+d*x)^11//6+-55//144*b^-17//6*d^-1//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-2*(a+b*x)^1//6*(c+d*x)^5//6*(-11*a*d+11*b*c)+55//36*b^-17//6*d^-1//6*(b*c+-1*a*d)^2*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+55//144*b^-17//6*d^-1//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-55//72*3^(1/2)*b^-17//6*d^-1//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+55//72*3^(1/2)*b^-17//6*d^-1//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-5//6*(c+d*x)^5//6, x) == :(b^-1*(a+b*x)^1//6*(c+d*x)^5//6+-1//12*b^-11//6*d^-1//6*(-5*a*d+5*b*c)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//3*b^-11//6*d^-1//6*(-5*a*d+5*b*c)*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//12*b^-11//6*d^-1//6*(-5*a*d+5*b*c)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//6*3^(1/2)*b^-11//6*d^-1//6*(-5*a*d+5*b*c)*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+1//6*3^(1/2)*b^-11//6*d^-1//6*(-5*a*d+5*b*c)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-5//6*(c+d*x)^-1//6, x) == :((1/2)*b^-5//6*d^-1//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+2*b^-5//6*d^-1//6*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//2*b^-5//6*d^-1//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+3^(1/2)*b^-5//6*d^-1//6*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1*3^(1/2)*b^-5//6*d^-1//6*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-5//6*(c+d*x)^-7//6, x) == :(6*(a+b*x)^1//6*(c+d*x)^-1//6*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-5//6*(c+d*x)^-13//6, x) == :(6*(a+b*x)^1//6*(c+d*x)^-7//6*(-7*a*d+7*b*c)^-1+36//7*b*(a+b*x)^1//6*(c+d*x)^-1//6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-5//6*(c+d*x)^-19//6, x) == :(6*(a+b*x)^1//6*(c+d*x)^-13//6*(-13*a*d+13*b*c)^-1+72//91*b*(a+b*x)^1//6*(c+d*x)^-7//6*(b*c+-1*a*d)^-2+432//91*b^2*(a+b*x)^1//6*(c+d*x)^-1//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-5//6*(c+d*x)^-25//6, x) == :(6*(a+b*x)^1//6*(c+d*x)^-19//6*(-19*a*d+19*b*c)^-1+108//247*b*(a+b*x)^1//6*(c+d*x)^-13//6*(b*c+-1*a*d)^-2+1296//1729*b^2*(a+b*x)^1//6*(c+d*x)^-7//6*(b*c+-1*a*d)^-3+7776//1729*b^3*(a+b*x)^1//6*(c+d*x)^-1//6*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-7//6*(c+d*x)^13//6, x) == :(-6*b^-1*(a+b*x)^-1//6*(c+d*x)^13//6+-91//144*b^-19//6*d^1//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+13//2*d*b^-2*(a+b*x)^5//6*(c+d*x)^7//6+91//36*b^-19//6*d^1//6*(b*c+-1*a*d)^2*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+91//144*b^-19//6*d^1//6*(b*c+-1*a*d)^2*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-91//72*3^(1/2)*b^-19//6*d^1//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+91//12*d*b^-3*(a+b*x)^5//6*(c+d*x)^1//6*(b*c+-1*a*d)+91//72*3^(1/2)*b^-19//6*d^1//6*(b*c+-1*a*d)^2*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-7//6*(c+d*x)^7//6, x) == :(-6*b^-1*(a+b*x)^-1//6*(c+d*x)^7//6+7*d*b^-2*(a+b*x)^5//6*(c+d*x)^1//6+-7//12*b^-13//6*d^1//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//3*b^-13//6*d^1//6*(b*c+-1*a*d)*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//12*b^-13//6*d^1//6*(b*c+-1*a*d)*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-7//6*3^(1/2)*b^-13//6*d^1//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+7//6*3^(1/2)*b^-13//6*d^1//6*(b*c+-1*a*d)*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-7//6*(c+d*x)^1//6, x) == :((1/2)*b^-7//6*d^1//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-6*b^-1*(a+b*x)^-1//6*(c+d*x)^1//6+2*b^-7//6*d^1//6*arctanh(b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1//2*b^-7//6*d^1//6*log(b^1//3+d^1//3*(a+b*x)^1//3*(c+d*x)^-1//3+-1*b^1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+3^(1/2)*b^-7//6*d^1//6*arctan(1//3*3^(1/2)+-2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6)+-1*3^(1/2)*b^-7//6*d^1//6*arctan(1//3*3^(1/2)+2//3*3^(1/2)*b^-1//6*d^1//6*(a+b*x)^1//6*(c+d*x)^-1//6))
@test integrate((a+b*x)^-7//6*(c+d*x)^-5//6, x) == :(-6*(a+b*x)^-1//6*(c+d*x)^1//6*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^-7//6*(c+d*x)^-11//6, x) == :(-6*(a+b*x)^-1//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-1+-36//5*d*(a+b*x)^5//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^-7//6*(c+d*x)^-17//6, x) == :(-6*(a+b*x)^-1//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-1+-72//11*d*(a+b*x)^5//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-2+-432//55*b*d*(a+b*x)^5//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^-7//6*(c+d*x)^-23//6, x) == :(-6*(a+b*x)^-1//6*(c+d*x)^-17//6*(b*c+-1*a*d)^-1+-108//17*d*(a+b*x)^5//6*(c+d*x)^-17//6*(b*c+-1*a*d)^-2+-7776//935*d*b^2*(a+b*x)^5//6*(c+d*x)^-5//6*(b*c+-1*a*d)^-4+-1296//187*b*d*(a+b*x)^5//6*(c+d*x)^-11//6*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^m*(a+b*x*(2+m)), x) == :(x*(a+b*x)^(1+m))
@test integrate((a+b*x)^m*(c+d*x)^3, x) == :(b^-4*d^3*(4+m)^-1*(a+b*x)^(4+m)+b^-4*(1+m)^-1*(a+b*x)^(1+m)*(b*c+-1*a*d)^3+3*d*b^-4*(2+m)^-1*(a+b*x)^(2+m)*(b*c+-1*a*d)^2+3*b^-4*d^2*(3+m)^-1*(a+b*x)^(3+m)*(b*c+-1*a*d))
@test integrate((a+b*x)^m*(c+d*x)^2, x) == :(b^-3*d^2*(3+m)^-1*(a+b*x)^(3+m)+b^-3*(1+m)^-1*(a+b*x)^(1+m)*(b*c+-1*a*d)^2+2*d*b^-3*(2+m)^-1*(a+b*x)^(2+m)*(b*c+-1*a*d))
@test integrate((a+b*x)^m*(c+d*x), x) == :(d*b^-2*(2+m)^-1*(a+b*x)^(2+m)+b^-2*(1+m)^-1*(a+b*x)^(1+m)*(b*c+-1*a*d))
@test integrate((a+b*x)^3*(c+d*x)^n, x) == :(b^3*d^-4*(4+n)^-1*(c+d*x)^(4+n)+-1*d^-4*(1+n)^-1*(c+d*x)^(1+n)*(b*c+-1*a*d)^3+-3*b^2*d^-4*(3+n)^-1*(c+d*x)^(3+n)*(b*c+-1*a*d)+3*b*d^-4*(2+n)^-1*(c+d*x)^(2+n)*(b*c+-1*a*d)^2)
@test integrate((a+b*x)^2*(c+d*x)^n, x) == :(b^2*d^-3*(3+n)^-1*(c+d*x)^(3+n)+d^-3*(1+n)^-1*(c+d*x)^(1+n)*(b*c+-1*a*d)^2+-2*b*d^-3*(2+n)^-1*(c+d*x)^(2+n)*(b*c+-1*a*d))
@test integrate((c+d*x)^n*(a+b*x), x) == :(b*d^-2*(2+n)^-1*(c+d*x)^(2+n)+-1*d^-2*(1+n)^-1*(c+d*x)^(1+n)*(b*c+-1*a*d))
@test integrate((c+d*x)^n, x) == :(d^-1*(1+n)^-1*(c+d*x)^(1+n))
@test integrate((a+b*x)^(-4+n)*(c+d*x)^(-1n), x) == :(-1*(3+-1n)^-1*(a+b*x)^(-3+n)*(c+d*x)^(1+-1n)*(b*c+-1*a*d)^-1+2*d*(2+-1n)^-1*(3+-1n)^-1*(a+b*x)^(-2+n)*(c+d*x)^(1+-1n)*(b*c+-1*a*d)^-2+-2*d^2*(1+-1n)^-1*(2+-1n)^-1*(3+-1n)^-1*(a+b*x)^(-1+n)*(c+d*x)^(1+-1n)*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^(-3+n)*(c+d*x)^(-1n), x) == :(-1*(2+-1n)^-1*(a+b*x)^(-2+n)*(c+d*x)^(1+-1n)*(b*c+-1*a*d)^-1+d*(1+-1n)^-1*(2+-1n)^-1*(a+b*x)^(-1+n)*(c+d*x)^(1+-1n)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^(-2+n)*(c+d*x)^(-1n), x) == :(-1*(1+-1n)^-1*(a+b*x)^(-1+n)*(c+d*x)^(1+-1n)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^(-2+-1n)*(c+d*x)^n, x) == :(-1*(1+n)^-1*(a+b*x)^(-1+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^(-3+-1n)*(c+d*x)^n, x) == :(-1*(2+n)^-1*(a+b*x)^(-2+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-1+d*(1+n)^-1*(2+n)^-1*(a+b*x)^(-1+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^(-4+-1n)*(c+d*x)^n, x) == :(-1*(3+n)^-1*(a+b*x)^(-3+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-1+2*d*(2+n)^-1*(3+n)^-1*(a+b*x)^(-2+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-2+-2*d^2*(1+n)^-1*(2+n)^-1*(3+n)^-1*(a+b*x)^(-1+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^(-5+-1n)*(c+d*x)^n, x) == :(-1*(4+n)^-1*(a+b*x)^(-4+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-1+3*d*(3+n)^-1*(4+n)^-1*(a+b*x)^(-3+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-2+-6*d^2*(2+n)^-1*(3+n)^-1*(4+n)^-1*(a+b*x)^(-2+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-3+6*d^3*(1+n)^-1*(2+n)^-1*(3+n)^-1*(4+n)^-1*(a+b*x)^(-1+-1n)*(c+d*x)^(1+n)*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^n*(c+d*x)^(-2+-1n), x) == :((1+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-1+-1n)*(b*c+-1*a*d)^-1)
@test integrate((a+b*x)^n*(c+d*x)^(-3+-1n), x) == :((2+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-2+-1n)*(b*c+-1*a*d)^-1+b*(1+n)^-1*(2+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-1+-1n)*(b*c+-1*a*d)^-2)
@test integrate((a+b*x)^n*(c+d*x)^(-4+-1n), x) == :((3+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-3+-1n)*(b*c+-1*a*d)^-1+2*b*(2+n)^-1*(3+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-2+-1n)*(b*c+-1*a*d)^-2+2*b^2*(1+n)^-1*(2+n)^-1*(3+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-1+-1n)*(b*c+-1*a*d)^-3)
@test integrate((a+b*x)^n*(c+d*x)^(-5+-1n), x) == :((4+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-4+-1n)*(b*c+-1*a*d)^-1+3*b*(3+n)^-1*(4+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-3+-1n)*(b*c+-1*a*d)^-2+6*b^2*(2+n)^-1*(3+n)^-1*(4+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-2+-1n)*(b*c+-1*a*d)^-3+6*b^3*(1+n)^-1*(2+n)^-1*(3+n)^-1*(4+n)^-1*(a+b*x)^(1+n)*(c+d*x)^(-1+-1n)*(b*c+-1*a*d)^-4)
@test integrate((a+b*x)^-2*(c+d*x)^-1, x) == :(-1*(a+b*x)^-1*(b*c+-1*a*d)^-1+d*(b*c+-1*a*d)^-2*log(c+d*x)+-1*d*(b*c+-1*a*d)^-2*log(a+b*x))
@test integrate((a+b*x)^(-1+-1*b*c*(b*c+-1*a*d)^-1)*(c+d*x)^(-1+a*d*(b*c+-1*a*d)^-1), x) == :(-1*b^-1*c^-1*(a+b*x)^(-1*b*c*(b*c+-1*a*d)^-1)*(c+d*x)^(a*d*(b*c+-1*a*d)^-1)+a^-1*b^-1*c^-1*(a+b*x)^(-1*a*d*(b*c+-1*a*d)^-1)*(c+d*x)^(a*d*(b*c+-1*a*d)^-1))
@test integrate((a+b*x)^((b*c+-1*a*d)^-1*(a*d+-2*b*c))*(c+d*x)^((a*d+-1*b*c)^-1*(b*c+-2*a*d)), x) == :(-1*b^-1*c^-1*(a+b*x)^(-1*b*c*(b*c+-1*a*d)^-1)*(c+d*x)^(a*d*(b*c+-1*a*d)^-1)+a^-1*b^-1*c^-1*(a+b*x)^(-1*a*d*(b*c+-1*a*d)^-1)*(c+d*x)^(a*d*(b*c+-1*a*d)^-1))
@test integrate(a+b*x+c*x^2+d*x^3, x) == :(a*x+(1/2)*b*x^2+1//3*c*x^3+1//4*d*x^4)
@test integrate(x^4+-1*x^3, x) == :(-1//4*x^4+1//5*x^5)
@test integrate(-1+x^5, x) == :(-1x+1//6*x^6)
@test integrate(7+4x, x) == :(2*x^2+7x)
@test integrate(4x+pi*x^3, x) == :(2*x^2+1//4*pi*x^4)
@test integrate(2x+5*x^2, x) == :(x^2+5//3*x^3)
@test integrate((1/2)*x^2+1//3*x^3, x) == :(1//6*x^3+1//12*x^4)
@test integrate(3+-5x+2*x^2, x) == :(3x+-5//2*x^2+2//3*x^3)
@test integrate(x^2+x^3+-2x, x) == :(-1*x^2+1//3*x^3+1//4*x^4)
@test integrate(1+-1*x^2+-3*x^5, x) == :(x+-1//2*x^6+-1//3*x^3)
@test integrate(5+2x+3*x^2+4*x^3, x) == :(x^2+x^3+x^4+5x)
@test integrate(a+b*x^-1+c*x^-2+d*x^-3, x) == :(a*x+b*log(x)+-1*c*x^-1+-1//2*d*x^-2)
@test integrate(x+x^-5+x^5, x) == :((1/2)*x^2+-1//4*x^-4+1//6*x^6)
@test integrate(x^-1+x^-3+x^-2, x) == :(-1*x^-1+-1//2*x^-2+log(x))
@test integrate(-2*x^-2+3*x^-1, x) == :(2*x^-1+3*log(x))
@test integrate(x^6+-1//7*x^-6, x) == :(1//7*x^7+1//35*x^-5)
@test integrate(1+x+x^-1, x) == :(x+(1/2)*x^2+log(x))
@test integrate(-3*x^-3+4*x^-2, x) == :(-4*x^-1+3//2*x^-2)
@test integrate(x^-1+x^2+2x, x) == :(x^2+1//3*x^3+log(x))
@test integrate(x^5//6+-1*x^3, x) == :(-1//4*x^4+6//11*x^11//6)
@test integrate(33+x^1//33, x) == :(33x+33//34*x^34//33)
@test integrate((1/2)*x^-1//2+2*x^(1/2), x) == :(x^(1/2)+4//3*x^3//2)
@test integrate(-1*x^-2+6*x^(1/2)+10*x^-1, x) == :(x^-1+4*x^3//2+10*log(x))
@test integrate(x^-3//2+x^3//2, x) == :(-2*x^-1//2+2//5*x^5//2)
@test integrate(-5*x^3//2+7*x^5//2, x) == :(-2*x^5//2+2*x^7//2)
@test integrate(x^(1/2)+2*x^-1//2+-1//2*x, x) == :(4*x^(1/2)+-1//4*x^2+2//3*x^3//2)
@test integrate(x^3//2+-2*x^-1+1//5*x^(1/2), x) == :(-2*log(x)+2//5*x^5//2+2//15*x^3//2)
|
Require Import Raxiom Rconvenient IZR Repsilon Rapprox Rseq.
Require Import Arith.
Module Rfunction (Import T : CReals).
Module Rconvenient := Rconvenient T. Import Rconvenient.
Module IZR := IZR T. Import IZR.
Module Repsilon := Repsilon T. Import Repsilon.
Module Rsequence := Rsequence T. Import Rsequence.
Module Rapprox := Rapprox T. Import Rapprox.
Definition Rcont_pt (f : R -> R) (x : R) : Type :=
forall e, R0 < e ->
sigT (fun d =>
prod
(R0 < d)
(forall x', Rdist x x' d -> Rdist (f x) (f x') e)).
Definition Rcont (f : R -> R) : Type := forall x, Rcont_pt f x.
Definition Rcont_op (op : R -> R -> R) : Type :=
prod
(forall a, Rcont (op a))
(forall a, Rcont (fun x => op x a)).
Lemma Rcont_add : Rcont_op Radd.
Admitted.
Lemma Rcont_mul : Rcont_op Rmul.
Admitted.
Lemma Rcont_sub : Rcont_op Rsub.
Admitted.
Lemma Rcont_opp : Rcont Ropp.
Admitted.
Lemma Rcont_compose : forall f g, Rcont f -> Rcont g -> Rcont (fun x => f (g x)).
Proof.
intros f g cf cg x e epos.
destruct (cf (g x) e epos) as (d, (dpos, hd)).
destruct (cg x d dpos) as (c, (cpos, hc)).
eauto.
Qed.
(* TODO : dire que ~~A→A est plus faible que ~A\/A *)
(* TODO : formuler la décision de l'égalité *)
(* TODO : dire que (WEAK Rle → Rle) → Décision de l'égalité *)
End Rfunction. |
module Sort (A : Set)(_<_ : A → A → Set) where |
module ListSearch
data NatList : Type where
Nil : NatList
Cons : (x : Nat) -> (tail : NatList) -> NatList
data Contains : (k : Nat) -> (xs : NatList) -> Type where
Here : Contains k (Cons k tail)
There : (later : Contains k tail) -> Contains k (Cons x tail)
total
emptyNoContains : Not (Contains k Nil)
emptyNoContains Here impossible
emptyNoContains (There _) impossible
total
neitherHeadNorTail : (k : Nat) -> (x : Nat) -> (tail : NatList) -> Not (k = x) -> Not (Contains k tail) -> Not (Contains k (Cons x tail))
neitherHeadNorTail k x tail k_neq_x k_not_in_tail in_cons = case in_cons of
Here => k_neq_x Refl
(There later) => k_not_in_tail later
total
testContains : (k : Nat) -> (xs : NatList) -> Dec (Contains k xs)
testContains k [] = No emptyNoContains
testContains k (Cons x tail) = case decEq k x of
(Yes Refl) => Yes Here
(No contra) =>
case testContains k tail of
(Yes prf) => Yes (There prf)
(No contra2) => No (neitherHeadNorTail k x tail contra contra2)
total
insert : Nat -> NatList -> NatList
insert k xs = case testContains k xs of
(Yes prf) => xs
(No contra) => Cons k xs
total
insertProved : (k : Nat) -> (xs : NatList) -> (xs' : NatList ** Contains k xs')
insertProved k xs = case testContains k xs of
(Yes prf) => (xs ** prf)
(No contra) => (Cons k xs ** Here)
|
function out = zoom(varargin)
%ZOOM Zoom in and out on a 2-D plot.
% ZOOM with no arguments toggles the zoom state.
% ZOOM(FACTOR) zooms the current axis by FACTOR.
% Note that this does not affect the zoom state.
% ZOOM ON turns zoom on for the current figure.
% ZOOM OFF turns zoom off in the current figure.
% ZOOM OUT returns the plot to its initial (full) zoom.
% ZOOM XON or ZOOM YON turns zoom on for the x or y axis only.
% ZOOM RESET clears the zoom out point.
%
% When zoom is on, click the left mouse button to zoom in on the
% point under the mouse. Click the right mouse button to zoom out
% (shift-click on the Macintosh). Each time you click, the axes
% limits will be changed by a factor of 2 (in or out). You can also
% click and drag to zoom into an area. Double clicking zooms out to
% the point at which zoom was first turned on for this figure. Note
% that turning zoom on, then off does not reset the zoom point.
% This may be done explicitly with ZOOM RESET.
%
% ZOOM(FIG,OPTION) applies the zoom command to the figure specified
% by FIG. OPTION can be any of the above arguments.
% ZOOM FILL scales a plot such that it is as big as possible
% within the axis position rectangle for any azimuth and elevation.
% Clay M. Thompson 1-25-93
% Revised 11 Jan 94 by Steven L. Eddins
% Copyright (c) 1984-97 by The MathWorks, Inc.
% $Revision: 1399 $ $Date: 2006-08-11 11:19:27 +0200 (Fr, 11 Aug 2006) $
% Note: zoom uses the userdata of the zlabel of the axis and
% the figure buttondown and buttonmotion functions
%
% ZOOM XON zooms x-axis only
% ZOOM YON zooms y-axis only
switch nargin
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% No Input Arguments %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
case 0
fig=get(groot,'currentfigure');
if isempty(fig), return, end
zoomCommand='toggle';
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% One Input Argument %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
case 1
% If the argument is a string, the argument is a zoom command
% (i.e. (on, off, down, xdown, etc.). Otherwise, the argument is
% assumed to be a figure handle, in which case all we do is
% toggle the zoom status.
if ischar(varargin{1})
fig=get(groot,'currentfigure');
if isempty(fig), return, end
zoomCommand=varargin{1};
else
scale_factor=varargin{1};
zoomCommand='scale';
fig = gcf;
end % if
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Two Input Arguments %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 2
fig=varargin{1};
zoomCommand=varargin{2};
otherwise
narginchk(0, 2);
end % switch nargin
%
% handle 'off' commands first
%
if strcmp(zoomCommand,'off')
%
% turn off zoom, and take a hike
%
fcns = getappdata(fig,'ZOOMFigureFcns');
if ~isempty(fcns)
set(fig,'windowbuttondownfcn',fcns.wbdf,'windowbuttonupfcn',fcns.wbuf,...
'windowbuttonmotionfcn',fcns.wbmf,'buttondownfcn',fcns.bdf);
rmappdata(fig,'ZOOMFigureFcns');
end
return
end % if
ax=get(fig,'currentaxes');
rbbox_mode = 0;
zoomx = 1; zoomy = 1; % Assume no constraints
zoomCommand=lower(zoomCommand);
if ~isempty(isempty(ax)) && any(get(ax,'view')~=[0 90]) && ...
~(strcmp(zoomCommand,'scale') | strcmp(zoomCommand,'fill'))
return % Do nothing
end
if strcmp(zoomCommand,'toggle')
fcns = getappdata(fig,'ZOOMFigureFcns');
if isempty(fcns)
zoom(fig,'on');
else
zoom(fig,'off');
end
return
end % if
% Catch constrained zoom
if strcmp(zoomCommand,'xdown')
zoomy = 0; zoomCommand = 'down'; % Constrain y
elseif strcmp(zoomCommand,'ydown')
zoomx = 0; zoomCommand = 'down'; % Constrain x
end
if strcmp(zoomCommand,'down')
% Activate axis that is clicked in
allAxes = findobj(get(fig,'Children'),'flat','type','axes');
ZOOM_found = 0;
for i=1:length(allAxes)
ax=allAxes(i);
ZOOM_Pt1 = get(ax,'CurrentPoint');
xlim = get(ax,'xlim');
ylim = get(ax,'ylim');
if (xlim(1) <= ZOOM_Pt1(1,1) & ZOOM_Pt1(1,1) <= xlim(2) & ...
ylim(1) <= ZOOM_Pt1(1,2) & ZOOM_Pt1(1,2) <= ylim(2))
ZOOM_found = 1;
set(fig,'currentaxes',ax);
break
end % if
end % for
if ZOOM_found==0, return, end
% Check for selection type
selection_type = get(fig,'SelectionType');
if (strcmp(selection_type, 'normal'))
% Zoom in
m = 1;
scale_factor = 2; % the default zooming factor
elseif (strcmp(selection_type, 'open'))
% Zoom all the way out
zoom(fig,'out');
return;
else
% Zoom partially out
m = -1;
scale_factor = 2;
end
ZOOM_Pt1 = get_currentpoint(ax);
ZOOM_Pt2 = ZOOM_Pt1;
center = ZOOM_Pt1;
if (m == 1)
% Zoom in
units = get(fig,'units'); set(fig,'units','pixels')
rbbox([get(fig,'currentpoint') 0 0],get(fig,'currentpoint'));
ZOOM_Pt2 = get_currentpoint(ax);
set(fig,'units',units)
% Note the currentpoint is set by having a non-trivial up function.
if min(abs(ZOOM_Pt1-ZOOM_Pt2)) >= ...
min(.01*[diff(get_xlim(ax)) diff(get_ylim(ax))])
% determine axis from rbbox
a = [ZOOM_Pt1;ZOOM_Pt2]; a = [min(a);max(a)];
% Undo the effect of get_currentpoint for log axes
if strcmp(get(ax,'XScale'),'log')
a(1:2) = 10.^a(1:2);
end
if strcmp(get(ax,'YScale'),'log')
a(3:4) = 10.^a(3:4);
end
rbbox_mode = 1;
end
end
limits = zoom(fig,'getlimits');
elseif strcmp(zoomCommand,'scale')
if all(get(ax,'view')==[0 90]), % 2D zooming with scale_factor
% Activate axis that is clicked in
ZOOM_found = 0;
ax = gca;
xlim = get(ax,'xlim');
ylim = get(ax,'ylim');
ZOOM_Pt1 = [sum(xlim)/2 sum(ylim)/2];
ZOOM_Pt2 = ZOOM_Pt1;
center = ZOOM_Pt1;
if (xlim(1) <= ZOOM_Pt1(1,1) & ZOOM_Pt1(1,1) <= xlim(2) & ...
ylim(1) <= ZOOM_Pt1(1,2) & ZOOM_Pt1(1,2) <= ylim(2))
ZOOM_found = 1;
end % if
if ZOOM_found==0, return, end
if (scale_factor >= 1)
m = 1;
else
m = -1;
end
else % 3D
old_CameraViewAngle = get(ax,'CameraViewAngle')*pi/360;
ncva = atan(tan(old_CameraViewAngle)*(1/scale_factor))*360/pi;
set(ax,'CameraViewAngle',ncva);
return;
end
limits = zoom(fig,'getlimits');
elseif strcmp(zoomCommand,'on')
fcns = getappdata(fig,'ZOOMFigureFcns');
if isempty(fcns)
fcns.wbdf = get(fig,'windowbuttondownfcn');
fcns.wbuf = get(fig,'windowbuttonupfcn');
fcns.wbmf = get(fig,'windowbuttonmotionfcn');
fcns.bdf = get(fig,'buttondownfcn');
setappdata(fig,'ZOOMFigureFcns',fcns);
end
set(fig,'windowbuttondownfcn','zoom down', ...
'windowbuttonupfcn','ones;', ...
'windowbuttonmotionfcn','','buttondownfcn','', ...
'interruptible','on');
set(ax,'interruptible','on')
return
elseif strcmp(zoomCommand, 'reset')
hZlabel = get(ax, 'Zlabel');
ZlabelUserData = get(hZlabel, 'UserData');
if IsZoomData(ZlabelUserData)
set(hZlabel, 'UserData', []);
end
return
elseif strcmp(zoomCommand,'xon')
zoom(fig,'on') % Set up userprop
set(fig,'windowbuttondownfcn','zoom xdown', ...
'windowbuttonupfcn','ones;', ...
'windowbuttonmotionfcn','','buttondownfcn','',...
'interruptible','on');
set(ax,'interruptible','on')
return
elseif strcmp(zoomCommand,'yon')
zoom(fig,'on') % Set up userprop
set(fig,'windowbuttondownfcn','zoom ydown', ...
'windowbuttonupfcn','ones;', ...
'windowbuttonmotionfcn','','buttondownfcn','',...
'interruptible','on');
set(ax,'interruptible','on')
return
elseif strcmp(zoomCommand,'out')
limits = zoom(fig,'getlimits');
center = [sum(get_xlim(ax))/2 sum(get_ylim(ax))/2];
m = -inf; % Zoom totally out
elseif strcmp(zoomCommand,'getlimits'), % Get axis limits
limits = get(get(ax,'ZLabel'),'UserData');
% Do simple checking of userdata
if size(limits,2)==4 && size(limits,1)<=2
if all(limits(1,[1 3])<limits(1,[2 4]))
getlimits = 0; out = limits(1,:); return % Quick return
else
getlimits = -1; % Don't munge data
end
else
if isempty(limits), getlimits = 1; else getlimits = -1; end
end
% If I've made it to here, we need to compute appropriate axis
% limits.
if isempty(get(get(ax,'ZLabel'),'userdata'))
% Use quick method if possible
xlim = get_xlim(ax); xmin = xlim(1); xmax = xlim(2);
ylim = get_ylim(ax); ymin = ylim(1); ymax = ylim(2);
elseif strcmp(get(ax,'xLimMode'),'auto') && ...
strcmp(get(ax,'yLimMode'),'auto')
% Use automatic limits if possible
xlim = get_xlim(ax); xmin = xlim(1); xmax = xlim(2);
ylim = get_ylim(ax); ymin = ylim(1); ymax = ylim(2);
else
% Use slow method only if someone else is using the userdata
h = get(ax,'Children');
xmin = inf; xmax = -inf; ymin = inf; ymax = -inf;
for i=1:length(h)
t = get(h(i),'Type');
if ~strcmp(t,'text')
if strcmp(t,'image'), % Determine axis limits for image
x = get(h(i),'Xdata'); y = get(h(i),'Ydata');
x = [min(min(x)) max(max(x))];
y = [min(min(y)) max(max(y))];
[ma,na] = size(get(h(i),'Cdata'));
if na>1, dx = diff(x)/(na-1); else dx = 1; end
if ma>1, dy = diff(y)/(ma-1); else dy = 1; end
x = x + [-dx dx]/2; y = y + [-dy dy]/2;
end
xmin = min(xmin,min(min(x)));
xmax = max(xmax,max(max(x)));
ymin = min(ymin,min(min(y)));
ymax = max(ymax,max(max(y)));
end
end
% Use automatic limits if in use (override previous calculation)
if strcmp(get(ax,'xLimMode'),'auto')
xlim = get_xlim(ax); xmin = xlim(1); xmax = xlim(2);
end
if strcmp(get(ax,'yLimMode'),'auto')
ylim = get_ylim(ax); ymin = ylim(1); ymax = ylim(2);
end
end
limits = [xmin xmax ymin ymax];
if getlimits~=-1, % Don't munge existing userdata.
% Store limits in ZLabel userdata
set(get(ax,'ZLabel'),'UserData',limits);
end
out = limits;
return
elseif strcmp(zoomCommand,'getconnect'), % Get connected axes
limits = get(get(ax,'ZLabel'),'UserData');
if all(size(limits)==[2 4]), % Do simple checking
out = limits(2,[1 2]);
else
out = [ax ax];
end
return
elseif strcmp(zoomCommand,'fill')
old_view = get(ax,'view');
view(45,45);
set(ax,'CameraViewAngleMode','auto');
set(ax,'CameraViewAngle',get(ax,'CameraViewAngle'));
view(old_view);
return
else
error(['Unknown option: ',zoomCommand,'.']);
end
%
% Actual zoom operation
%
if ~rbbox_mode
xmin = limits(1); xmax = limits(2);
ymin = limits(3); ymax = limits(4);
if m==(-inf)
dx = xmax-xmin;
dy = ymax-ymin;
else
dx = diff(get_xlim(ax))*(scale_factor.^(-m-1)); dx = min(dx,xmax-xmin);
dy = diff(get_ylim(ax))*(scale_factor.^(-m-1)); dy = min(dy,ymax-ymin);
end
% Limit zoom.
center = max(center,[xmin ymin] + [dx dy]);
center = min(center,[xmax ymax] - [dx dy]);
a = [max(xmin,center(1)-dx) min(xmax,center(1)+dx) ...
max(ymin,center(2)-dy) min(ymax,center(2)+dy)];
% Check for log axes and return to linear values.
if strcmp(get(ax,'XScale'),'log')
a(1:2) = 10.^a(1:2);
end
if strcmp(get(ax,'YScale'),'log')
a(3:4) = 10.^a(3:4);
end
end
% Check for v4-type equal
fillequal = strcmp(get(ax,'plotboxaspectratiomode'),'manual') & ...
strcmp(get(ax,'dataaspectratiomode'),'manual');
pbar = get(ax,'plotboxaspectratio');
% Update circular list of connected axes
list = zoom(fig,'getconnect'); % Circular list of connected axes.
if zoomx
if a(1)==a(2), return, end % Short circuit if zoom is moot.
if fillequal & (pbar(1) < pbar(2))
set(ax,'xlimmode','auto')
else
set(ax,'xlim',a(1:2))
end
h = list(1);
while h ~= ax
if fillequal & zoomx & zoomy & (pbar(1) < pbar(2))
set(h,'xlimmode','auto')
else
set(h,'xlim',a(1:2))
end
% Get next axes in the list
next = get(get(h,'ZLabel'),'UserData');
if all(size(next)==[2 4]), h = next(2,1); else h = ax; end
end
end
if zoomy
if a(3)==a(4), return, end % Short circuit if zoom is moot.
if fillequal & (pbar(1) >= pbar(2))
set(ax,'ylimmode','auto')
else
set(ax,'ylim',a(3:4))
end
h = list(2);
while h ~= ax
if fillequal & zoomx & zoomy & (pbar(1) >= pbar(2))
set(h,'ylimmode','auto')
else
set(h,'ylim',a(3:4))
end
% Get next axes in the list
next = get(get(h,'ZLabel'),'UserData');
if all(size(next)==[2 4]), h = next(2,2); else h = ax; end
end
end
function bZoomData = IsZoomData(data)
% Return 1 if the data represents zoom data
% Return 0 if someone else is using user data
if size(data,2)==4 && size(data,1)<=2
if all(data(1,[1 3])<data(1,[2 4]))
bZoomData = 1;
else
bZoomData = 0;
end
else
bZoomData = 0;
end
function p = get_currentpoint(ax)
%GET_CURRENTPOINT Return equivalent linear scale current point
p = get(ax,'currentpoint'); p = p(1,1:2);
if strcmp(get(ax,'XScale'),'log')
p(1) = log10(p(1));
end
if strcmp(get(ax,'YScale'),'log')
p(2) = log10(p(2));
end
function xlim = get_xlim(ax)
%GET_XLIM Return equivalent linear scale xlim
xlim = get(ax,'xlim');
if strcmp(get(ax,'XScale'),'log')
xlim = log10(xlim);
end
function ylim = get_ylim(ax)
%GET_YLIM Return equivalent linear scale ylim
ylim = get(ax,'ylim');
if strcmp(get(ax,'YScale'),'log')
ylim = log10(ylim);
end
|
Formal statement is: lemma map_poly_cong: assumes "(\<And>x. x \<in> set (coeffs p) \<Longrightarrow> f x = g x)" shows "map_poly f p = map_poly g p" Informal statement is: If $f(x) = g(x)$ for all $x$ in the set of coefficients of a polynomial $p$, then $f(p) = g(p)$. |
SUBROUTINE CSYR( UPLO, N, ALPHA, X, INCX, A, LDA )
*
* -- PBLAS auxiliary routine (version 2.0) --
* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
* and University of California, Berkeley.
* April 1, 1998
*
* .. Scalar Arguments ..
CHARACTER*1 UPLO
INTEGER INCX, LDA, N
COMPLEX ALPHA
* ..
* .. Array Arguments ..
COMPLEX A( LDA, * ), X( * )
* ..
*
* Purpose
* =======
*
* CSYR performs the symmetric rank 1 operation
*
* A := alpha*x*x' + A,
*
* where alpha is a complex scalar, x is an n element vector and A is an
* n by n SY matrix.
*
* Arguments
* =========
*
* UPLO (input) CHARACTER*1
* On entry, UPLO specifies which part of the matrix A is to be
* referenced as follows:
*
* UPLO = 'L' or 'l' the lower trapezoid of A is referenced,
*
* UPLO = 'U' or 'u' the upper trapezoid of A is referenced,
*
* otherwise all of the matrix A is referenced.
*
* N (input) INTEGER
* On entry, N specifies the order of the matrix A. N must be at
* least zero.
*
* ALPHA (input) COMPLEX
* On entry, ALPHA specifies the scalar alpha.
*
* X (input) COMPLEX array of dimension at least
* ( 1 + ( n - 1 )*abs( INCX ) ). Before entry, the incremented
* array X must contain the vector x.
*
* INCX (input) INTEGER
* On entry, INCX specifies the increment for the elements of X.
* INCX must not be zero.
*
* A (input/output) COMPLEX array
* On entry, A is an array of dimension (LDA,N). Before entry
* with UPLO = 'U' or 'u', the leading n by n part of the array
* A must contain the upper triangular part of the symmetric ma-
* trix and the strictly lower triangular part of A is not refe-
* renced. On exit, the upper triangular part of the array A is
* overwritten by the upper triangular part of the updated ma-
* trix. When UPLO = 'L' or 'l', the leading n by n part of the
* the array A must contain the lower triangular part of the
* symmetric matrix and the strictly upper trapezoidal part of A
* is not referenced. On exit, the lower triangular part of the
* array A is overwritten by the lower triangular part of the
* updated matrix.
*
* LDA (input) INTEGER
* On entry, LDA specifies the leading dimension of the array A.
* LDA must be at least max( 1, N ).
*
* =====================================================================
*
* .. Parameters ..
COMPLEX ZERO
PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ) )
* ..
* .. Local Scalars ..
INTEGER I, INFO, IX, J, JX, KX
COMPLEX TEMP
* ..
* .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
* ..
* .. External Subroutines ..
EXTERNAL XERBLA
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
INFO = 1
ELSE IF( N.LT.0 ) THEN
INFO = 2
ELSE IF( INCX.EQ.0 ) THEN
INFO = 5
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = 7
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CSYR', INFO )
RETURN
END IF
*
* Quick return if possible.
*
IF( ( N.EQ.0 ) .OR. ( ALPHA.EQ.ZERO ) )
$ RETURN
*
* Set the start point in X if the increment is not unity.
*
KX = 1
IF( INCX.LE.0 ) THEN
KX = 1 - ( N-1 )*INCX
ELSE IF( INCX.NE.1 ) THEN
KX = 1
END IF
*
* Start the operations. In this version the elements of A are
* accessed sequentially with one pass through the triangular part
* of A.
*
IF( LSAME( UPLO, 'U' ) ) THEN
*
* Form A when A is stored in upper triangle.
*
IF( INCX.EQ.1 ) THEN
DO 20 J = 1, N
IF( X( J ).NE.ZERO ) THEN
TEMP = ALPHA*X( J )
DO 10 I = 1, J
A( I, J ) = A( I, J ) + X( I )*TEMP
10 CONTINUE
END IF
20 CONTINUE
ELSE
JX = KX
DO 40 J = 1, N
IF( X( JX ).NE.ZERO ) THEN
TEMP = ALPHA*X( JX )
IX = KX
DO 30 I = 1, J
A( I, J ) = A( I, J ) + X( IX )*TEMP
IX = IX + INCX
30 CONTINUE
END IF
JX = JX + INCX
40 CONTINUE
END IF
ELSE
*
* Form A when A is stored in lower triangle.
*
IF( INCX.EQ.1 ) THEN
DO 60 J = 1, N
IF( X( J ).NE.ZERO ) THEN
TEMP = ALPHA*X( J )
DO 50 I = J, N
A( I, J ) = A( I, J ) + X( I )*TEMP
50 CONTINUE
END IF
60 CONTINUE
ELSE
JX = KX
DO 80 J = 1, N
IF( X( JX ).NE.ZERO ) THEN
TEMP = ALPHA*X( JX )
IX = JX
DO 70 I = J, N
A( I, J ) = A( I, J ) + X( IX )*TEMP
IX = IX + INCX
70 CONTINUE
END IF
JX = JX + INCX
80 CONTINUE
END IF
END IF
*
RETURN
*
* End of CSYR
*
END
|
# Announcements
- No Problem Set this week, Problem Set 4 will be posted on 9/28.
- Stay on at the end of lecture if you want to ask questions about Problem Set 3.
<style>
@import url(https://www.numfys.net/static/css/nbstyle.css);
</style>
<a href="https://www.numfys.net"></a>
# Ordinary Differential Equations - higher order methods
<section class="post-meta">
Based on notes and notebooks by Niels Henrik Aase, Thorvald Ballestad, Vasilis Paschalidis and Jon Andreas Støvneng
</section>
## Algorithms for initial value problem ODEs
Assume we have a first-order differential equation which can be expressed in the form
$$ \frac{dy}{dt} = g(y,t) $$
We will solve this on constant-interval mesh of the independent variable $t$ defined by
$$ t_n = t_0 + n h $$
### Forward-Euler method
In Lecture 10 we derived Euler's method, which simply solves the first-order forward difference approximation to $dy/dt$
$$ \frac{y_{i+1}-y_i}{h} = g(y_i,t_i)$$
as
$$ y_{i+1} = y_i + h g(y_i,t_i) \label{Euler_fwd}\tag{3}$$
```python
# Importing the necessary libraries
import numpy as np # NumPy is used to generate arrays and to perform some mathematical operations
import matplotlib.pyplot as plt # Used for plotting results
```
```python
def forwardEuler_step(t, y, h, g, *P):
"""
Implements a single step of the forward-Euler finite-difference scheme
Parameters:
t: time t
y: Numerical approximation of y at time t
h: Step size
g: RHS of our ODE (RHS = Right hand side). Can be any function with signature g(t,y,*P).
*P: tuple of parameters, arguments to g
Returns:
next_y: Numerical approximation of y at time t+h
"""
next_y = y + h*g(t, y, *P)
return next_y
```
We now need some sort of framework which will take this function and do the integration for us. Let's rewrite `full_Euler` from Lecture 10 to be more general:
```python
def odeSolve(t0, y0, tmax, h, g, method, *P):
""" A full numerical aproximation of an ODE in a set time interval. Performs consecutive steps of `method`
with step size h from start time until the end time. Also takes into account the initial values of the ODE
Parameters:
t0: start time
y0 : Initial condition for y at t = t0
tmax: The end of the interval where the `method` is integrated, t_N
h: Step size
g: RHS of our ODE (RHS = Right hand side). Can be any function with signature g(t,y,*P).
*P: tuple of parameters, arguments to g
Returns:
t_list: Evenly spaced discrete list of time with spacing h.
Starting time = start_t, and end time = end_t
y_list: Numerical approximation of y at times t_list
"""
# make the t-mesh; guarantees we stop precisely at tmax
t_list = np.arange(t0,tmax+h,h)
# allocate space for the solution
y_list = np.zeros_like(t_list)
# set the initial condition
y_list[0] = y0
# find out the size of the t-mesh, and then integrate forward one meshpoint per iteration of the loop
n, = t_list.shape
for i in range(0,n-1):
y_list[i+1] = method(t_list[i], y_list[i], h, g, *P)
# return the solution
return t_list,y_list
```
Armed with this machinery, let's set up another simple problem and try it out.
Last time, we looked at exponential growth, let's solve exponential decay this time:
$$ \frac{dy}{dt} = - c y, \quad y[0] = 1 $$
First, we provide a function to implement the RHS:
```python
def expRHS(t, y, c):
"""
Implements the RHS (y'(x)) of the DE
"""
return -c*y
```
Now we set up the problem to compute and plot the result, along with a plot of the magnitude of the fractional error
### Runge-Kutta Schemes
The idea of the Runge-Kutta schemes is to take advantage of derivative information at the times between $t_i$ and $t_{i+1}$ to increase the order of accuracy.
For example, in the midpoint method, the derivative at the initial time is used to approximate the derivative at the midpoint of the interval, $f(y_i+\frac{1}{2}hf(y_i,t_i), t_i+\frac{1}{2}h)$. The derivative at the midpoint is then used to advance the solution to the next step. The method can be written in two stages $k_i$,
$$ \begin{aligned} \begin{array}{l} k_1 = h f(y_i,t_i)\\ k_2 = h f(y_i+\frac{1}{2}k_1, t_n+\frac{1}{2}h)\\ y_{i+1} = y_i + k_2 \end{array} \end{aligned}\label{RK2}\tag{4} $$
The midpoint method is known as a __2nd-order Runge-Kutta__ formula.
In general, an explicit 2-stage Runge-Kutta method can be written as,
$$ \begin{array}{l} k_1 = h f(y_n,t_n)\\ k_2 = h f(y_n+b_{21}k_1, t_n+a_2h)\ \\ y_{n+1} = y_n + c_1k_1 +c_2k_2 \label{explicitrk2}\tag{5}\end{array} $$
The scheme is said to be *explicit* since a given stage does not depend *implicitly* on itself, as in the backward Euler method , or on a later stage.
Other explicit second-order schemes can be derived by comparing Eq.(\ref{explicitrk2}) to other second-order expansions and matching terms to determine the coefficients $a_2$, $b_{21}$, $c_1$ and $c_2$.
### Explicit Fourth-Order Runge-Kutta Method
Explicit Runge-Kutta methods are popular as each stage can be calculated with one function evaluation. In contrast, implicit Runge-Kutta methods usually involves solving a non-linear system of equations in order to evaluate the stages. As a result, explicit schemes are much less expensive to implement than implicit schemes.
The higher-order Runge-Kutta methods can be derived by in manner similar to the midpoint formula. An s-stage method is compared to a Taylor method and the terms are matched up to the desired order.
As it happens to be, <strong>The Fourth Order Runge-Kutta Method</strong> uses three such test-points and is the most widely used Runge-Kutta Method. You might ask why we don't use five, ten or even more test-points, and the answer is quite simple: It is not computationally free to calculate all these test-points, and the gain in accuracy rapidly decreases beyond the fourth order of the method. That is, if high precision is of such importance that you would require a tenth-order Runge-Kutta, then you're better off reducing the step size $h$, than increasing the order of the method.
Also, there exists other more sophisticated methods which can be both faster and more accurate for equivalent choices of $h$, but obviously, may be a lot more complicated to implement. See for instance <i>Richardson Extrapolation</i>, <i>the Bulirsch-Stoer method</i>, <i>Multistep methods, Multivalue methods</i> and <i>Predictor-Corrector methods</i>.
The classic fourth-order Runge-Kutta formula is:
$$ \begin{array}{l} k_1 = h f(y_n,t_n)\\ k_2 = h f(y_n+\frac{k_1}{2}, t_n+\frac{h}{2})\\ k_3 = h f(y_n+\frac{k_2}{2}, t_n+\frac{h}{2})\\ k_4 = h f(y_n+k_3, t_n+h)\\ y_{n+1} = y_n + \frac{k_1}{6}+ \frac{k_2}{3}+ \frac{k_3}{3} + \frac{k_4}{6} \label{RK4}\tag{6}\end{array} $$
```python
def RK2_step(t, y, h, g, *P):
"""
Implements a single step of the second-order, explicit midpoint method
"""
thalf = t + 0.5*h
k1 = h * g(t, y, *P)
k2 = h * g(thalf, y + 0.5*k1, *P)
return y +k2
```
```python
def RK4_step(t, y, h, g, *P):
"""
Implements a single step of a fourth-order, explicit Runge-Kutta scheme
"""
thalf = t + 0.5*h
k1 = h * g(t, y, *P)
k2 = h * g(thalf, y + 0.5*k1, *P)
k3 = h * g(thalf, y + 0.5*k2, *P)
k4 = h * g(t + h, y + k3, *P)
return y + (k1 + 2*k2 + 2*k3 + k4)/6
```
```python
# set up problem
c = 1.0
h = 0.5
t0 = 0.0
y0 = 1.0
tmax = 5.0
# call the solver for RK2
t, y = odeSolve(t0, y0, tmax, h, expRHS, RK2_step, c)
# plot the result
fig,ax = plt.subplots(1,2)
ans = np.exp(-c*t)
ax[0].plot(t,ans,'r')
ax[0].set_xlabel('t')
ax[0].set_ylabel('y')
ax[0].plot(t,y,'o','RK2')
err_RK2 = np.abs((ans-y)/ans)
# call the solver for Euler
t, y = odeSolve(t0, y0, tmax, h, expRHS, forwardEuler_step, c)
ax[0].plot(t,y,'o','Euler')
err = np.abs((ans-y)/ans)
# call the solver for RK2
t, y4 = odeSolve(t0, y0, tmax, h, expRHS, RK4_step, c)
ax[0].plot(t,y4,'o','RK4')
err_RK4 = np.abs((ans-y4)/ans)
# along with the errors
err_RK2 = np.abs((ans-y)/ans)
ax[1].plot(t, err_RK2, 'o',label = "RK2")
ax[1].plot(t, err_RK4, 'o',label = "RK4")
ax[1].plot(t, err, 'o',label = "Euler")
ax[1].set_xlabel('t')
ax[1].set_ylabel('fractional error')
ax[1].legend()
# now also overplot the error we calculated for forward-Euler
# this gives better spacing between axes
plt.tight_layout()
plt.show()
```
### Systems of First-Order ODEs
Next, we turn to systems of ODE's. We'll take as our example the Lotke-Volterra equations, a simple model of population dynamics in an ecosystem (with many other uses as well).
Imagine a population of rabbits and of foxes on a small island. The rabbits eat a plentiful supply of grass and
would breed like, well, rabbits, with their population increasing exponentially with time in the absence of preditors. The foxes eat the rabbits, and would die out exponentially in time with no food supply. The rate at which foxes eat rabbits depends upon the product of the fox and rabbit populations.
The equations for the population of the rabbits $R$ and foxes $F$ in this simple model is then
\begin{eqnarray*}
\frac{dR}{dt} &= \alpha R - \beta R F \\
\frac{dF}{dt} &= \delta R F - \gamma F
\end{eqnarray*}
Without the cross terms in $RF$, these are just two decay equations of the form we have used as an example above.
A random set of parameters (I am not a biologist!) might be that a rabbit lives four years, so $\alpha=1/4$ and
a fox lives 10 years, so $\gamma=1/10$. Let's pick the other parameters as $\beta = 1$ and $\delta = 1/4$.
We can express the unknown populations as a vector of length two: $y = (R, F)$. The rate of change of populations then can also be expressed as a vector $dy/dt = (dR/dt, DF/dt)$. With such a definition, we can write the RHS function of our system as
```python
def lvRHS(t, y, *P):
# Lotke-Volterra system RHS
# unpack the parameters from the array P
alpha, beta, gamma, delta = P
# make temporary variables with rabbit and fox populations
R = y[0]
F = y[1]
# LV system
dRdt = alpha * R - beta * R * F
dFdt = delta * R * F - gamma * F
# return an array of derivatives with same order as input vector
return np.array([ dRdt, dFdt ])
```
We now have to generalize our odeSolve function to allow more than one equation
```python
def odeSolve(t0, y0, tmax, h, RHS, method, *P):
"""
ODE driver with constant step-size, allowing systems of ODE's
"""
# make array of times and find length of array
t = np.arange(t0,tmax+h,h)
ntimes, = t.shape
# find out if we are solving a scalar ODE or a system of ODEs, and allocate space accordingly
if type(y0) in [int, float]: # check if primitive type -- means only one eqn
neqn = 1
y = np.zeros( ntimes )
else: # otherwise assume a numpy array -- a system of more than one eqn
neqn, = y0.shape
y = np.zeros( (ntimes, neqn) )
# set first element of solution to initial conditions (possibly a vector)
y[0] = y0
# march on...
for i in range(0,ntimes-1):
y[i+1] = method(t[i], y[i], h, RHS, *P)
return t,y
```
Now we can solve our system of two coupled ODEs. Note that the solution is now a vector of 2D vectors... the first index is the solution time, the second the variable:
```python
alpha = 1.0
beta = 0.025
gamma = 0.4
delta = 0.01
h = 0.2
t0 = 0.0
y0 = np.array([ 30, 10 ])
tmax = 50
# call the solver
t, y = odeSolve(t0, y0, tmax, h, lvRHS, RK4_step, alpha, beta, gamma, delta)
fig,ax = plt.subplots()
ax.plot(t,y[:,0],'b', label='prey')
ax.plot(t,y[:,1],'r', label='preditor')
ax.set_xlabel('time')
ax.set_ylabel('population')
ax.legend()
plt.tight_layout()
plt.show()
```
### Higher Order Derivatives and Sets of 1st order ODEs
The trick to solving ODEs with higher derivatives is turning them into systems of first-order ODEs.
As a simple example, consider the second-order differential equation describing the van der Pol oscillator
$$ \frac{d^2 x}{dt^2} - a (1-x^2) \frac{dx}{dt} + x = 0 $$
We turn this into a pair of first-order ODEs by defining an auxiliary function $v(t) = dx/dt$ and writing the system as
\begin{align}
\begin{split}
\frac{dv}{dt} &= a (1-x^2) v - x\\
\frac{dx}{dt} &= v
\end{split}
\end{align}
Note that there are only functions (and the independent variable) on the RHS; all "differentials" are on the LHS.
Now that we have a system of first-order equations ,we can proceed as above. A function describing
the RHS of this system is
```python
def vdpRHS(t, y, a):
# we store our function as the array [x, x']
return np.array([
y[1], # dx/dt = v
a*(1-y[0]**2)*y[1] - y[0] # dv/dt = a*(1-x**2)*v - x
])
```
```python
a = 15 # parameter
h = 0.01
t0 = 0.0
y0 = np.array([ 0, 1])
tmax = 50
# call the solver
t, y = odeSolve(t0, y0, tmax, h, vdpRHS, RK4_step, a)
fig,ax = plt.subplots()
ax.plot(t,y[:,0],'b', label='x')
ax.plot(t,y[:,1],'r--', label='v')
ax.set_xlabel('time')
ax.legend()
ax.set_title(f"van der Pol Oscillator for a={a}")
plt.tight_layout()
plt.show()
```
A somewhat more complex example is the Lane-Emden equation, which is really just Poisson's equation in spherical symmetry for the graviational potential of a self-gravitating fluid whose pressure is related to its density as $P\propto\rho^\gamma$. Such a system is called a _polytrope_, and is often used in astrophysics as a simple model for the structure of system such as a a star in which outward pressure and inward gravity are in equilibrium.
Let $\xi$ be the dimensionless radius of the system, and let $\theta$ be related to the density as
$\rho = \rho_c \theta^n$, where $\rho_c$ is the density at the origin and $n = 1/(\gamma-1)$. We then have the dimensionless second-order differential equation
$$ \frac{1}{\xi^2}\frac{d}{d\xi}\left(\xi^2\frac{d\theta}{d\xi}\right) + \theta^n = 0 $$
Note that the first term is just the divergence $\nabla\cdot\theta$ in spherical symmetry.
If we expand out the first term, we have
$$ \frac{d^2\theta}{d\xi^2} + \frac{2}{\xi}\frac{d\theta}{d\xi} + \theta^n = 0 $$
Defining an auxiliary function $v(\xi) = d\theta/d\xi$, we can then convert this into a system of two first-order ODEs:
\begin{align}
\begin{split}
\frac{dv}{d\xi} &= -\frac{2}{\xi} v - \theta^n \\
\frac{d\theta}{d\xi} &= v
\end{split}
\end{align}
Again, we have "derivatives" only on the LHS and no derivatives on the RHS of our system.
Looking at this expression, one can see right away that at the origin $\xi=0$ we will have a numerical problem; we are dividing by zero.
Analytically, this is not a problem, since $v/\xi\rightarrow0$ as $\xi\rightarrow0$, but here we need to address this numerically.
The first approach is to take care of the problem in our RHS function:
```python
def leRHS(x, y, n):
dthetadx = y[1]
if x==0:
dvdx = -y[0]**n
else:
dvdx = -2/x*y[1] - y[0]**n
return np.array([ dthetadx, dvdx ])
```
This is somewhat clunky, however, and you would first have to convince yourself that in fact $v(\xi)\rightarrow0$ faster than $\xi$ (don't just take my word for it!).
Instead, we could use a more direct RHS function
```python
def leRHS(x, y, n):
dthetadx = y[1]
dvdx = -2/x*y[1] - y[0]**n
return np.array([ dthetadx, dvdx ])
```
and expand the solution in a Taylor series about the origin to get a starting value for our numerical integration at a small distance away from the origin. To do this, write
$$\theta(\xi) = a_0 + a_1 \xi + a_2 \xi^2 + \dots$$
The first thing to notice is that, by symmetry, only even powers of $\xi$ will appear in the solution.
Thus we will have
$$ \theta(\xi) = a_0 + a_2 \xi^2 + a_4 \xi^4 + \dots$$
By the boundary condition $\theta(0) = 1$, we have immediately that $a_0 = 1$.
Next, substitute $\theta(\xi) = 1 + a_2 \xi^2 + a_4 \xi ^4 + O(\xi^6)$ into the Lane-Emden equation. $\theta$ and its first two derivatives are
\begin{align}
\begin{split}
\theta(\xi) &= 1 + a_2 \xi^2 + a_4 \xi^4 + O(\xi^6)\\
\theta'(\xi) &= 2 a_2 \xi + 4 a_4 \xi^3 + O(\xi^5) \\
\theta''(\xi) &= 2 a_2 + 12 a_4 \xi^2 + O(\xi^4)
\end{split}
\end{align}
Putting these into the Lane-Emden equation, we have
\begin{align}
\begin{split}
2 a_2 + 12 a_4 \xi^2 + O(\xi^4) + \frac{2}{\xi} (2 a_2 x + 4 a_4 \xi^3 + O(\xi^5)) &= -\theta^n \\
6 a_2 + 20 a_4 \xi^2 + O(\xi^4) &= -\theta^n
\end{split}
\end{align}
A boundary condition $\theta(0)=1$, and thus we have $a_2 = -1/6$. Away from zero, then, we have
\begin{align}
\begin{split}
-1 + 20 a_4 \xi^2 + O(\xi^4) &= -\left(1 - 1/6 \xi^2 + a_4 \xi^4 + O(\xi^6)\right)^n
\end{split}
\end{align}
The term on the RHS is $ 1 - n \xi^2/6 + O(\xi^4)$, and so we must have $a_4 = n/120$.
Thus, the series expansion of the solution around the origin is
$$ \theta(\xi) = 1 - \frac{1}{6}\xi^2 + \frac{n}{120} \xi^4 + \dots $$
We can now use this expansion to take a first step slightly away from the origin before beginning our
numerical integration, thus avoiding the divide by zero. Note that this series solution near the origin is $O(h^5)$ and so is a good match for RK4 if we take the same (or smaller) step-size.
```python
n = 3
xi0 = 0.01 # starting value of xi for our numerical integration
theta0 = 1 - xi0**2/6 + n*xi0**4/120 # Taylor series solution to the DE near zero derived above
theta0p = -xi0/3 + n*xi0**3/30
y0 = np.array([ theta0, theta0p]) # set IC's for numerical integration
print(f"IC at {xi0:10.5e}: {y0[0]:10.5e}, {y0[1]:10.5e}")
h = 0.1
tmax = 8
# call the solver
t, y = odeSolve(xi0, y0, tmax, h, leRHS, RK4_step, n)
fig,ax = plt.subplots()
ax.plot(t,y[:,0],'b', label=r'$\theta(\xi)$')
ax.plot(t,y[:,1],'r--', label=r'$\frac{d\theta}{d\xi}$')
ax.plot([0,tmax],[0,0],'k')
ax.set_xlabel(r'$\xi$')
ax.set_title(f"Lane Emden Equation for n={n}")
ax.legend()
plt.tight_layout()
plt.show()
```
For values of $n\le5$, the solutions of the Lane Emden equation (the so-called Lane-Emden functions of index $n$) decrease to zero at finite $\xi$. Since this is the radius at which the density goes to zero, we can interpret it as the surface of the self-gravitating body (for example, the radius of the star). Knowing this value $\xi_1$ is thus interesting... Let us see how to determine it numerically.
Cleary, we are looking for the solution to $\theta(\xi_1)=0$; this is just root-finding, which we already know how to do. Instead of using some closed-form function, however, the value of the function $\theta(\xi)$ must in this case be determined numerically. But we have just figured out how to do this!
Let's use the bisection method for our root-finding algorithm; here is a quick version (no error checking!)
```python
def bisection(func, low, high, eps, *P):
flow = func(low, *P)
fhigh = func(high, *P)
mid = 0.5*(low+high)
fmid = func(mid,*P)
while (high-low)> eps:
if fmid*flow < 0:
high = mid
fhigh = fmid
else:
low = mid
flow = mid
mid = 0.5*(low+high)
fmid = func(mid,*P)
return low
```
Now let us make a function which returns $\theta(\xi)$, the solution to the Lane-Emden equation at $\xi$
```python
def theta(xi, n):
h = 1e-4
xi0 = 1e-4
theta0 = 1 - xi0**2/6 + n*xi0**4/120
theta0p = -xi0/3 + n*xi0**3/30
y0 = np.array([ theta0, theta0p])
t, y = odeSolve(xi0, y0, xi, h, leRHS, RK4_step, n)
return y[-1,0]
```
Using these, we can compute the surface radius of the polytrope
```python
n = 3
xi1 = bisection(theta, 6, 8, 1e-5, n)
print(f"xi_1 = {xi1:7.5f}")
```
A more careful treatment gives a value $\xi_1 = 6.89685...$, so we are doing pretty well...
```python
```
|
/-
Copyright (c) 2019 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen
-/
import algebra.associated
import algebra.regular.basic
import linear_algebra.matrix.mv_polynomial
import linear_algebra.matrix.polynomial
import ring_theory.polynomial.basic
import tactic.linarith
import tactic.ring_exp
/-!
# Cramer's rule and adjugate matrices
The adjugate matrix is the transpose of the cofactor matrix.
It is calculated with Cramer's rule, which we introduce first.
The vectors returned by Cramer's rule are given by the linear map `cramer`,
which sends a matrix `A` and vector `b` to the vector consisting of the
determinant of replacing the `i`th column of `A` with `b` at index `i`
(written as `(A.update_column i b).det`).
Using Cramer's rule, we can compute for each matrix `A` the matrix `adjugate A`.
The entries of the adjugate are the determinants of each minor of `A`.
Instead of defining a minor to be `A` with row `i` and column `j` deleted, we
replace the `i`th row of `A` with the `j`th basis vector; this has the same
determinant as the minor but more importantly equals Cramer's rule applied
to `A` and the `j`th basis vector, simplifying the subsequent proofs.
We prove the adjugate behaves like `det A • A⁻¹`.
## Main definitions
* `matrix.cramer A b`: the vector output by Cramer's rule on `A` and `b`.
* `matrix.adjugate A`: the adjugate (or classical adjoint) of the matrix `A`.
## References
* https://en.wikipedia.org/wiki/Cramer's_rule#Finding_inverse_matrix
## Tags
cramer, cramer's rule, adjugate
-/
namespace matrix
universes u v
variables {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α]
open_locale matrix big_operators
open equiv equiv.perm finset
section cramer
/-!
### `cramer` section
Introduce the linear map `cramer` with values defined by `cramer_map`.
After defining `cramer_map` and showing it is linear,
we will restrict our proofs to using `cramer`.
-/
variables (A : matrix n n α) (b : n → α)
/--
`cramer_map A b i` is the determinant of the matrix `A` with column `i` replaced with `b`,
and thus `cramer_map A b` is the vector output by Cramer's rule on `A` and `b`.
If `A ⬝ x = b` has a unique solution in `x`, `cramer_map A` sends the vector `b` to `A.det • x`.
Otherwise, the outcome of `cramer_map` is well-defined but not necessarily useful.
-/
def cramer_map (i : n) : α := (A.update_column i b).det
lemma cramer_map_is_linear (i : n) : is_linear_map α (λ b, cramer_map A b i) :=
{ map_add := det_update_column_add _ _,
map_smul := det_update_column_smul _ _ }
lemma cramer_is_linear : is_linear_map α (cramer_map A) :=
begin
split; intros; ext i,
{ apply (cramer_map_is_linear A i).1 },
{ apply (cramer_map_is_linear A i).2 }
end
/--
`cramer A b i` is the determinant of the matrix `A` with column `i` replaced with `b`,
and thus `cramer A b` is the vector output by Cramer's rule on `A` and `b`.
If `A ⬝ x = b` has a unique solution in `x`, `cramer A` sends the vector `b` to `A.det • x`.
Otherwise, the outcome of `cramer` is well-defined but not necessarily useful.
-/
def cramer (A : matrix n n α) : (n → α) →ₗ[α] (n → α) :=
is_linear_map.mk' (cramer_map A) (cramer_is_linear A)
lemma cramer_apply (i : n) : cramer A b i = (A.update_column i b).det := rfl
lemma cramer_transpose_apply (i : n) : cramer Aᵀ b i = (A.update_row i b).det :=
by rw [cramer_apply, update_column_transpose, det_transpose]
lemma cramer_transpose_row_self (i : n) :
Aᵀ.cramer (A i) = pi.single i A.det :=
begin
ext j,
rw [cramer_apply, pi.single_apply],
split_ifs with h,
{ -- i = j: this entry should be `A.det`
subst h,
simp only [update_column_transpose, det_transpose, update_row, function.update_eq_self] },
{ -- i ≠ j: this entry should be 0
rw [update_column_transpose, det_transpose],
apply det_zero_of_row_eq h,
rw [update_row_self, update_row_ne (ne.symm h)] }
end
lemma cramer_row_self (i : n) (h : ∀ j, b j = A j i) :
A.cramer b = pi.single i A.det :=
begin
rw [← transpose_transpose A, det_transpose],
convert cramer_transpose_row_self Aᵀ i,
exact funext h
end
@[simp] lemma cramer_one : cramer (1 : matrix n n α) = 1 :=
begin
ext i j,
convert congr_fun (cramer_row_self (1 : matrix n n α) (pi.single i 1) i _) j,
{ simp },
{ intros j, rw [matrix.one_eq_pi_single, pi.single_comm] }
end
lemma cramer_smul (r : α) (A : matrix n n α) :
cramer (r • A) = r ^ (fintype.card n - 1) • cramer A :=
linear_map.ext $ λ b, funext $ λ _, det_update_column_smul' _ _ _ _
@[simp] lemma cramer_subsingleton_apply [subsingleton n] (A : matrix n n α) (b : n → α) (i : n) :
cramer A b i = b i :=
by rw [cramer_apply, det_eq_elem_of_subsingleton _ i, update_column_self]
lemma cramer_zero [nontrivial n] : cramer (0 : matrix n n α) = 0 :=
begin
ext i j,
obtain ⟨j', hj'⟩ : ∃ j', j' ≠ j := exists_ne j,
apply det_eq_zero_of_column_eq_zero j',
intro j'',
simp [update_column_ne hj'],
end
/-- Use linearity of `cramer` to take it out of a summation. -/
lemma sum_cramer {β} (s : finset β) (f : β → n → α) :
∑ x in s, cramer A (f x) = cramer A (∑ x in s, f x) :=
(linear_map.map_sum (cramer A)).symm
/-- Use linearity of `cramer` and vector evaluation to take `cramer A _ i` out of a summation. -/
lemma sum_cramer_apply {β} (s : finset β) (f : n → β → α) (i : n) :
∑ x in s, cramer A (λ j, f j x) i = cramer A (λ (j : n), ∑ x in s, f j x) i :=
calc ∑ x in s, cramer A (λ j, f j x) i
= (∑ x in s, cramer A (λ j, f j x)) i : (finset.sum_apply i s _).symm
... = cramer A (λ (j : n), ∑ x in s, f j x) i :
by { rw [sum_cramer, cramer_apply], congr' with j, apply finset.sum_apply }
end cramer
section adjugate
/-!
### `adjugate` section
Define the `adjugate` matrix and a few equations.
These will hold for any matrix over a commutative ring.
-/
/-- The adjugate matrix is the transpose of the cofactor matrix.
Typically, the cofactor matrix is defined by taking the determinant of minors,
i.e. the matrix with a row and column removed.
However, the proof of `mul_adjugate` becomes a lot easier if we define the
minor as replacing a column with a basis vector, since it allows us to use
facts about the `cramer` map.
-/
def adjugate (A : matrix n n α) : matrix n n α := λ i, cramer Aᵀ (pi.single i 1)
lemma adjugate_def (A : matrix n n α) :
adjugate A = λ i, cramer Aᵀ (pi.single i 1) := rfl
lemma adjugate_apply (A : matrix n n α) (i j : n) :
adjugate A i j = (A.update_row j (pi.single i 1)).det :=
by { rw adjugate_def, simp only, rw [cramer_apply, update_column_transpose, det_transpose], }
lemma adjugate_transpose (A : matrix n n α) : (adjugate A)ᵀ = adjugate (Aᵀ) :=
begin
ext i j,
rw [transpose_apply, adjugate_apply, adjugate_apply, update_row_transpose, det_transpose],
rw [det_apply', det_apply'],
apply finset.sum_congr rfl,
intros σ _,
congr' 1,
by_cases i = σ j,
{ -- Everything except `(i , j)` (= `(σ j , j)`) is given by A, and the rest is a single `1`.
congr; ext j',
subst h,
have : σ j' = σ j ↔ j' = j := σ.injective.eq_iff,
rw [update_row_apply, update_column_apply],
simp_rw this,
rw [←dite_eq_ite, ←dite_eq_ite],
congr' 1 with rfl,
rw [pi.single_eq_same, pi.single_eq_same], },
{ -- Otherwise, we need to show that there is a `0` somewhere in the product.
have : (∏ j' : n, update_column A j (pi.single i 1) (σ j') j') = 0,
{ apply prod_eq_zero (mem_univ j),
rw [update_column_self, pi.single_eq_of_ne' h], },
rw this,
apply prod_eq_zero (mem_univ (σ⁻¹ i)),
erw [apply_symm_apply σ i, update_row_self],
apply pi.single_eq_of_ne,
intro h',
exact h ((symm_apply_eq σ).mp h') }
end
/-- Since the map `b ↦ cramer A b` is linear in `b`, it must be multiplication by some matrix. This
matrix is `A.adjugate`. -/
lemma cramer_eq_adjugate_mul_vec (A : matrix n n α) (b : n → α) :
cramer A b = A.adjugate.mul_vec b :=
begin
nth_rewrite 1 ← A.transpose_transpose,
rw [← adjugate_transpose, adjugate_def],
have : b = ∑ i, (b i) • (pi.single i 1),
{ refine (pi_eq_sum_univ b).trans _, congr' with j, simp [pi.single_apply, eq_comm], congr, },
nth_rewrite 0 this, ext k,
simp [mul_vec, dot_product, mul_comm],
end
lemma mul_adjugate_apply (A : matrix n n α) (i j k) :
A i k * adjugate A k j = cramer Aᵀ (pi.single k (A i k)) j :=
begin
erw [←smul_eq_mul, ←pi.smul_apply, ←linear_map.map_smul, ←pi.single_smul', smul_eq_mul, mul_one],
end
lemma mul_adjugate (A : matrix n n α) : A ⬝ adjugate A = A.det • 1 :=
begin
ext i j,
rw [mul_apply, pi.smul_apply, pi.smul_apply, one_apply, smul_eq_mul, mul_boole],
simp [mul_adjugate_apply, sum_cramer_apply, cramer_transpose_row_self, pi.single_apply, eq_comm]
end
lemma adjugate_mul (A : matrix n n α) : adjugate A ⬝ A = A.det • 1 :=
calc adjugate A ⬝ A = (Aᵀ ⬝ (adjugate Aᵀ))ᵀ :
by rw [←adjugate_transpose, ←transpose_mul, transpose_transpose]
... = A.det • 1 : by rw [mul_adjugate (Aᵀ), det_transpose, transpose_smul, transpose_one]
lemma adjugate_smul (r : α) (A : matrix n n α) :
adjugate (r • A) = r ^ (fintype.card n - 1) • adjugate A :=
begin
rw [adjugate, adjugate, transpose_smul, cramer_smul],
refl,
end
/-- A stronger form of **Cramer's rule** that allows us to solve some instances of `A ⬝ x = b` even
if the determinant is not a unit. A sufficient (but still not necessary) condition is that `A.det`
divides `b`. -/
@[simp] lemma mul_vec_cramer (A : matrix n n α) (b : n → α) :
A.mul_vec (cramer A b) = A.det • b :=
by rw [cramer_eq_adjugate_mul_vec, mul_vec_mul_vec, mul_adjugate, smul_mul_vec_assoc, one_mul_vec]
lemma adjugate_subsingleton [subsingleton n] (A : matrix n n α) : adjugate A = 1 :=
begin
ext i j,
simp [subsingleton.elim i j, adjugate_apply, det_eq_elem_of_subsingleton _ i]
end
lemma adjugate_eq_one_of_card_eq_one {A : matrix n n α} (h : fintype.card n = 1) : adjugate A = 1 :=
begin
haveI : subsingleton n := fintype.card_le_one_iff_subsingleton.mp h.le,
exact adjugate_subsingleton _
end
@[simp] lemma adjugate_zero [nontrivial n] : adjugate (0 : matrix n n α) = 0 :=
begin
ext i j,
obtain ⟨j', hj'⟩ : ∃ j', j' ≠ j := exists_ne j,
apply det_eq_zero_of_column_eq_zero j',
intro j'',
simp [update_column_ne hj'],
end
@[simp] lemma adjugate_one : adjugate (1 : matrix n n α) = 1 :=
by { ext, simp [adjugate_def, matrix.one_apply, pi.single_apply, eq_comm] }
lemma _root_.ring_hom.map_adjugate {R S : Type*} [comm_ring R] [comm_ring S] (f : R →+* S)
(M : matrix n n R) : f.map_matrix M.adjugate = matrix.adjugate (f.map_matrix M) :=
begin
ext i k,
have : pi.single i (1 : S) = f ∘ pi.single i 1,
{ rw ←f.map_one,
exact pi.single_op (λ i, f) (λ i, f.map_zero) i (1 : R) },
rw [adjugate_apply, ring_hom.map_matrix_apply, map_apply, ring_hom.map_matrix_apply,
this, ←map_update_row, ←ring_hom.map_matrix_apply, ←ring_hom.map_det, ←adjugate_apply]
end
lemma _root_.alg_hom.map_adjugate {R A B : Type*} [comm_semiring R] [comm_ring A] [comm_ring B]
[algebra R A] [algebra R B] (f : A →ₐ[R] B)
(M : matrix n n A) : f.map_matrix M.adjugate = matrix.adjugate (f.map_matrix M) :=
f.to_ring_hom.map_adjugate _
lemma det_adjugate (A : matrix n n α) : (adjugate A).det = A.det ^ (fintype.card n - 1) :=
begin
-- get rid of the `- 1`
cases (fintype.card n).eq_zero_or_pos with h_card h_card,
{ haveI : is_empty n := fintype.card_eq_zero_iff.mp h_card,
rw [h_card, nat.zero_sub, pow_zero, adjugate_subsingleton, det_one] },
replace h_card := tsub_add_cancel_of_le h_card.nat_succ_le,
-- express `A` as an evaluation of a polynomial in n^2 variables, and solve in the polynomial ring
-- where `A'.det` is non-zero.
let A' := mv_polynomial_X n n ℤ,
suffices : A'.adjugate.det = A'.det ^ (fintype.card n - 1),
{ rw [←mv_polynomial_X_map_matrix_aeval ℤ A, ←alg_hom.map_adjugate, ←alg_hom.map_det,
←alg_hom.map_det, ←alg_hom.map_pow, this] },
apply mul_left_cancel₀ (show A'.det ≠ 0, from det_mv_polynomial_X_ne_zero n ℤ),
calc A'.det * A'.adjugate.det
= (A' ⬝ adjugate A').det : (det_mul _ _).symm
... = A'.det ^ fintype.card n : by rw [mul_adjugate, det_smul, det_one, mul_one]
... = A'.det * A'.det ^ (fintype.card n - 1) : by rw [←pow_succ, h_card],
end
@[simp] lemma adjugate_fin_zero (A : matrix (fin 0) (fin 0) α) : adjugate A = 0 :=
@subsingleton.elim _ matrix.subsingleton_of_empty_left _ _
@[simp] lemma adjugate_fin_one (A : matrix (fin 1) (fin 1) α) : adjugate A = 1 :=
adjugate_subsingleton A
lemma adjugate_fin_two (A : matrix (fin 2) (fin 2) α) :
adjugate A = ![![A 1 1, -A 0 1], ![-A 1 0, A 0 0]] :=
begin
ext i j,
rw [adjugate_apply, det_fin_two],
fin_cases i with [0, 1]; fin_cases j with [0, 1];
simp only [nat.one_ne_zero, one_mul, fin.one_eq_zero_iff, pi.single_eq_same, zero_mul,
fin.zero_eq_one_iff, sub_zero, pi.single_eq_of_ne, ne.def, not_false_iff, update_row_self,
update_row_ne, cons_val_zero, mul_zero, mul_one, zero_sub, cons_val_one, head_cons],
end
@[simp] lemma adjugate_fin_two' (a b c d : α) :
adjugate ![![a, b], ![c, d]] = ![![d, -b], ![-c, a]] :=
adjugate_fin_two _
lemma adjugate_conj_transpose [star_ring α] (A : matrix n n α) : A.adjugateᴴ = adjugate (Aᴴ) :=
begin
dsimp only [conj_transpose],
have : Aᵀ.adjugate.map star = adjugate (Aᵀ.map star) :=
((star_ring_aut : α ≃+* α).to_ring_hom.map_adjugate Aᵀ),
rw [A.adjugate_transpose, this],
end
lemma is_regular_of_is_left_regular_det {A : matrix n n α} (hA : is_left_regular A.det) :
is_regular A :=
begin
split,
{ intros B C h,
refine hA.matrix _,
rw [←matrix.one_mul B, ←matrix.one_mul C, ←matrix.smul_mul, ←matrix.smul_mul, ←adjugate_mul,
matrix.mul_assoc, matrix.mul_assoc, ←mul_eq_mul A, h, mul_eq_mul] },
{ intros B C h,
simp only [mul_eq_mul] at h,
refine hA.matrix _,
rw [←matrix.mul_one B, ←matrix.mul_one C, ←matrix.mul_smul, ←matrix.mul_smul, ←mul_adjugate,
←matrix.mul_assoc, ←matrix.mul_assoc, h] }
end
lemma adjugate_mul_distrib_aux (A B : matrix n n α)
(hA : is_left_regular A.det)
(hB : is_left_regular B.det) :
adjugate (A ⬝ B) = adjugate B ⬝ adjugate A :=
begin
have hAB : is_left_regular (A ⬝ B).det,
{ rw [det_mul],
exact hA.mul hB },
refine (is_regular_of_is_left_regular_det hAB).left _,
rw [mul_eq_mul, mul_adjugate, mul_eq_mul, matrix.mul_assoc, ←matrix.mul_assoc B, mul_adjugate,
smul_mul, matrix.one_mul, mul_smul, mul_adjugate, smul_smul, mul_comm, ←det_mul]
end
/--
Proof follows from "The trace Cayley-Hamilton theorem" by Darij Grinberg, Section 5.3
-/
lemma adjugate_mul_distrib (A B : matrix n n α) : adjugate (A ⬝ B) = adjugate B ⬝ adjugate A :=
begin
let g : matrix n n α → matrix n n (polynomial α) :=
λ M, M.map polynomial.C + (polynomial.X : polynomial α) • 1,
let f' : matrix n n (polynomial α) →+* matrix n n α := (polynomial.eval_ring_hom 0).map_matrix,
have f'_inv : ∀ M, f' (g M) = M,
{ intro,
ext,
simp [f', g], },
have f'_adj : ∀ (M : matrix n n α), f' (adjugate (g M)) = adjugate M,
{ intro,
rw [ring_hom.map_adjugate, f'_inv] },
have f'_g_mul : ∀ (M N : matrix n n α), f' (g M ⬝ g N) = M ⬝ N,
{ intros,
rw [←mul_eq_mul, ring_hom.map_mul, f'_inv, f'_inv, mul_eq_mul] },
have hu : ∀ (M : matrix n n α), is_regular (g M).det,
{ intros M,
refine polynomial.monic.is_regular _,
simp only [g, polynomial.monic.def, ←polynomial.leading_coeff_det_X_one_add_C M, add_comm] },
rw [←f'_adj, ←f'_adj, ←f'_adj, ←mul_eq_mul (f' (adjugate (g B))), ←f'.map_mul, mul_eq_mul,
←adjugate_mul_distrib_aux _ _ (hu A).left (hu B).left, ring_hom.map_adjugate,
ring_hom.map_adjugate, f'_inv, f'_g_mul]
end
@[simp] lemma adjugate_pow (A : matrix n n α) (k : ℕ) :
adjugate (A ^ k) = (adjugate A) ^ k :=
begin
induction k with k IH,
{ simp },
{ rw [pow_succ', mul_eq_mul, adjugate_mul_distrib, IH, ←mul_eq_mul, pow_succ] }
end
lemma det_smul_adjugate_adjugate (A : matrix n n α) :
det A • adjugate (adjugate A) = det A ^ (fintype.card n - 1) • A :=
begin
have : A ⬝ (A.adjugate ⬝ A.adjugate.adjugate) = A ⬝ (A.det ^ (fintype.card n - 1) • 1),
{ rw [←adjugate_mul_distrib, adjugate_mul, adjugate_smul, adjugate_one], },
rwa [←matrix.mul_assoc, mul_adjugate, matrix.mul_smul, matrix.mul_one, matrix.smul_mul,
matrix.one_mul] at this,
end
/-- Note that this is not true for `fintype.card n = 1` since `1 - 2 = 0` and not `-1`. -/
-- express `A` as an evaluation of a polynomial in n^2 variables, and solve in the polynomial ring
-- where `A'.det` is non-zero.
let A' := mv_polynomial_X n n ℤ,
suffices : adjugate (adjugate A') = det A' ^ (fintype.card n - 2) • A',
{ rw [←mv_polynomial_X_map_matrix_aeval ℤ A, ←alg_hom.map_adjugate, ←alg_hom.map_adjugate, this,
←alg_hom.map_det, ← alg_hom.map_pow],
-- TODO: missing an `alg_hom.map_smul_of_tower` here.
ext i j,
dsimp [-mv_polynomial_X],
rw [←alg_hom.map_mul] },
have h_card' : fintype.card n - 2 + 1 = fintype.card n - 1,
{ simp [h_card] },
have is_reg : is_smul_regular (mv_polynomial (n × n) ℤ) (det A') :=
λ x y, mul_left_cancel₀ (det_mv_polynomial_X_ne_zero n ℤ),
apply is_reg.matrix,
rw [smul_smul, ←pow_succ, h_card', det_smul_adjugate_adjugate],
end
/-- A weaker version of `matrix.adjugate_adjugate` that uses `nontrivial`. -/
lemma adjugate_adjugate' (A : matrix n n α) [nontrivial n] :
adjugate (adjugate A) = det A ^ (fintype.card n - 2) • A :=
adjugate_adjugate _ $ fintype.one_lt_card.ne'
end adjugate
end matrix
|
lemma analytic_on_neg [analytic_intros]: "f analytic_on S \<Longrightarrow> (\<lambda>z. -(f z)) analytic_on S" |
rebol [
title: "print-struct"
author: "Oldes"
purpose: {Prints readable pairs of variables and values of the struct! datatype}
]
print-struct: func[
{Prints readable pairs of variables and values of the struct! datatype}
st [struct!] "Struct! to explore"
/local val i
][
i: 0
parse first st [
opt [set val string! (print val loop length? val [prin "="] print "")]
any [
set val word! (
insert/dup tail val: to-string val #"." 24 - length? val
print [val pick second st i: i + 1]
)
| any-type!
]]
] |
Money Making Step-By-Step Video & Audio Lessons Walks You Through The Process Of Creating CASH, Cash Flow, and Building Financial Security!
The foundations of every market dictate that when some people lose, other people gain. The American economy today is a mix of winners and losers. There were those who failed to capitalize on the rising market and then witnessed most of the wealth they had accumulated disappear when the real estate market crashed, causing the stock market to crash and wiping out the life savings of millions.
On the other hand, those who sold ‘out at or near the top, and those who “shorted” the stock market are now poised to buy back in at mere fractions of the dollar, thereby building even greater fortunes than during the boom years.
Does that mean that all those who don’t have the cash to re-enter the market are going to wind up having to painstakingly rebuild their lost financial security over the coming years? Not necessarily!
I was born during the Great Depression and have seen a half dozen economic downturns over half a century of investing in single family houses. I lost money in most of them because I didn’t know how to exploit them. Once I’d learned the tricks of the trade, I made a fortune thirty years ago when Florida’s recession was at it’s height. The trick was learning ways to create cash and equity without the use of any of my money.
There are no hidden secrets to doing this. It hinges on your desire to succeed. If you truly want to rise to the top of the heap, you have to learn how to take advantage of the current distressed housing market.
Some of these techniques involve the use of Contingent Contracts and Options to control property until an end-user or investor can be found to buy a property at mere fractions of its original cost. Some involve being able to create debt instruments that can be used to buy and sell property.
Still others involve the design and creation of real estate Notes that can be readily sold for cash to institutional and private investors. Ultimately, you should be buying as many deeply discounted cash flow houses as possible before the market rebounds. You can do this without cash if you learn and use some of the techniques I and others can teach you.
Now, for the first time, I created a new seminar I call “MONEY MATTERS – Making Money Without Money” to help you learn these techniques. It will show you how to use them to recoup and surpass the financial security you may have lost.
The seminar SOLD OUT both times it was taught!
Learn the techniques and strategies you need to get through this recession with more wealth, cash flow, and money than before.
Take a took at the Money Matters Recorded Seminar outline below and see if you don’t agree that there are some new strategies you can learn in this online seminar to help you take advantage of today’s tremendous real estate opportunities.
In today’s economy, by using these techniques, you can rebuild your nest egg in far less time than it took to originally accumulate it; but you don’t want to delay. The current economic situation is changing daily. Once you let today’s opportunities pass you by, you may have to wait a generation for a chance to make as much money without money with your own talents and skill.
Even if you attended the fast-paced Money Matters LIVE seminar, this Recorded Seminar will help you learn the concepts Jack taught. You can pause and rewind the audio and videos as many times as you need to to acquire a full and complete understanding of these important concepts, techniques and strategies.
You don’t want to miss this cutting edge information about how to make money without money. Watch or Listen to Money Matters today so you can learn how to make money with the tremendous opportunities available for you right now.
Just like missed opportunity, when it’s gone it’s gone! |
open import Agda.Builtin.Equality
postulate
X : Set
rigid0 : ((@0 x : X) → X) → X
mutual
H : ((@ω x : X) → X) → X
H f = rigid0 _
testω : (f : (@0 x : X) → X) → H (\ (@ω x) → f x) ≡ rigid0 (\ (@0 x) → f x)
testω f = refl
|
subroutine gen2(r,p,wt2,*)
C---generate two particle phase space and x1,x2 integration
C---p1+p2 --> p3+p4
c----
c---- if 'nodecay' is true, then the vector boson decay into massless
c---- particles is not included and 2 less integration variables
c---- are required
implicit none
include 'constants.f'
include 'limits.f'
include 'mxdim.f'
include 'phasemin.f'
include 'nodecay.f'
include 'breit.f'
include 'x1x2.f'
integer j,nu
double precision r(mxdim),p(mxpart,4),rdk1,rdk2
double precision ymax,yave,ydif,xjac,y3,y4,phi,wt0,wt2,w3
double precision pt,s34,rtshat,udif
include 'energy.f'
parameter(wt0=1d0/16d0/pi)
do j=1,mxpart
do nu=1,4
p(j,nu)=0d0
enddo
enddo
wt2=0d0
c--- dummy values if there's no decay
if (nodecay) then
rdk1=0.5d0
rdk2=0.5d0
else
rdk1=r(3)
rdk2=r(4)
endif
if (n3.eq.0) then
w3=(wsqmax-wsqmin)
s34=(wsqmax-wsqmin)*r(1)+wsqmin
elseif (n3.eq.1) then
call breitw(r(1),wsqmin,wsqmax,mass3,width3,s34,w3)
endif
rtshat=dsqrt(s34)
ymax=dlog(sqrts/rtshat)
yave=ymax*(two*r(2)-1d0)
c----udif==tanh(ydif)
udif=(two*rdk1-1d0)
ydif=half*dlog((1d0+udif)/(1d0-udif))
xjac=four*ymax
y3=yave+ydif
y4=yave-ydif
xjac=xjac*w3
phi=2d0*pi*rdk2
pt=rtshat/(2d0*dcosh(ydif))
xx(1)=rtshat/sqrts*dexp(+yave)
xx(2)=rtshat/sqrts*dexp(-yave)
if ((xx(1) .gt. 1d0)
& .or. (xx(2) .gt. 1d0)
& .or. (xx(1) .lt. xmin)
& .or. (xx(2) .lt. xmin)) then
write(6,*) 'problems with xx(1),xx(2) in gen2',xx(1),xx(2)
return 1
endif
p(1,4)=-0.5d0*xx(1)*sqrts
p(1,1)=0d0
p(1,2)=0d0
p(1,3)=-0.5d0*xx(1)*sqrts
p(2,4)=-0.5d0*xx(2)*sqrts
p(2,1)=0d0
p(2,2)=0d0
p(2,3)=+0.5d0*xx(2)*sqrts
p(3,4)=+pt*dcosh(y3)
p(3,1)=+pt*dsin(phi)
p(3,2)=+pt*dcos(phi)
p(3,3)=+pt*dsinh(y3)
p(4,4)=+pt*dcosh(y4)
p(4,1)=-pt*dsin(phi)
p(4,2)=-pt*dcos(phi)
p(4,3)=+pt*dsinh(y4)
wt2=wt0*xjac/sqrts**2
return
end
|
class Semigroup (α : Type u) extends Mul α where
mul_assoc (a b c : α) : a * b * c = a * (b * c)
export Semigroup (mul_assoc)
class MulComm (α : Type u) extends Mul α where
mul_comm (a b : α) : a * b = b * a
export MulComm (mul_comm)
class CommSemigroup (α : Type u) extends Semigroup α where
mul_comm (a b : α) : a * b = b * a
instance [CommSemigroup α] : MulComm α where
mul_comm := CommSemigroup.mul_comm
class One (α : Type u) where
one : α
instance [One α] : OfNat α (nat_lit 1) where
ofNat := One.one
class Monoid (α : Type u) extends Semigroup α, One α where
one_mul (a : α) : 1 * a = a
mul_one (a : α) : a * 1 = a
export Monoid (one_mul mul_one)
class CommMonoid (α : Type u) extends Monoid α where
mul_comm (a b : α) : a * b = b * a
instance [CommMonoid α] : CommSemigroup α where
mul_comm := CommMonoid.mul_comm
instance [CommMonoid α] : MulComm α where
mul_comm := CommSemigroup.mul_comm
class Inv (α : Type u) where
inv : α → α
postfix:max "⁻¹" => Inv.inv
class Group (α : Type u) extends Monoid α, Inv α where
mul_left_inv (a : α) : a⁻¹ * a = 1
export Group (mul_left_inv)
class CommGroup (α : Type u) extends Group α where
mul_comm (a b : α) : a * b = b * a
instance [CommGroup α] : CommMonoid α where
mul_comm := CommGroup.mul_comm
instance [CommGroup α] : MulComm α where
mul_comm := CommGroup.mul_comm
theorem inv_mul_cancel_left [Group α] (a b : α) : a⁻¹ * (a * b) = b := by
rw [← mul_assoc, mul_left_inv, one_mul]
theorem inv_eq_of_mul_eq_one [Group α] {a b : α} (h : a * b = 1) : a⁻¹ = b := by
rw [← mul_one a⁻¹, ←h, ←mul_assoc, mul_left_inv, one_mul]
theorem inv_inv [Group α] (a : α) : (a⁻¹)⁻¹ = a :=
inv_eq_of_mul_eq_one (mul_left_inv a)
theorem mul_right_inv [Group α] (a : α) : a * a⁻¹ = 1 := by
have : a⁻¹⁻¹ * a⁻¹ = 1 := by rw [mul_left_inv]
rw [inv_inv] at this
assumption
theorem mul_inv_rev [Group α] (a b : α) : (a * b)⁻¹ = b⁻¹ * a⁻¹ := by
apply inv_eq_of_mul_eq_one
rw [mul_assoc, ← mul_assoc b, mul_right_inv, one_mul, mul_right_inv]
theorem mul_inv [CommGroup α] (a b : α) : (a * b)⁻¹ = a⁻¹ * b⁻¹ := by
rw [mul_inv_rev, mul_comm]
|
% The following vectorized Matlab code implements Algorithm 1 from the
% paper
% Projection onto the probability simplex: An efficient algorithm with a
% simple proof, and an application, by W. Wang and M.A. Carreira-Perpinan,
% see https://arxiv.org/abs/1309.1541
%
% It projects each column vector in the D N matrix Y onto the probability
% simplex in D dimensions.
function X = SimplexColProj(Y)
Y = Y';
[N,D] = size(Y);
X = sort(Y,2,'descend');
Xtmp = (cumsum(X,2)-1)*diag(sparse(1./(1:D)));
X = max(bsxfun(@minus,Y,Xtmp(sub2ind([N,D],(1:N)',sum(X>Xtmp,2)))),0);
X = X'; |
%
% Usage: Y =mexSort(X);
%
% Name: mexSort
%
% Description: sort the elements of X using quicksort
%
% Inputs: X: double vector of size n
%
% Output: Y: double vector of size n
%
% Author: Julien Mairal, 2010
|
= = Modern literature = =
|
"""
Create a bar chart to compare GPT-3 (175 billion) and Codex (12 billion).
"""
import matplotlib.pyplot as plt
import numpy as np
def main():
"""
Generate data and plot it.
:return:
"""
# Create data
x = np.arange(2)
y = [175, 12]
# Create plot
plt.bar(x, y)
plt.xticks(x, ('GPT-3', 'Codex'))
plt.ylabel('Number of tokens')
plt.title('Number of tokens in GPT-3 and Codex')
plt.show()
def generate_pie_chart_data():
"""
Generate data for a pie chart.
:return:
"""
# Create data
labels = 'GPT-3', 'Codex'
sizes = [175, 12]
# Create plot
plt.pie(sizes, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90)
plt.axis('equal')
plt.show()
if __name__ == '__main__':
generate_pie_chart_data() |
Billy Graham impacted the world during his six-plus decades of ministry, but neither a stage nor a well-known name is vital to sharing the love of God.
This question has stirred much debate. Historically, Christians have voted for candidates of different faiths, including Mormons, based on how they live their lives and how deeply committed they are to upholding the U.S. Constitution. Remember, God ordained government, and we are not electing a pastor-in-chief, we are electing a commander-in-chief. |
[STATEMENT]
lemma Rcd_type2:
"\<Gamma> \<turnstile> Rcd fs : T \<Longrightarrow> \<Gamma> \<turnstile> T <: RcdT fTs \<Longrightarrow>
\<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) fTs [:] fTs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>\<Gamma> \<turnstile> Rcd fs : T; \<Gamma> \<turnstile> T <: RcdT fTs\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) fTs [:] fTs
[PROOF STEP]
apply (drule Rcd_type1)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<Gamma> \<turnstile> T <: RcdT fTs \<Longrightarrow> Rcd fs = Rcd ?fs
2. \<Gamma> \<turnstile> T <: RcdT fTs \<Longrightarrow> \<Gamma> \<turnstile> T <: RcdT ?fTs
3. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT fTs; \<forall>(l, U)\<in>set ?fTs. \<exists>u. ?fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) fTs [:] fTs
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile> T <: RcdT fTs \<Longrightarrow> \<Gamma> \<turnstile> T <: RcdT ?fTs
2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT fTs; \<forall>(l, U)\<in>set ?fTs. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) fTs [:] fTs
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT fTs; \<forall>(l, U)\<in>set fTs. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) fTs [:] fTs
[PROOF STEP]
apply (induct fTs rule: list.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT []; \<forall>(l, U)\<in>set []. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) [] [:] []
2. \<And>x1 x2. \<lbrakk>\<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2; \<forall>(l, U)\<in>set x2. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT (x1 \<Colon> x2); \<forall>(l, U)\<in>set (x1 \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) (x1 \<Colon> x2) [:] x1 \<Colon> x2
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile> T <: RcdT [] \<Longrightarrow> \<Gamma> \<turnstile> [] [:] []
2. \<And>x1 x2. \<lbrakk>\<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2; \<forall>(l, U)\<in>set x2. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT (x1 \<Colon> x2); \<forall>(l, U)\<in>set (x1 \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) (x1 \<Colon> x2) [:] x1 \<Colon> x2
[PROOF STEP]
apply (rule T_Nil)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile> T <: RcdT [] \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f
2. \<And>x1 x2. \<lbrakk>\<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2; \<forall>(l, U)\<in>set x2. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT (x1 \<Colon> x2); \<forall>(l, U)\<in>set (x1 \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) (x1 \<Colon> x2) [:] x1 \<Colon> x2
[PROOF STEP]
apply (erule wf_subtypeE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>\<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT []\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f
2. \<And>x1 x2. \<lbrakk>\<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2; \<forall>(l, U)\<in>set x2. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT (x1 \<Colon> x2); \<forall>(l, U)\<in>set (x1 \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) (x1 \<Colon> x2) [:] x1 \<Colon> x2
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x1 x2. \<lbrakk>\<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2; \<forall>(l, U)\<in>set x2. \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT (x1 \<Colon> x2); \<forall>(l, U)\<in>set (x1 \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) (x1 \<Colon> x2) [:] x1 \<Colon> x2
[PROOF STEP]
apply (simp add: split_paired_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> (a, the (fs\<langle>a\<rangle>\<^sub>?)) \<Colon> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] (a, b) \<Colon> x2
[PROOF STEP]
apply (rule T_Cons)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> the (fs\<langle>a\<rangle>\<^sub>?) : b
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (drule_tac x=a and y=b in bpspec)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2)\<rbrakk> \<Longrightarrow> (a, b) \<in> set ((a, b) \<Colon> x2)
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<exists>u. fs\<langle>a\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : b\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> the (fs\<langle>a\<rangle>\<^sub>?) : b
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2
4. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<exists>u. fs\<langle>a\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : b\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> the (fs\<langle>a\<rangle>\<^sub>?) : b
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule exE conjE)+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b x2 u. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); fs\<langle>a\<rangle>\<^sub>? = \<lfloor>u\<rfloor>; \<Gamma> \<turnstile> u : b\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> the (fs\<langle>a\<rangle>\<^sub>?) : b
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (rename_tac list)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (subgoal_tac "\<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list
2. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule meta_mp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> T <: RcdT list
2. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule subtype_trans(1))
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list. \<lbrakk>\<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list
2. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> list); \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule wf_subtypeE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> RcdT ((a, b) \<Colon> list) <: RcdT list
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (rule SA_Rcd)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f
2. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)
3. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> unique list
4. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<forall>(l, T)\<in>set list. \<exists>S. (l, S) \<in> set ((a, b) \<Colon> list) \<and> \<Gamma> \<turnstile> S <: T
5. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply assumption+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> unique list
2. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<forall>(l, T)\<in>set list. \<exists>S. (l, S) \<in> set ((a, b) \<Colon> list) \<and> \<Gamma> \<turnstile> S <: T
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule well_formed_cases)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; unique ((a, b) \<Colon> list); \<forall>x\<in>set ((a, b) \<Colon> list). case x of (l, x) \<Rightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f x\<rbrakk> \<Longrightarrow> unique list
2. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<forall>(l, T)\<in>set list. \<exists>S. (l, S) \<in> set ((a, b) \<Colon> list) \<and> \<Gamma> \<turnstile> S <: T
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> \<forall>(l, T)\<in>set list. \<exists>S. (l, S) \<in> set ((a, b) \<Colon> list) \<and> \<Gamma> \<turnstile> S <: T
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (rule ballpI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<exists>S. (l, S) \<in> set ((a, b) \<Colon> list) \<and> \<Gamma> \<turnstile> S <: Ta
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (rule exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> (l, ?S36 a b list l Ta) \<in> set ((a, b) \<Colon> list) \<and> \<Gamma> \<turnstile> ?S36 a b list l Ta <: Ta
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> (l, ?S36 a b list l Ta) \<in> set ((a, b) \<Colon> list)
2. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> ?S36 a b list l Ta <: Ta
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (rule_tac [2] subtype_refl)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> (l, Ta) \<in> set ((a, b) \<Colon> list)
2. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f
3. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f Ta
4. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f
2. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f Ta
3. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> list); (l, Ta) \<in> set list\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f Ta
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule well_formed_cases)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; (l, Ta) \<in> set list; unique ((a, b) \<Colon> list); \<forall>x\<in>set ((a, b) \<Colon> list). case x of (l, x) \<Rightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f x\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f Ta
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule_tac x=l and y=Ta in bpspec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>a b list l Ta. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT list \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) list [:] list; \<forall>(l, U)\<in>set ((a, b) \<Colon> list). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; (l, Ta) \<in> set list; unique ((a, b) \<Colon> list)\<rbrakk> \<Longrightarrow> (l, Ta) \<in> set ((a, b) \<Colon> list)
2. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<Gamma> \<turnstile> T <: RcdT ((a, b) \<Colon> x2); \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule wf_subtypeE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; \<Gamma> \<turnstile>\<^sub>w\<^sub>f RcdT ((a, b) \<Colon> x2)\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply (erule well_formed_cases)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a b x2. \<lbrakk>\<Gamma> \<turnstile> T <: RcdT x2 \<Longrightarrow> \<Gamma> \<turnstile> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2 [:] x2; \<forall>(l, U)\<in>set ((a, b) \<Colon> x2). \<exists>u. fs\<langle>l\<rangle>\<^sub>? = \<lfloor>u\<rfloor> \<and> \<Gamma> \<turnstile> u : U; \<Gamma> \<turnstile>\<^sub>w\<^sub>f; \<Gamma> \<turnstile>\<^sub>w\<^sub>f T; unique ((a, b) \<Colon> x2); \<forall>x\<in>set ((a, b) \<Colon> x2). case x of (l, x) \<Rightarrow> \<Gamma> \<turnstile>\<^sub>w\<^sub>f x\<rbrakk> \<Longrightarrow> map (\<lambda>(l, T). (l, the (fs\<langle>l\<rangle>\<^sub>?))) x2\<langle>a\<rangle>\<^sub>? = \<bottom>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done |
/**
* testReachset.cpp
*
* Test the reachable set computation of a two-link scara manipulator.
*
* Created by Yinan Li on July 05, 2020.
* Hybrid Systems Group, University of Waterloo.
*/
#include <iostream>
#include <cmath>
#include <array>
#include <boost/numeric/odeint.hpp>
#include "src/system.hpp"
#include "src/csolver.h"
#include "scara.h"
typedef std::array<double, 4> state_type;
struct scara_vf {
rocs::Rn _u;
scara_vf(rocs::Rn u) : _u(u) {}
void operator()(state_type &x, state_type &dxdt, double t) const {
double z1 = I1+I2+m1*r1*r1+m2*(l1*l1+r2*r2);
double z2 = m2*l1*r2;
double z3 = I2+m2*r2*r2;
double detM = z3*(z1-z3) - z2*z2*std::cos(x[1])*std::cos(x[1]);
double a = z2*std::sin(x[1])*(2*x[2]+x[3])*x[3];
double b = z2*std::cos(x[1]);
double c = z2*x[2]*std::sin(x[1])-_u[1];
dxdt[0] = x[2];
dxdt[1] = x[3];
dxdt[2] = (z3*_u[0] + z3*a + (z3+b)*c) / detM;
dxdt[3] = ((z1+2*b)*(-c) - (z3+b)*(_u[0]+a)) / detM;
}
};
int main() {
/* set the state space */
double xlb[4] = {0, -M_PI, -0.5, -0.5};
double xub[4] = {M_PI, M_PI, 0.5, 0.5};
/* set the control values */
double ulb[2] = {-0.001, -0.001};
double uub[2] = {0.001, 0.001};
double mu[2] = {0.0002, 0.0002};
/* set the sampling time and disturbance */
double t = 0.05;
double delta = 0.01;
/* parameters for computing the flow */
int kmax = 5;
double tol = 0.01;
double alpha = 0.5;
double beta = 2;
rocs::params controlparams(kmax, tol, alpha, beta);
/* define the control system */
rocs::CTCntlSys<scaraode> scara("inverted pendulum", t,
scaraode::n, scaraode::nu,
delta, &controlparams);
scara.init_workspace(xlb, xub);
scara.init_inputset(mu, ulb, uub);
scara.allocate_flows();
/* test if reachable set covers the nominal trajectory */
/* compute reachable set */
// rocs::ivec x0 = {rocs::interval(0.09, 0.11),
// rocs::interval(-0.01, 0.01),
// rocs::interval(-0.01, 0.01),
// rocs::interval(-0.01, 0.01)};
rocs::ivec x0 = {rocs::interval(0.6172, 0.63),
rocs::interval(1.61, 1.63),
rocs::interval(-0.005, 0.005),
rocs::interval(-0.005, 0.005)};
std::vector<rocs::ivec> x(scara._ugrid._nv, rocs::ivec(4));
std::cout << "The initial interval: " << x0 << '\n';
std::cout << "The integrating time: " << t << '\n';
scara.get_reach_set(x, x0);
// double dt{0.001};
// for (size_t i = 0; i < x.size(); ++i) {
// /* integrate the nominal trajectory */
// state_type y{0.1, 0, 0, 0};
// rocs::Rn u(scara._ugrid._data[i]);
// boost::numeric::odeint::runge_kutta_cash_karp54<state_type> rk45;
// boost::numeric::odeint::integrate_const(rk45, scara_vf(u),
// y, 0.0, t, dt);
// std::cout << "x(t)= [" << y[0] << ','<< y[1] << ',' << y[2] << ',' << y[3] << "]\n";
// std::cout << "R(t, x0, [" << scara._ugrid._data[i][0] << ','
// << scara._ugrid._data[i][1] << "])= ";
// std::cout << x[i] <<'\n';
// std::cout << "Check: ";
// for (int j = 0; j < 4; ++j) {
// if (y[j] > x[i][j].getinf() && y[j] < x[i][j].getsup())
// std::cout << true << ' ';
// else
// std::cout << false << ' ';
// }
// std::cout << '\n';
// }
scara.release_flows();
return 0;
}
|
module Data.Lawful.Eqv
%default total
||| `Eq` enriched with reflexivity, commutativity and transitivity.
public export
interface Eq a => Eqv a where
0 eqvReflexive : (x : a) -> x == x = True
0 eqvCommutative : (x, y : a) -> x == y = y == x
0 eqvTransitive : (x, y, z : a) -> x == y = True -> y == z = True -> x == z = True
export
Eqv () where
eqvReflexive () = Refl
eqvCommutative () () = Refl
eqvTransitive () () () Refl Refl = Refl
export
Eqv Bool where
eqvReflexive True = Refl
eqvReflexive False = Refl
eqvCommutative True True = Refl
eqvCommutative True False = Refl
eqvCommutative False True = Refl
eqvCommutative False False = Refl
eqvTransitive True True True Refl Refl = Refl
eqvTransitive False False False Refl Refl = Refl
export
Eqv Nat where
eqvReflexive 0 = Refl
eqvReflexive (S n) = rewrite eqvReflexive n in Refl
eqvCommutative 0 0 = Refl
eqvCommutative 0 (S m) = Refl
eqvCommutative (S n) 0 = Refl
eqvCommutative (S n) (S m) = rewrite eqvCommutative n m in Refl
eqvTransitive Z Z Z Refl Refl = Refl
eqvTransitive (S n) (S m) (S k) nm mk = eqvTransitive n m k nm mk
split_and : {a, b : Bool} -> a && b = True -> (a = True, b = True)
split_and {a=True} {b=True} Refl = (Refl, Refl)
export
Eqv a => Eqv (List a) where
eqvReflexive [] = Refl
eqvReflexive (x::xs) = rewrite eqvReflexive x in eqvReflexive xs
eqvCommutative [] [] = Refl
eqvCommutative [] (x::xs) = Refl
eqvCommutative (x::xs) [] = Refl
eqvCommutative (x::xs) (y::ys) = rewrite eqvCommutative x y in
rewrite eqvCommutative xs ys in
Refl
eqvTransitive [] [] [] Refl Refl = Refl
eqvTransitive (x::xs) (y::ys) (z::zs) xy yz = rewrite eqvTransitive x y z (fst $ split_and xy) (fst $ split_and yz) in
rewrite eqvTransitive xs ys zs (snd $ split_and xy) (snd $ split_and yz) in
Refl
export
(Eqv a, Eqv b) => Eqv (a, b) where
eqvReflexive (a, b) = rewrite eqvReflexive a in
rewrite eqvReflexive b in
Refl
eqvCommutative (a, b) (c, d) = rewrite eqvCommutative a c in
rewrite eqvCommutative b d in
Refl
eqvTransitive (a, b) (c, d) (e, f) ac ce = rewrite eqvTransitive a c e (fst $ split_and ac) (fst $ split_and ce) in
rewrite eqvTransitive b d f (snd $ split_and ac) (snd $ split_and ce) in
Refl
export
(Eqv a, Eqv b) => Eqv (Either a b) where
eqvReflexive (Left x) = rewrite eqvReflexive x in Refl
eqvReflexive (Right y) = rewrite eqvReflexive y in Refl
eqvCommutative (Left x) (Left y) = rewrite eqvCommutative x y in Refl
eqvCommutative (Right x) (Right y) = rewrite eqvCommutative x y in Refl
eqvCommutative (Left x) (Right y) = Refl
eqvCommutative (Right x) (Left y) = Refl
eqvTransitive (Left x) (Left y) (Left z ) xy yz = eqvTransitive x y z xy yz
eqvTransitive (Right x) (Right y) (Right z) xy yz = eqvTransitive x y z xy yz
|
{-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.NType
open import lib.types.Cospan
open import lib.types.Pointed
open import lib.types.Sigma
module lib.types.Pullback where
module _ {i j k} (D : Cospan {i} {j} {k}) where
open Cospan D
record Pullback : Type (lmax i (lmax j k)) where
constructor pullback
field
a : A
b : B
h : f a == g b
pullback= : {a a' : A} (p : a == a') {b b' : B} (q : b == b')
{h : f a == g b} {h' : f a' == g b'} (r : h ∙ ap g q == ap f p ∙ h')
→ pullback a b h == pullback a' b' h'
pullback= idp idp r =
ap (pullback _ _) (! (∙-unit-r _) ∙ r)
pullback-aβ : {a a' : A} (p : a == a') {b b' : B} (q : b == b')
{h : f a == g b} {h' : f a' == g b'} (r : h ∙ ap g q == ap f p ∙ h')
→ ap Pullback.a (pullback= p q {h = h} {h' = h'} r) == p
pullback-aβ idp idp r =
ap Pullback.a (ap (pullback _ _) (! (∙-unit-r _) ∙ r))
=⟨ ∘-ap Pullback.a (pullback _ _) _ ⟩
ap (λ _ → _) (! (∙-unit-r _) ∙ r)
=⟨ ap-cst _ _ ⟩
idp =∎
pullback-bβ : {a a' : A} (p : a == a') {b b' : B} (q : b == b')
{h : f a == g b} {h' : f a' == g b'} (r : h ∙ ap g q == ap f p ∙ h')
→ ap Pullback.b (pullback= p q {h = h} {h' = h'} r) == q
pullback-bβ idp idp r =
ap Pullback.b (ap (pullback _ _) (! (∙-unit-r _) ∙ r))
=⟨ ∘-ap Pullback.b (pullback _ _) _ ⟩
ap (λ _ → _) (! (∙-unit-r _) ∙ r)
=⟨ ap-cst _ _ ⟩
idp =∎
module _ {i j k} (D : ⊙Cospan {i} {j} {k}) where
⊙Pullback : Ptd (lmax i (lmax j k))
⊙Pullback =
⊙[ Pullback (⊙cospan-out D) ,
pullback (pt X) (pt Y) (snd f ∙ ! (snd g)) ]
where open ⊙Cospan D
module _ {i j k} (D : Cospan {i} {j} {k}) where
open Cospan D
pullback-decomp-equiv : Pullback D ≃ Σ (A × B) (λ {(a , b) → f a == g b})
pullback-decomp-equiv = equiv
(λ {(pullback a b h) → ((a , b) , h)})
(λ {((a , b) , h) → pullback a b h})
(λ _ → idp)
(λ _ → idp)
module _ {i j k} (n : ℕ₋₂) {D : Cospan {i} {j} {k}} where
open Cospan D
pullback-level : has-level n A → has-level n B → has-level n C
→ has-level n (Pullback D)
pullback-level pA pB pC =
equiv-preserves-level ((pullback-decomp-equiv D)⁻¹) $
Σ-level (×-level pA pB) (λ _ → =-preserves-level pC)
|
%SWIVELDATA Create look-up tables of swivel angle median and range
%
% Will save the file SwivelData.mat to the same location as this
% function. The median and range look-up tables are called phi_med and
% phi_range respectively. Angles are in radians, and non-reachable
% points are NaN. They are made with 1deg resolution, and are nxnxn in
% size, where n may be set, but default 101.
%
% Copyright (C) Bryan Moutrie, 2013-2014
% Licensed under the GNU Lesser General Public License
% see full file for full statement
%
% Known issues:
% - The model for the shoulder range of motion seems to give some
% outlier results, which causes in a large swivel angle range
% - When interpolating to find a value, when near the surface of the
% arm's reacahble workspace, a NaN may be returned though it is
% reachable
% LICENSE STATEMENT:
%
% This file is part of pHRIWARE.
%
% pHRIWARE is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation, either version 3 of
% the License, or (at your option) any later version.
%
% pHRIWARE is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with pHRIWARE. If not, see <http://www.gnu.org/licenses/>.
w = which('wrapToPi');
if isempty(w)
error(pHRIWARE('error', ...
['The MATLAB wrapToPi function could not be detected.', ...
'Replace it with your own version']));
end
n = 101;
hal = HAL();
AP = hal.AP;
reach = sum([AP{2} AP{3}]);
X = linspace(-reach,reach,n);
Y = linspace(-reach,reach,n);
Z = linspace(-reach,reach,n);
PHI = d2r*(-180:179);
phi_med = zeros(n,n,n,'single');
phi_range = zeros(n,n,n,'single');
Q1 = zeros(length(PHI), 7);
Q2 = zeros(length(PHI), 7);
for x = 1:n
for y = 1:n
for z = 1:n
[~,~,Tu] = h2fsu(AP,[X(x),Y(y),Z(z)]',PHI);
[Q1(:,1:3), Q2(:,1:3)] = gikine(AP{1},Tu);
[~, u] = hal.reachable(Q1, Q2);
valid = logical(~u');
% v = find(valid);
% if ~isempty(v)
% d = diff([v, v(end)+v(1)]);
% if ~all(d==1)
% longest = [0 0 0];
% count = 0;
% for i=1:length(d)
% if d(i) == 1
% count = count+1;
% else
% if count > longest(3)
% longest = [i-count i-1 count];
% end
% count = 0;
% end
% end
% if ~isequal(longest,[0 0 0])
% valid = v(longest(1):longest(2));
% else
% valid = false(size(PHI));
% end
% else
% valid = v;
% end
% end
reachablePhi = PHI(valid);
if ~isempty(reachablePhi)
phiM = max(reachablePhi);
phim = min(reachablePhi);
if phim == PHI(1) && phiM == PHI(end)
unreachablePhi = PHI(logical(~valid));
phiM = min(unreachablePhi) + 1*d2r + 2*pi;
phim = max(unreachablePhi) - 1*d2r;
end
else
phiM = NaN;
phim = NaN;
end
phi_med(x,y,z) = (phiM+phim)/2;
phi_range(x,y,z) = (phiM-phim)/2;
end
end
fprintf('.');
if ~mod(x,10), fprintf('\n'); end
end
phi_med = wrapToPi(phi_med);
dir = fileparts(which('swivelData.m'));
save([dir,'\SwivelData.mat'],'phi_med','phi_range');
fprintf('saved!\n');
|
text\<open> 12 November 2021: Exercises for Homework 10 in CS 511 \<close>
text\<open> Your task to remove the invocations of the pre-defined method
'blast' by an equivalent sequence of 'apply' steps \<close>
theory HW10
imports Main
begin
text\<open> 'blast' is invoked four times, once in the proof of each of
lemmas E1, F1, G1, and H1 below \<close>
(* lemma E1 is the same in Exercise 2.3.9 (e), page 161, in [LCS] *)
lemma E1 : "\<forall> x. (P x \<or> Q x) \<Longrightarrow> (\<forall> x. P x) \<or> (\<exists> x. Q x)"
apply (rule disjCI)
apply (rule allI)
apply (erule_tac x="x" in allE)
apply (erule disjE)
apply assumption
apply (erule notE)
apply (rule exI)
apply assumption
done
(* lemma F1 is the same in Exercise 2.3.9 (f), page 161, in [LCS] *)
lemma F1 : "\<forall> x. \<exists> y. (P x \<or> Q y) \<Longrightarrow> \<exists> y. \<forall> x. (P x \<or> Q y)"
apply (rule exCI, rule allI)
apply (erule_tac x="x" in allE)
apply (rotate_tac 1, erule exE)
apply (erule_tac x="y" in allE)
apply (erule disjE, rule disjI1, assumption)
apply (rule disjI2, erule notE, rule allI)
apply (rule disjI2, assumption)
done
(* lemma G1 is the same in Exercise 2.3.9 (g), page 161, in [LCS] *)
lemma G1 : "\<forall> x. (\<not> P x \<and> Q x) \<Longrightarrow> (\<forall> x. P x \<longrightarrow> Q x)"
apply (rule allI)
apply (rule impI)
apply (erule_tac x="x" in allE)
apply (erule conjE)
apply assumption
done
(* lemma H1 is the same in Exercise 2.3.9 (h), page 161, in [LCS] *)
lemma H1 : "\<forall> x. (P x \<and> Q x) \<Longrightarrow> (\<forall> x. P x \<longrightarrow> Q x)"
apply (rule allI)
apply (rule impI)
apply (erule_tac x="x" in allE)
apply (erule conjE)
apply assumption
done
end |
module Rec1 where
import Rec2
y : ℕ
y = x
|
import analysis.inner_product_space.pi_L2
import topology.paracompact
--OUTPUT 1
theorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=
begin
-- Let $\mathcal{A}$ be an open covering of $\mathbb{R}^n$.
assume (A : set (euclidean_space ℝ (fin n))) (hA : is_open_cover A),
-- We now construct a locally finite open refinement $\mathcal{C}$ of $\mathcal{A}$ that covers $\mathbb{R}^n$.
have h1 : ∃ C : set (euclidean_space ℝ (fin n)), is_open_cover C ∧ is_locally_finite C ∧ is_refinement A C, from by {
-- First, we define a collection of pen balls.
-- Let $B_0 = \phi$, and for each $n \in \mathbb{N}$, let $B_m$ denote the ball of radius $m$ centered at 0.
let B : ℕ → set (euclidean_space ℝ (fin n)) := λ m, {x : euclidean_space ℝ (fin n) | ∃ (y : euclidean_space ℝ (fin n)), y ∈ (ball (0 : euclidean_space ℝ (fin n)) m) ∧ x = y},
have hB : ∀ m : ℕ, B m ⊆ (euclidean_space ℝ (fin n)), from by {
assume m : ℕ,
assume x : euclidean_space ℝ (fin n),
assume hx : x ∈ B m,
show x ∈ (euclidean_space ℝ (fin n)), from by {
cases hx with y hy,
cases hy with hy1 hy2,
show x ∈ (euclidean_space ℝ (fin n)), from by {
rw ← hy2,
apply set.mem_of_mem_ball,
exact hy1,
},
},
},
have hB0 : B 0 = ∅, from by {
apply set.eq_empty_iff_forall_not_mem.mpr,
assume x : euclidean_space ℝ (fin n),
assume hx : x ∈ B 0,
cases hx with y hy,
cases hy with hy1 hy2,
have h3 : y ∈ (ball (0 : euclidean_space ℝ (fin n)) 0), from by {
rw ← hy2,
exact hx,
},
have h4 : y = (0 : euclidean_space ℝ (fin n)), from by {
apply ball_eq_zero,
exact h3,
},
have h5 : x = (0 : euclidean_space ℝ (fin n)), from by {
rw ← hy2,
exact h4,
},
have h6 : x ∉ (euclidean_space ℝ (fin n) \ {0}), from by {
apply set.not_mem_of_mem_diff,
split,
exact hx,
apply set.not_mem_singleton,
exact h5,
},
show false, from by {
apply h6,
apply set.mem_univ,
},
},
have hB1 : ∀ m : ℕ, B (m+1) = (euclidean_space ℝ (fin n)) \ (B m), from by {
assume m : ℕ,
apply set.eq_of_subset_of_subset,
assume x : euclidean_space ℝ (fin n),
assume hx : x ∈ B (m+1),
cases hx with y hy,
cases hy with hy1 hy2,
have h3 : y ∈ (ball (0 : euclidean_space ℝ (fin n)) (m+1)), from by {
rw ← hy2,
exact hx,
},
have h4 : y ∉ (ball (0 : euclidean_space ℝ (fin n)) m), from by {
apply ball_not_mem_of_ball_lt,
exact h3,
},
have h5 : y ∉ B m, from by {
assume h6 : y ∈ B m,
cases h6 with z hz,
cases hz with hz1 hz2,
have h7 : z ∈ (ball (0 : euclidean_space ℝ (fin n)) m), from by {
rw ← hz2,
exact hz1,
},
show false, from by {
apply h4,
exact h7,
},
},
have h6 : y ∈ (euclidean_space ℝ (fin n)) \ (B m), from by {
apply set.mem_diff,
split,
exact hy1,
exact h5,
},
have h7 : x ∈ (euclidean_space ℝ (fin n)) \ (B m), from by {
rw ← hy2,
exact h6,
},
show x ∈ (euclidean_space ℝ (fin n)) \ (B m), from by {
apply set.mem_diff,
split,
exact hx,
exact h7,
},
assume x : euclidean_space ℝ (fin n),
assume hx : x ∈ (euclidean_space ℝ (fin n)) \ (B m),
cases hx with hx1 hx2,
have h3 : x ∈ (euclidean_space ℝ (fin n)), from by {
apply set.mem_diff,
split,
exact hx1,
exact hx2,
},
have h4 : ∃ (y : euclidean_space ℝ (fin n)), y ∈ (ball (0 : euclidean_space ℝ (fin n)) (m+1)) ∧ x = y, from by {
use x,
split,
exact h3,
refl,
},
show x ∈ B (m+1), from by {
apply set.mem_of_mem_ball,
exact h4,
},
},
have hB2 : ∀ m : ℕ, B m = (euclidean_space ℝ (fin n)) \ (B (m-1)), from by {
assume m : ℕ,
induction m with m hm,
show B 0 = (euclidean_space ℝ (fin n)) \ (B (-1)), from by {
rw hB0,
rw set.diff_empty,
refl,
},
show B (m+1) = (euclidean_space ℝ (fin n)) \ (B m), from by {
rw hB1,
rw hm,
refl,
},
},
have hB3 : ∀ m : ℕ, B m = (euclidean_space ℝ (fin n)) \ (B (m-1)), from by {
assume m : ℕ,
induction m with m hm,
show B 0 = (euclidean_space ℝ (fin n)) \ (B (-1)), from by {
rw hB0,
rw set.diff_empty,
refl,
},
show B (m+1) = (euclidean_space ℝ (fin n)) \ (B m), from by {
rw hB1,
rw hm,
refl,
},
},
have hB4 : ∀ m : ℕ, B m = (euclidean_space ℝ (fin n)) \ (B (m-1)), from by {
assume m : ℕ,
induction m with m hm,
show B 0 = (euclidean_space ℝ (fin n)) \ (
end --Needs more than 2000 tokens!
/- FEW SHOT PROMPTS TO CODEX(START)
/--`theorem`
Power Set is Closed under Intersection
Let $S$ be a set.
Let $\powerset S$ be the power set of $S$.
Then:
:$\forall A, B \in \powerset S: A \cap B \in \powerset S$
`proof`
Let $A, B \in \powerset S$.
Then by the definition of power set, $A \subseteq S$ and $B \subseteq S$.
From Intersection is Subset we have that $A \cap B \subseteq A$.
It follows from Subset Relation is Transitive that $A \cap B \subseteq S$.
Thus $A \cap B \in \powerset S$ and closure is proved.
{{qed}}
-/
theorem power_set_intersection_closed {α : Type*} (S : set α) : ∀ A B ∈ 𝒫 S, (A ∩ B) ∈ 𝒫 S :=
begin
-- $A$ and $B$ are sets. $A$ and $B$ belong to power set of $S$
assume (A : set α) (hA : A ∈ 𝒫 S) (B : set α) (hB : B ∈ 𝒫 S),
-- Then $A ⊆ S$ and $B ⊆ S$, by power set definition
have h1 : (A ⊆ S) ∧ (B ⊆ S), from by {split,apply set.subset_of_mem_powerset,exact hA,apply set.subset_of_mem_powerset,exact hB},
-- Then $(A ∩ B) ⊆ A$, by intersection of set is a subset
have h2 : (A ∩ B) ⊆ A, from by apply set.inter_subset_left,
-- Then $(A ∩ B) ⊆ S$, by subset relation is transitive
have h3 : (A ∩ B) ⊆ S, from by {apply set.subset.trans h2 h1.left},
-- Hence $(A ∩ B) ∈ 𝒫 S$, by power set definition
show (A ∩ B) ∈ 𝒫 S, from by {apply set.mem_powerset h3},
end
/--`theorem`
Square of Sum
:$\forall x, y \in \R: \paren {x + y}^2 = x^2 + 2 x y + y^2$
`proof`
Follows from the distribution of multiplication over addition:
{{begin-eqn}}
{{eqn | l = \left({x + y}\right)^2
| r = \left({x + y}\right) \cdot \left({x + y}\right)
}}
{{eqn | r = x \cdot \left({x + y}\right) + y \cdot \left({x + y}\right)
| c = Real Multiplication Distributes over Addition
}}
{{eqn | r = x \cdot x + x \cdot y + y \cdot x + y \cdot y
| c = Real Multiplication Distributes over Addition
}}
{{eqn | r = x^2 + 2xy + y^2
| c =
}}
{{end-eqn}}
{{qed}}
-/
theorem square_of_sum (x y : ℝ) : (x + y)^2 = (x^2 + 2*x*y + y^2) :=
begin
-- expand the power
calc (x + y)^2 = (x+y)*(x+y) : by rw sq
-- distributive property of multiplication over addition gives:
... = x*(x+y) + y*(x+y) : by rw add_mul
-- applying the above property further gives:
... = x*x + x*y + y*x + y*y : by {rw [mul_comm x (x+y),mul_comm y (x+y)], rw [add_mul,add_mul], ring}
-- rearranging the terms using commutativity and adding gives:
... = x^2 + 2*x*y + y^2 : by {repeat {rw ← sq}, rw mul_comm y x, ring}
end
/--`theorem`
Identity of Group is Unique
Let $\struct {G, \circ}$ be a group. Then there is a unique identity element $e \in G$.
`proof`
From Group has Latin Square Property, there exists a unique $x \in G$ such that:
:$a x = b$
and there exists a unique $y \in G$ such that:
:$y a = b$
Setting $b = a$, this becomes:
There exists a unique $x \in G$ such that:
:$a x = a$
and there exists a unique $y \in G$ such that:
:$y a = a$
These $x$ and $y$ are both $e$, by definition of identity element.
{{qed}}
-/
theorem group_identity_unique {G : Type*} [group G] : ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a :=
begin
-- Group has Latin Square Property
have h1 : ∀ a b : G, ∃! x : G, a * x = b, from by {
assume a b : G, use a⁻¹ * b, obviously, },
have h2 : ∀ a b : G, ∃! y : G, y * a = b, from by {
assume a b : G, use b * a⁻¹, obviously, },
-- Setting $b = a$, this becomes:
have h3 : ∀ a : G, ∃! x : G, a * x = a, from
assume a : G, h1 a a,
have h4 : ∀ a : G, ∃! y : G, y * a = a, from
assume a : G, h2 a a,
-- These $x$ and $y$ are both $(1 : G)$, by definition of identity element
have h5 : ∀ a : G, classical.some (h3 a).exists = (1 : G), from assume a :G,
exists_unique.unique (h3 a) (classical.some_spec (exists_unique.exists (h3 a)))
(mul_one a),
have h6 : ∀ a : G, classical.some (h4 a).exists = (1 : G), from assume a : G,
exists_unique.unique (h4 a) (classical.some_spec (exists_unique.exists (h4 a))) (one_mul a),
show ∃! e : G, ∀ a : G, e * a = a ∧ a * e = a, from by {
use (1 : G),
have h7 : ∀ e : G, (∀ a : G, e * a = a ∧ a * e = a) → e = 1, from by {
assume (e : G) (hident : ∀ a : G, e * a = a ∧ a * e = a),
have h8 : ∀ a : G, e = classical.some (h3 a).exists, from assume (a : G),
exists_unique.unique (h3 a) (hident a).right
(classical.some_spec (exists_unique.exists (h3 a))),
have h9 : ∀ a : G, e = classical.some (h4 a).exists, from assume (a : G),
exists_unique.unique (h4 a) (hident a).left
(classical.some_spec (exists_unique.exists (h4 a))),
show e = (1 : G), from eq.trans (h9 e) (h6 _),
},
exact ⟨by obviously, h7⟩,
}
end
/--`theorem`
\mathbb{R}^n is paracompact
$\mathbb{R}^n$ is paracompact for all $n$.
`proof`
Let $\mathcal{A}$ be an open covering of $\mathbb{R}^n$. We now construct a locally finite open refinement $\mathcal{C}$ of $\mathcal{A}$ that covers $\mathbb{R}^n$. First, we define a collection of pen balls. Let $B_0 = \phi$, and for each $n \in \mathbb{N}$, let $B_m$ denote the ball of radius $m$
centered at 0. Given $m$, set $\Bar{B_m}$ is compact in $\mathbb{R}^n$ by the Heine-Borel theorem, so choose finitely many elements of $\mathcal{A}$ that cover $\Bar{B_m}$ and intersect each one with the open set $\mathbb{R}^n \setminus \Bar{B_{m - 1}}$, and let $\mathcal{C}_{m}$ denote this collection of open sets (each an open subset of an element of $\mathcal{A}$). So $\mathcal{C} = \bigcup_{m = 0}^{\infty} \mathcal{C}_m$ is an open refinement of $\mathcal{A}$. Note that $\mathcal{C}$ covers $\mathbb{R}^n$ since for any $x \in \mathbb{R}^n$, there is a smallest $m \in \mathbb{N}$ such that $x \in \Bar{B_{m}}$ (namely, some $m$ where $\rVert x \lVert \leq m \leq \rVert x \lVert + 1$), and so $x$ is an element of $\mathcal{C}_m$. Now collection $\mathcal{C}$ is locally finite since for given $x \in \mathbb{R}^n$, neighborhood $B_m$ intersects only finitely many elements of $\mathcal{C}$, namely those elements in collection $\mathcal{C}_1 \cup \mathcal{C}_2 \cup \cdots \mathcal{C}_m$. So $\mathcal{C}$ is a locally finite open refinement of $\mathcal{A}$ that covers $\mathbb{R}^n$, hence $\mathbb{R}^n$ is paracompact.
QED
-/
theorem ℝn_paracompact (n : ℕ) : paracompact_space (euclidean_space ℝ (fin n)) :=
FEW SHOT PROMPTS TO CODEX(END)-/
|
%File: AAAI-inst.tex
% WARNING: If you are not an experienced LaTeX user, AAAI does
% NOT recommend that you use LaTeX to format your paper. No
% support for LaTeX is provided by AAAI, and these instructions
% and the accompanying style files are NOT guaranteed to work.
% If the results you obtain are not in accordance with the
% specifications you received in your packet (or online), you
% must correct the style files or macro to achieve the correct
% result.
%
% AAAI CANNOT HELP YOU WITH THIS TASK.
%
% The instructions herein are provided as a general guide for
% experienced LaTeX users who would like to use that software
% to format their paper for an AAAI Press proceedings or technical
% report or AAAI working notes. These instructions are generic.
% Consequently, they do not include specific dates, page charges, and so forth.
% Please consult your specific written conference instructions for
% details regarding your submission.
%
% Acknowledgments
% The preparation of the \LaTeX{} and Bib\TeX{} files that
% implement these instructions was supported by
% Schlumberger Palo Alto Research, AT\&T Bell
% Laboratories, Morgan Kaufmann Publishers, and AAAI Press.
\documentclass[letterpaper]{article}
\usepackage{aaai}
\usepackage{times}
\usepackage{helvet}
\usepackage{courier}
\begin{document}
% The file aaai.sty is the style file for AAAI Press
% proceedings, working notes, and technical reports.
%
\title{Formatting Your AAAI Paper Using the \LaTeX\ Style Files}
\author{AAAI Press\\
American Association for Artificial Intelligence\\
445 Burgess Drive\\
Menlo Park, California 94025--3496\\
[email protected]}
\maketitle
\begin{abstract}
\begin{quote}
This document provides a very brief overview of the AAAI style file
for \LaTeX2e, as well as some general instructions on using the
Times Roman font set. To use this style file, you must already
be familiar with \LaTeX\ and must read the general formatting
instructions supplied in your author kit. This document just gives you some
brief instructions on using the
aaai.sty file. Most common formatting commands are included in this document.
\end{quote}
\end{abstract}
\section{About These Instructions}
In the past, this instruction file has contained general formatting instructions
for persons preparing their papers for an AAAI proceedings. Those instructions
are now available on AAAI's website in PDF format only, and are part of the
general author kit distributed to all authors whose papers have been accepted by
AAAI for publication in an AAAI conference proceedings. This document only
contains specific information of interest to \LaTeX\ users.
{\bf Warning:} If you are not an experienced \LaTeX\ user, AAAI does {\bf not}
recommend that you use \LaTeX\ to format your paper. No support for LaTeX is
provided by AAAI, and these instructions and the accompanying style files are {\bf
not} guaranteed to work. If the results you obtain are not in accordance with the
specifications you received in your packet (or online), you must correct the style
files or macro to achieve the correct result. AAAI {\bf cannot} help you with this
task. The instructions herein are provided as a general guide for experienced
\LaTeX\ users who would like to use that software to format their paper for an
AAAI Press proceedings or technical report or AAAI working notes. These
instructions are generic. Consequently, they do not include specific dates, page
charges, and so forth. Please consult your specific written conference
instructions for details regarding your submission.
\section{Output}
To ready your paper for publication, please read the ``Instructions for Authors''
paper. This document is available on AAAI's website, and is supplied in your
author kit.
\subsection{Paper Size}
If you are outside the US, the \LaTeX\ default paper size has most likely been
changed from ``letterpaper" to ``a4." Because we require that your electronic
paper be formatted in US letter size, you will need to change the default back to
US letter size. Assuming you are using the 2e version of \LaTeX\, you can do this
by including the [letterpaper] option at the beginning of your file:
\begin{footnotesize}
\begin{verbatim}
\documentclass[letterpaper]{article}.
\end{verbatim}
\end{footnotesize}
This command is usually sufficient to change the format for LaTeX. However, it
is also usually necessary to configure dvips. Try passing the -tletter option to
dvips. Those using RedHat Linux 8.0 and LaTeX should also check the paper size
setting in "/usr/share/texmf/dvips/config/config.ps" --- it may be that ``A4" is
the default, rather than ``letter." This can result in incorrect top and bottom
margins in documents you prepare with LaTeX. You will need to edit the config
file to correct the problem. (Once you've edited to config file for US letter, it
may not be possible for you to print your papers locally).
\section{The AAAI Style File}
The latest version of the AAAI style file is available on AAAI's website. You
should download this file and place it in a file named ``aaai.sty" in the \TeX\
search path. Placing it in the same directory as the paper should also work. (We
recommend that you download the complete author kit so that you will have the
latest bug list and instruction set.
\subsection{Using the Style File}
In the \LaTeX\ source for your paper, place the following lines as follows:
\begin{footnotesize}
\begin{verbatim}
\documentclass[letterpaper]{article}
\usepackage{aaai}
\usepackage{times}
\usepackage{helvet}
\usepackage{courier}\title{Title}
\author{Author 1 \and Author 2 \\
Address line \\ Address line
\And
Author 3 \\ Address line \\ Address line}
\begin{document}
\maketitle
...
\end{document}
\end{verbatim}
\end{footnotesize}
This command set-up is for three authors. Add or subtract author and address
lines as necessary. In most instances, this is all you need to do to format your
paper in the Times font. The helvet package will cause Helvetica to be used for
sans serif, and the courier package will cause Courier to be used for the
typewriter font. These files are part of the PSNFSS2e package, which is freely
available from many Internet sites (and is often part of a standard installation.
If using these commands does not work for you (and you are using \LaTeX2e), you
will need to refer to the fonts information found later on in this document.
\subsubsection{Including a Reference List}
At the end of your paper, you can include your reference list by using the
following commands:
\begin{footnotesize}
\begin{verbatim}
\bibliography{Bibliography-File}
\bibliographystyle{aaai}
\end{document}
\end{verbatim}
\end{footnotesize}
\subsubsection{Formatting Author Information}
Author information can be set in a number of different styles, depending on the
number of authors and the number of affiliations you need to display. For
several authors from the same institution, use \verb+\+and:
\begin{footnotesize}
\begin{verbatim}
\author{Author 1 \and
...
\and Author n \\
Address line \\
...
\\ Address line}
\end{verbatim}
\end{footnotesize}
\noindent If the names do not fit well on one line use:
\begin{footnotesize}
\begin{verbatim}
\author{Author 1 \\ {\bf Author 2} \\
...
\\ {\bf Author n} \\
Address line \\
...
\\ Address line}
\end{verbatim}
\end{footnotesize}
\noindent For authors from different institutions, use \verb+\+And:
\begin{footnotesize}
\begin{verbatim}
\author{Author 1 \\ Address line \\
...
\\ Address line
\And ... \And
Author n \\ Address line \\
...
\\ Address line}
\end{verbatim}
\end{footnotesize}
\noindent To start a separate ``row" of authors, use \verb+\+AND:
\begin{footnotesize}
\begin{verbatim}
\author{Author 1 \\ Address line \\
...
\\ Address line
\AND
Author 2 \\ Address line \\
...
\\ Address line \And
Author 3 \\ Address line \\
...
\\ Address line}
\end{verbatim}
\end{footnotesize}
\noindent If the title and author information does not fit in the area
allocated, place
\begin{footnotesize}
\begin{verbatim}
\setlength\titlebox{\emph{height}}
\end{verbatim}
\end{footnotesize}
after the \verb+\+documentclass line where \emph{height} is
something like 2.5in.
\subsubsection{Adding Acknowledgements}
To acknowledge other contributors, grant support, or whatever, use
\verb+\+thanks in either the \verb+\+author or \verb+\+title commands.
For example:
\begin{footnotesize}
\begin{verbatim}
\title{Very Important Results in
AI\thanks{This work is supported by
everybody.}}
\end{verbatim}
\end{footnotesize}
Multiple \verb+\+thanks commands can be given. Each will result in a
separate footnote indication in the author or title with the
corresponding text at the bottom of the first column of the document.
For example:
\begin{footnotesize}
\begin{verbatim}
\author{A. Researcher\thanks{Now at
Microsoft.} \andB. Researcher\thanks{Not
at Microsoft.}}
\end{verbatim}
\end{footnotesize}
One common error with \verb+\+thanks is forgetting to use
\verb+\+protect on what \LaTeX\ calls ``fragile'' commands.
\subsubsection{Adding a Publication Note}
To add a comment to the header of document, use \verb+\+pubnote, as in
\verb+\+pubnote\{\verb+\+emph\{To appear, AI Journal\}\}
This should be placed after the title and author information but
before \verb+\+maketitle. Note that \verb+\+pubnote is for printing
the paper yourself, and should not be used in submitted versions!
\subsubsection{Copyright information}
By default, the AAAI copyright slug will be printed at the bottom of
the first column of your document. To suppress the copyright slug,
use \verb+\+nocopyright somewhere before \verb+\+maketitle. To change
the year in the copyright slug from the current year, use
\verb+\+copyrightyear\{\emph{year}\}
To change the entire text of the copyright slug, use
\verb+\+copyrighttext\{\emph{text}\}
Either of these must appear before \verb+\+maketitle.
\section{Bibliography Style and References}
The aaai.sty file includes a set of definitions for use in
formatting references with BibTeX. These definitions make the
bibliography style closer to the one specified in the ``Instructions
to Authors'' for AAAI papers.
To use these definitions, you also need the BibTeX style file
aaai.bst, available from the AAAI web site.
Then, at the end of your paper but before \verb+\+end{document}, you
need to put the following lines:
\begin{footnotesize}
\begin{verbatim}
\bibliographystyle{aaai}
\bibliography{bibfile1,bibfile2,...}
\end{verbatim}
\end{footnotesize}
The list of files in the bibliography command should be the
names of your BibTeX source files (that is, the .bib files
referenced in your paper).
The following commands are available for your use in citing
references:
\begin{description}
\item \verb+\+cite: Cites the given reference(s) with a full citation.
This appears as ``(Author Year)'' for one reference, or ``(Author Year;
Author Year)'' for multiple references.
\item \verb+\+shortcite: Cites the given reference(s) with just the year.
This appears as ``(Year)'' for one reference, or ``(Year; Year)''
for multiple references.
\item \verb+\+citeauthor: Cites the given reference(s) with just the
author name(s) and no parentheses.
\item \verb+\+citeyear: Cites the given reference(s) with just the
fate(s) and no parentheses.
\end{description}
\section{Copyright}
If you were required to transfer copyright of your paper to AAAI, you must include
the AAAI copyright notice and web site address on all copies of your paper,
whether electronic or paper (including the camera copy you provide to AAAI.) If
you use the latest AAAI style file, the copyright line will be inserted for you
automatically. (If your paper doesn't include the copyright slug and it should,
the paper will be returned to you for reformatting.) If we did not require you to
transfer copyright, you may disable the copyright line using the
\verb+\+nocopyrightcommand.
\section{Fonts}
Papers published in AAAI publicatons must now be formatted using the Times family of
fonts, so that all papers in the proceedings have a uniform appearance. If you've
been using Computer Modern, the first advantage you will see to using Times is that
the character count is smaller --- that means you can put more words on a page!
\subsection{Type 3 Fonts}
You've probably seen PDF files containing type 3 bitmapped fonts on the web (there
are files like that on AAAI's web site too). They're often the huge files that open
slowly, scroll very slowly, and aren't readable unless they're enlarged many times.
Aside from these problems, these files usually contain fonts designed for 300 dpi
printers, so they print at 300 dpi even if the printer resolution is 1200 dpi or
higher. They also often cause high resolution imagesetter devices to crash and
sometimes the PDF indexing software we use can't read them.
Because of these and other problems, as well as for purposes of uniformity, {\bf AAAI
will not longer accept electronic files where the text and headings are formatted
using obsolete type 3 fonts.} Documents with Type 3 bitmap fonts are not acceptable and will be returned to the authors.
Fortunately, there are effective workarounds that will
prevent your file from embedding type 3 bitmapped fonts.
The easiest workaround is to use the times, helvet, and courier packages with
\LaTeX\ 2e. (Note that papers formatted in this way will still use Computer Modern
for the mathematics. To make the math look good, you'll either have to use Symbol
or Lucida, or you will need to install type 1 Computer Modern fonts---for more on
these fonts, see the section ``Obtaining Type 1 Computer Modern.")
\subsection{Making dvips Behave}
If your PostScript output still includes type 3 fonts, you should run dvips with
option ``dvips -Ppdf -G0 -o papername.ps papername.dvi" (If your machine or site
has type 1 fonts, they will probably be loaded.) Note that it is a zero folloing
the ``-G." This tells dvips to use the config.pdf file (and this file refers to a
better font mapping). If that doesn't work, you'll have to download the fonts and
create a font substitution list.
\subsubsection{dvipdf Script}
Scripts such as dvipdf which ostensibly bypass the Postscript intermediary should not be used since they generally do not instruct dvips to use the config.pdf file.
\subsection{Pdflatex}
Pdflatex is a good alternative solution to the \LaTeX font problem. By using
the pdftex program instead of straight \LaTeX or \TeX, you will avoid the type
3 font problem altogether. However, there is a problem with Pdflatex that
you might need to overcome. The program often won't embed all
fonts. To solve this potential disaster, you must ensure that all of the fonts are embedded (use
pdffonts). If they are not, you need to configure pdftex to use a font map file
that specifies that the fonts be embedded. Also you should ensure that images
are not downsampled or otherwise compressed in a lossy way.
If fonts aren't getting embedded, users should look at the pdftex mailing list for hints on how to configure pdftex or
pdflatex to properly embed the typefaces: http://tug.org/pipermail/pdftex/2002-July/002803.html
\subsection{Ghostscript}
LatTeX users using GhsotScript should make sure that they are using v7.04 or newer. The older versions do
not create acceptable PDF files on most platforms.
\subsection{Graphics}
If you are still finding Type 3 fonts in your PDF file, look at your graphics! LaTeX users should check all their imported graphics files as well for font problems!
\subsection{Obtaining Type 1 Computer Modern}
If you {\it must} use Computer Modern for the mathematics in your paper (you can't
use it for the text anymore) you will need to download the type 1 Computer fonts.
They are available without charge from the American Mathematical Society. Point
your browser to the following url to find them:
http://www.ams.org/tex/type1-fonts.html
Type 1 versions of Computer Modern are also available (for free) from the BaKoMa
collection at http://xxx.lanl.gov/ftp/pub/fonts/x-windows/
\subsubsection{Making A Font Substitution List}
Once you've installed the type 1 Computer Modern fonts, you'll need to get dvips to
refrain from embedding the bitmap fonts. To do this, you'll need to create a font
substitution list for use by dvips. Each line of this file should start with the
name of the font that TeX uses, as shown below:
\begin{footnotesize}
\begin{flushleft}
cmb10 $<$/usr/local/lib/tex/fonts/type1/cmb10.pfb \\
cmbsy10 $<$/usr/local/lib/tex/fonts/type1/cmbsy10.pfb \\
cmbsy6 $<$/usr/local/lib/tex/fonts/type1/cmbsy6.pfb \\
cmbsy7 $<$/usr/local/lib/tex/fonts/type1/cmbsy7.pfb \\
cmbsy8 $<$/usr/local/lib/tex/fonts/type1/cmbsy8.pfb \\
cmbsy9 $<$/usr/local/lib/tex/fonts/type1/cmbsy9.pfb \\
cmbx10 $<$/usr/local/lib/tex/fonts/type1/cmbx10.pfb \\
cmbx12 $<$/usr/local/lib/tex/fonts/type1/cmbx12.pfb \\
\end{flushleft}
\end{footnotesize}
In this example, the assumption is that you have PFB versions of the Computer Modern
fonts located in the directory /urs/local/lib/tex/fonts/type1/. The file name
should be the type 1 encoding of the Postscript font in PFB or PFA format.
If your home directory contains a file called .dvipsrc containing the line: ``* p
+fontMapFileName" that font map will be used by dvips for all the jobs you run. You
can also created a file, like "config.embed" that contains that line. If you do
that, when you invoke dvips with the command ``dvips -P embed ...," dvips will look
for config embed in the current directory (and perhaps your home directory). You
may need to change how dvips looks for config files. To do this, read the
``environment variables" section of the dvips documentation.
If you need more information, or a better and more technical explanation of how to
make this all work, Kendall Whitehouse has written detailed instructions on
"Creating Quality Adobe PDF FIles from TeX with DVIPS." It is available from
Adobe's Web Site, and other sites on the Internet (you'll need to do a quick search
for it).
\subsection{Checking For Improper Fonts}
Once a PDF has been made, authors should check to ensure that the file contains no Type 3 fonts and further that all
fonts have been embedded. This step is hardly ever used by authors, and it would save significant time (and money!)
if they would simply take 45 seconds and do this. This can be done with the pdffonts utility that is included in the
Xpdf package (http://www.foolabs.com/xpdf/).
Alternatively, you can use the File--Document Properties--Fonts option in Acrobat Reader;
if you chose the latter, you should be sure that no other PDF documents are open at the time.
\section{Citations and References}
Be sure to read the ``Formatting Instructions for Authors" paper that was included
in your author kit (and is available on the AAAi website. \LaTeX\ will handle your
citations improperly unless you change its configuration and use the correct
commands. The AAAI style file and the BibTeX files will help you in this regard.
George Ferguson's paper shows you the proper commands necessary to implement
AAAI citation and reference style.
\section{Illustrations and Figures}
Figures, drawings, tables, and photographs should be placed throughout the paper
near the place where they are first discussed. Do not group them together at the end
of the paper. \LaTeX\ will sometimes put portions of the figure or table in the
margin. If this happens, you need to scale the figure or table down, because {\bf
nothing} (even a line!) is allowed to intrude into the margins.
\section{Electronic Submissions}
To aid in the creation of a permanent electronic archive of all its publications and for creation
of its publications, AAAI requires electronic submission of your paper in PDF format, as well as
its abstract, and author--title information. Please see the Author Formatting Instructions
document for additional information.
As a \LaTeX\ user, you need to pay attention to the special requirements imposed on you. In
particular, although you are required to submit a PDF version of your paper, we may also require
that you submit, in a tar, zipped, or stuffed archive, all the source files (including any
figures) you used to create your paper. If we do request this material, please provide us with a
{\bf single} source file containing your entire paper, including the bibliography. Also please
remove all commented out portions of your paper. We may also request that you send us the figures
that accompany your document. Please do not send us material that is not actually used in the
paper.
If we ask for this material, it is because nearly all the problems we have with electronic
submissions come from persons using \LaTeX\ . Many of the problems would be easy to fix if we had
all the source files, which is why we may ask you to
send them to us. Even if we can't take the time to fix the file, we can usually tell quite
quickly what is wrong if we have your source, and give you directions on how you might fix it
yourself.
\section{Possible Bugs in the AAAI Style File}
Some users have found that the aaai.sty does not work properly at their site. They have submitted
suggestions for improvement of the macro. You will find those suggestions in the buglist file
that is part of complete set, and also as a separate file on the AAAI website. Some of these
suggestions have already been implemented, while others seem to be dependent on individual site
conditions. If you're having problems with aaai.sty, we suggest you look at the ``bug list." The
AAAI style is {\bf not} guaranteed to work. It is provided in the hope that it will make the
preparation of papers easier. There are undoubtably bugs in this style. If you make bug fixes,
improvements, etc. please let us know so that we might include them in the buglist.
\section{Inquiries}
If you have any general questions about the preparation or submission of your paper, please
contact AAAI Press. If you have technical questions about implementation of the macros, please
contact an expert at your site. We do not provide technical support for \LaTeX\ or any other
software package. If you are new to \LaTeX\, your paper is fairly straightforward, and doesn't
include multilevel equations, you will probably find that you can format it much faster using a
word-processing program like Microsoft Word. This is especialy true if your paper includes a
number of pictures or graphics.
\section{A Note on Printing}
Some laser printers have a serious problem printing \TeX\ output. These printing devices,
commonly known as ``write-white'' laser printers, tend to make characters too light. To get
around this problem, a darker set of fonts must be created for these devices.
\section{ Acknowledgments}
AAAI is especially grateful to Peter Patel Schneider for his work in implementing the aaai.sty
file, liberally using the ideas of other style hackers, including Barbara Beeton. We also
acknowledge with thanks the work of George Ferguson for his guide to using the style and BibTeX
files --- which has been incorporated into this document and comprises almost all the subsection
entitled ``Using the AAAI Style File," as well as the many others who have, from time to time,
send in suggestions on improvements to the AAAI styles.
The preparation of the \LaTeX{} and Bib\TeX{} files that implement these instructions was
supported by Schlumberger Palo Alto Research, AT\&T Bell
Laboratories, Morgan Kaufmann Publishers, and AAAI Press. Bibliography style changes were added
by Sunil Issar. \verb+\+pubnote was added by J. Scott Penberthy. George Ferguson added support for
printing the AAAI copyright slug.
\bigskip
\noindent Thank you for reading these instructions carefully. We look forward to
receiving your camera-ready copy!
\end{document}
|
# setup enviroment
library(tidyverse)
# load data
ds <- diamonds
# scatterplot of price vs x
ggplot(data = ds, aes(y = price, x = x)) +
geom_point()
# correlations between price and x/y/z
cor.test(ds$price, ds$x)
cor.test(ds$price, ds$y)
cor.test(ds$price, ds$z)
# scatterplot of price vs depth
ggplot(data = ds, aes(y = price, x = depth)) +
geom_point(alpha = 1/100) +
scale_x_continuous(breaks = 2)
# correlation between price and depth
cor.test(ds$price, ds$depth)
# scatterpolt between price and carat without top 1%
ggplot(data = ds, aes(y = price, x = carat)) +
geom_point() +
scale_x_continuous(limits = c(0, quantile(ds$carat, 0.99))) +
scale_y_continuous(limits = c(0, quantile(ds$price, 0.99))) +
labs(title = "Price vs Carat", x = "Carat", y = "Price")
# create volume variable
ds$volume <- (ds$x * ds$y * ds$z)
# scatterplot of price vs volume
ggplot(data = ds, aes(y = price, x = volume)) +
geom_point()
# correlation between price and volume without diamonds with volume = 0 or >= 800
ds_subset <- subset(ds, volume > 0 & volume < 800)
cor.test(ds_subset$price, ds_subset$volume)
# scatterplot of price vs volume on ds subset
ggplot(data = ds_subset, aes(y = price, x = volume)) +
geom_point(alpha = 1/100) +
geom_smooth(method = "lm")
# create new data frame with summary statistics of ds
diamondsByClarity <- ds %>%
group_by(clarity) %>%
summarise(mean_price = mean(price),
median_price = median(price),
min_price = min(price),
max_price = max(price),
n = n())
# create new dataframe by clarity
diamonds_by_clarity <- group_by(ds, clarity)
diamonds_mp_by_clarity <- summarise(diamonds_by_clarity, mean_price = mean(price))
# create new dataframe by color
diamonds_by_color <- group_by(ds, color)
diamonds_mp_by_color <- summarise(diamonds_by_color, mean_price = mean(price))
# barplots of mean diamond prices by clarity and color
bp_by_clarity <- ggplot(data = diamonds_mp_by_clarity, aes(x = clarity, y = mean_price)) + geom_boxplot()
bp_by_color <- ggplot(data = diamonds_mp_by_color, aes(x = color, y = mean_price)) + geom_boxplot()
# display barplots on single canvas
library(gridExtra)
grid.arrange(bp_by_clarity, bp_by_color)
# work with gapminder data
gm <- readxl::read_excel("./lesson3/gapminder.xlsx") |
import numpy as np
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)
A_ix = A.argsort()[::-1]
for i in range(M):
if(A[A_ix[0]] > A[A_ix[1]]):
A[A_ix[0]] = math.floor(A[A_ix[0]] / 2)
else:
A_ix = A.argsort()[::-1]
A[A_ix[0]] = math.floor(A[A_ix[0]] / 2)
print(A.sum())
|
------------------------------------------------------------------------------
-- Fair properties
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.ABP.Fair.PropertiesATP where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.List
open import FOTC.Program.ABP.Fair.Type
open import FOTC.Program.ABP.Terms
------------------------------------------------------------------------------
-- Because a greatest post-fixed point is a fixed-point, then the Fair
-- predicate is also a pre-fixed point of the functional FairF, i.e.
--
-- FairF Fair ≤ Fair (see FOTC.Program.ABP.Fair).
-- See Issue https://github.com/asr/apia/issues/81 .
Fair-inA : D → Set
Fair-inA os = ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair os'
{-# ATP definition Fair-inA #-}
Fair-in : ∀ {os} → ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair os' →
Fair os
Fair-in h = Fair-coind Fair-inA h' h
where
postulate
h' : ∀ {os} → Fair-inA os →
∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair-inA os'
{-# ATP prove h' #-}
head-tail-Fair : ∀ {os} → Fair os → os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os
head-tail-Fair {os} Fos with Fair-out Fos
... | (.(T ∷ []) , os' , f*tnil , h , Fos') = prf
where
postulate prf : os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os
{-# ATP prove prf #-}
... | (.(F ∷ ft) , os' , f*tcons {ft} FTft , h , Fos') = prf
where
postulate prf : os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os
{-# ATP prove prf #-}
tail-Fair : ∀ {os} → Fair os → Fair (tail₁ os)
tail-Fair {os} Fos with Fair-out Fos
... | .(T ∷ []) , os' , f*tnil , h , Fos' = prf
where
postulate prf : Fair (tail₁ os)
{-# ATP prove prf #-}
... | .(F ∷ ft) , os' , f*tcons {ft} FTft , h , Fos' = prf
where
postulate prf : Fair (tail₁ os)
{-# ATP prove prf Fair-in #-}
|
{-# OPTIONS --guardedness-preserving-type-constructors #-}
module Issue602 where
infixl 6 _⊔_
postulate
Level : Set
zero : Level
suc : Level → Level
_⊔_ : Level → Level → Level
{-# BUILTIN LEVEL Level #-}
{-# BUILTIN LEVELZERO zero #-}
{-# BUILTIN LEVELSUC suc #-}
{-# BUILTIN LEVELMAX _⊔_ #-}
infix 1000 ♯_
postulate
∞ : ∀ {a} (A : Set a) → Set a
♯_ : ∀ {a} {A : Set a} → A → ∞ A
♭ : ∀ {a} {A : Set a} → ∞ A → A
{-# BUILTIN INFINITY ∞ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}
data CoNat : Set0 where
z : CoNat
s : ∞ CoNat → CoNat
record A : Set2 where
field
f : Set1
record B (a : ∞ A) : Set1 where
field
f : A.f (♭ a)
postulate
a : A
e : CoNat → A
e z = a
e (s n) = record
{ f = B (♯ e (♭ n))
} |
/**
* copyright (C) 2004
* the icecube collaboration
* $Id: I3GSLRandomService.h 161127 2018-02-20 14:27:18Z kjmeagher $
*
* @brief An implementation of the I3RandomService interface.
*
* Uses the gsl library for the random numbers
*
* @version $Revision: 161127 $
* @date $Date: 2018-02-20 07:27:18 -0700 (Tue, 20 Feb 2018) $
* @author pretz
*/
#ifndef I3GSLRANDOMSERVICE_H
#define I3GSLRANDOMSERVICE_H
#include "phys-services/I3RandomService.h"
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_test.h>
/**
* This is (the state for) a shim which allows us to count the calls to the
* RNG, but otherwise hands all work off to the real GSL implmentations.
*/
typedef struct
{
unsigned long int seed;
uint64_t icalls;
uint64_t dcalls;
gsl_rng* rng;
} gsl_rng_wrapper_state;
extern const gsl_rng_type gsl_rng_counting_wrapper;
class I3GSLRandomService : public I3RandomService{
public:
/**
* default constructor
*/
I3GSLRandomService();
/**
* constructor
*/
explicit I3GSLRandomService(unsigned long int seed, bool track_state=true);
/**
* destructor
*/
virtual ~I3GSLRandomService();
/**
* a number drawn from a binomial distribution
*/
virtual int Binomial(int ntot, double prob);
/**
* A number from an Exponential distribution
*/
virtual double Exp(double tau);
/**
* An integer drawn uniformly from [0,imax)
*/
virtual unsigned int Integer(unsigned int imax);
/**
* An integer drawn from a Poisson distribution
*/
virtual int Poisson(double mean);
/**
* A number drawn from a Poisson distribution, as a double
*/
virtual double PoissonD(double mean);
/**
* a double drawn from a uniform distribution (0,x1)
*/
virtual double Uniform(double x1 = 1);
/**
* a double drawn from a uniform distribution (x1,x2)
*/
virtual double Uniform(double x1, double x2);
/**
* a double drawn from a Gaussian distribution with given
* mean and standard deviation
*/
virtual double Gaus(double mean, double stddev);
/**
* get all information necessary to restore the internal
* state of the generator
*/
virtual I3FrameObjectPtr GetState() const;
/**
* restore the internal state of the generator
*/
virtual void RestoreState(I3FrameObjectConstPtr state);
private:
// private copy constructors and assignment
I3GSLRandomService(const I3GSLRandomService& );
I3GSLRandomService operator=(const I3GSLRandomService& );
/**
* Helper function which constructs our preferred GSL RNG.
*/
static void construct(gsl_rng*& r);
/**
* Helper function which constructs a GSL RNG wrapped with the counting shim
*/
static void construct_counted(gsl_rng*& r);
gsl_rng* r;
bool track_state;
SET_LOGGER("I3GSLRandomService");
//let gsl_wrapper_set use construct()
friend void gsl_wrapper_set(void* vstate, unsigned long int s);
};
I3_POINTER_TYPEDEFS(I3GSLRandomService);
#endif //I3GSLRANDOMSERVICE_H
|
Yai, yai, omae no atama wa doko dai?
Atama wa doko dai? Medama to kuchibashi wa?
Come, come, come, shall we dance?
Hey, hey, you, where's your head?
Where's your head? Your eyes and your beak?
Hey, hey, you, where are your feelings?
Show me you can cry, show me you can laugh! |
%default total
data Tag = A | B | C | Unknown | Unchecked
data Doutput : Tag -> Type where
Ca : Doutput A
Cb : Doutput B
Cc : Doutput C
Cu : Doutput Unknown
Cs : String -> Doutput Unchecked
{- Based on output from database you construct type -}
typelevel : (a : Doutput Unchecked) -> Type
typelevel (Cs "A") = Doutput A
typelevel (Cs "B") = Doutput B
typelevel (Cs "C") = Doutput C
typelevel (Cs s) = Doutput Unknown
{- Check value takes a type of Doutput Unchecked and transforms into one the known or unknown file format -}
checkValue : (a : Doutput Unchecked) -> typelevel a
checkValue (Cs "A") = Ca
checkValue (Cs "B") = Cb
checkValue (Cs "C") = Cc
checkValue (Cs s) = ?Cu {- I am leaving it as meta variable beacause Idris is refusing to simplify it -}
{-
*Typefromdatabase> :r
Type checking ./Typefromdatabase.idr
Holes: Main.Cu1
*Typefromdatabase> ch
changeDir check checkValue choice choiceMap chr
*Typefromdatabase> checkValue (Cs "A")
Ca : Doutput A
Holes: Main.Cu1
*Typefromdatabase> checkValue (Cs "B")
Cb : Doutput B
Holes: Main.Cu1
*Typefromdatabase> checkValue (Cs "C")
Cc : Doutput C
Holes: Main.Cu1
*Typefromdatabase> checkValue (Cs "Hello Wrold")
?Cu1 : Doutput Unknown
Holes: Main.Cu1
*Typefromdatabase> -}
|
function [varargout] = ft_selectdata(cfg, varargin)
% FT_SELECTDATA makes a selection in the input data along specific data
% dimensions, such as channels, time, frequency, trials, etc. It can also
% be used to average the data along each of the specific dimensions.
%
% Use as
% [data] = ft_selectdata(cfg, data, ...)
%
% The cfg argument is a configuration structure which can contain
% cfg.tolerance = scalar, tolerance value to determine equality of time/frequency bins (default = 1e-5)
%
% For data with trials or subjects as repetitions, you can specify
% cfg.trials = 1xN, trial indices to keep, can be 'all'. You can use logical indexing, where false(1,N) removes all the trials
% cfg.avgoverrpt = string, can be 'yes' or 'no' (default = 'no')
%
% For data with a channel dimension you can specify
% cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION
% cfg.avgoverchan = string, can be 'yes' or 'no' (default = 'no')
% cfg.nanmean = string, can be 'yes' or 'no' (default = 'no')
%
% For data with channel combinations you can specify
% cfg.channelcmb = Nx2 cell-array with selection of channels (default = 'all'), see FT_CHANNELCOMBINATION
% cfg.avgoverchancmb = string, can be 'yes' or 'no' (default = 'no')
%
% For data with a time dimension you can specify
% cfg.latency = scalar or string, can be 'all', 'minperiod', 'maxperiod', 'prestim', 'poststim', or [beg end], specify time range in seconds
% cfg.avgovertime = string, can be 'yes' or 'no' (default = 'no')
% cfg.nanmean = string, can be 'yes' or 'no' (default = 'no')
%
% For data with a frequency dimension you can specify
% cfg.frequency = scalar or string, can be 'all', or [beg end], specify frequency range in Hz
% cfg.avgoverfreq = string, can be 'yes' or 'no' (default = 'no')
% cfg.nanmean = string, can be 'yes' or 'no' (default = 'no')
%
% When you average over a dimension, you can choose whether to keep that dimension in
% the data representation or remove it alltogether.
% cfg.keeprptdim = 'yes' or 'no' (default is automatic)
% cfg.keepchandim = 'yes' or 'no' (default = 'yes')
% cfg.keepchancmbdim = 'yes' or 'no' (default = 'yes')
% cfg.keeptimedim = 'yes' or 'no' (default = 'yes')
% cfg.keepfreqdim = 'yes' or 'no' (default = 'yes')
%
% If multiple input arguments are provided, FT_SELECTDATA will adjust the individual
% inputs such that either the INTERSECTION across inputs is retained (i.e. only the
% channel, time, and frequency points that are shared across all input arguments), or
% that the UNION across inputs is retained (replacing missing data with nans). In
% either case, the order of the channels is made consistent across inputs. The
% behavior can be specified with
% cfg.select = string, can be 'intersect' or 'union' (default = 'intersect')
% For raw data structures you cannot make the union.
%
% See also FT_DATATYPE, FT_CHANNELSELECTION, FT_CHANNELCOMBINATION
% Undocumented options
% cfg.avgoverpos
% cfg.keepposdim = 'yes' or 'no' (default = 'yes')
% Copyright (C) 2012-2022, Robert Oostenveld & Jan-Mathijs Schoffelen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$
% these are used by the ft_preamble/ft_postamble function and scripts
ft_revision = '$Id$';
ft_nargin = nargin;
ft_nargout = nargout;
ft_defaults
ft_preamble init
ft_preamble debug
ft_preamble loadvar varargin
ft_preamble provenance varargin
% determine the characteristics of the input data
dtype = ft_datatype(varargin{1});
for i=2:length(varargin)
% ensure that all subsequent inputs are of the same type
ok = ft_datatype(varargin{i}, dtype);
if ~ok, ft_error('input data should be of the same datatype'); end
end
% this only works with certain data types, it is not meant for descriptive fields such as elec, grad, opto, layout, etc.
assert(~ismember(dtype, {'elec', 'grad', 'opto', 'layout'}), 'invalid input data type "%s"', dtype);
% ensure that the user does not give invalid selection options
cfg = ft_checkconfig(cfg, 'forbidden', {'foi', 'toi'});
cfg = ft_checkconfig(cfg, 'renamed', {'selmode', 'select'});
cfg = ft_checkconfig(cfg, 'renamed', {'toilim', 'latency'});
cfg = ft_checkconfig(cfg, 'renamed', {'foilim', 'frequency'});
cfg = ft_checkconfig(cfg, 'renamed', {'avgoverroi', 'avgoverpos'});
cfg = ft_checkconfig(cfg, 'renamedval', {'parameter', 'avg.pow', 'pow'});
cfg = ft_checkconfig(cfg, 'renamedval', {'parameter', 'avg.mom', 'mom'});
cfg = ft_checkconfig(cfg, 'renamedval', {'parameter', 'avg.nai', 'nai'});
cfg = ft_checkconfig(cfg, 'renamedval', {'parameter', 'trial.pow', 'pow'});
cfg = ft_checkconfig(cfg, 'renamedval', {'parameter', 'trial.mom', 'mom'});
cfg = ft_checkconfig(cfg, 'renamedval', {'parameter', 'trial.nai', 'nai'});
cfg.tolerance = ft_getopt(cfg, 'tolerance', 1e-5); % default tolerance for checking equality of time/freq axes
cfg.select = ft_getopt(cfg, 'select', 'intersect'); % default is to take intersection, alternative 'union'
if isequal(dtype, 'raw') && isequal(cfg.select, 'union')
ft_error('using cfg.select=''union'' in combination with ''raw'' datatype is not supported');
end
if strcmp(dtype, 'volume') || strcmp(dtype, 'segmentation')
% it must be a source representation, not a volume representation
for i=1:length(varargin)
varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'source');
end
dtype = 'source';
else
% check that the data is according to the latest FieldTrip representation
for i=1:length(varargin)
varargin{i} = ft_checkdata(varargin{i});
end
end
% this function only works for the upcoming (not yet standard) source representation without sub-structures
% update the old-style beamformer source reconstruction to the upcoming representation
if strcmp(dtype, 'source')
if isfield(varargin{1}, 'avg') && isstruct(varargin{1}.avg)
restoreavg = fieldnames(varargin{1}.avg);
else
restoreavg = {};
end
for i=1:length(varargin)
varargin{i} = ft_datatype_source(varargin{i}, 'version', 'upcoming');
end
end
cfg.latency = ft_getopt(cfg, 'latency', 'all', 1);
if isnumeric(cfg.latency) && numel(cfg.latency)==2 && cfg.latency(1)==cfg.latency(2)
% this is better specified by a single number
cfg.latency = cfg.latency(1);
end
cfg.channel = ft_getopt(cfg, 'channel', 'all', 1);
cfg.trials = ft_getopt(cfg, 'trials', 'all', 1);
if length(varargin)>1 && ~isequal(cfg.trials, 'all')
ft_error('it is ambiguous to make a subselection of trials while at the same time concatenating multiple data structures')
end
cfg.frequency = ft_getopt(cfg, 'frequency', 'all', 1);
if isnumeric(cfg.frequency) && numel(cfg.frequency)==2 && cfg.frequency(1)==cfg.frequency(2)
% this is better specified by a single number
cfg.frequency = cfg.frequency(1);
end
datfield = fieldnames(varargin{1});
for i=2:length(varargin)
% only consider fields that are present in all inputs
datfield = intersect(datfield, fieldnames(varargin{i}));
end
datfield = setdiff(datfield, {'label' 'labelcmb'}); % these fields will be used for selection, but are not treated as data fields
datfield = setdiff(datfield, {'dim'}); % not used for selection, also not treated as data field
datfield = setdiff(datfield, ignorefields('selectdata'));
orgdim1 = datfield(~cellfun(@isempty, regexp(datfield, 'label$')) & cellfun(@isempty, regexp(datfield, '^csd'))); % xxxlabel, with the exception of csdlabel
datfield = setdiff(datfield, orgdim1);
datfield = datfield(:)';
orgdim1 = datfield(~cellfun(@isempty, regexp(datfield, 'dimord$'))); % xxxdimord
datfield = setdiff(datfield, orgdim1);
datfield = datfield(:)';
sel = strcmp(datfield, 'cumtapcnt');
if any(sel)
% move this field to the end, as it is needed to make the selections in the other fields
datfield(sel) = [];
datfield = [datfield {'cumtapcnt'}];
end
orgdim2 = cell(size(orgdim1));
for i=1:length(orgdim1)
orgdim2{i} = varargin{1}.(orgdim1{i});
end
dimord = cell(size(datfield));
for i=1:length(datfield)
dimord{i} = getdimord(varargin{1}, datfield{i});
end
% do not consider fields of which the dimensions are unknown
% sel = cellfun(@isempty, regexp(dimord, 'unknown'));
% for i=find(~sel)
% fprintf('not including "%s" in selection\n', datfield{i});
% end
% datfield = datfield(sel);
% dimord = dimord(sel);
% determine all dimensions that are present in all data fields
dimtok = {};
for i=1:length(datfield)
dimtok = cat(2, dimtok, tokenize(dimord{i}, '_'));
end
dimtok = unique(dimtok);
hasspike = any(ismember(dimtok, 'spike'));
haspos = any(ismember(dimtok, {'pos' '{pos}'}));
haschan = any(ismember(dimtok, {'chan' '{chan}'}));
haschancmb = any(ismember(dimtok, 'chancmb'));
hasfreq = any(ismember(dimtok, 'freq'));
hastime = any(ismember(dimtok, 'time'));
hasrpt = any(ismember(dimtok, {'rpt' 'subj' '{rpt}'}));
hasrpttap = any(ismember(dimtok, 'rpttap'));
if hasspike
% cfg.latency is used to select individual spikes, not to select from a continuously sampled time axis
hastime = false;
end
clear dimtok
haspos = haspos && isfield(varargin{1}, 'pos');
haschan = haschan && isfield(varargin{1}, 'label');
haschancmb = haschancmb && isfield(varargin{1}, 'labelcmb');
hasfreq = hasfreq && isfield(varargin{1}, 'freq');
hastime = hastime && isfield(varargin{1}, 'time');
% do a sanity check on all input arguments
if haspos, assert(all(cellfun(@isfield, varargin, repmat({'pos'}, size(varargin)))), 'not all input arguments have a "pos" field'); end
if haschan, assert(all(cellfun(@isfield, varargin, repmat({'label'}, size(varargin)))), 'not all input arguments have a "label" field'); end
if haschancmb, assert(all(cellfun(@isfield, varargin, repmat({'labelcmb'}, size(varargin)))), 'not all input arguments have a "labelcmb" field'); end
if hasfreq, assert(all(cellfun(@isfield, varargin, repmat({'freq'}, size(varargin)))), 'not all input arguments have a "freq" field'); end
if hastime, assert(all(cellfun(@isfield, varargin, repmat({'time'}, size(varargin)))), 'not all input arguments have a "time" field'); end
avgoverpos = istrue(ft_getopt(cfg, 'avgoverpos', false)); % at some places it is also referred to as roi (region-of-interest)
avgoverchan = istrue(ft_getopt(cfg, 'avgoverchan', false));
avgoverchancmb = istrue(ft_getopt(cfg, 'avgoverchancmb', false));
avgoverfreq = istrue(ft_getopt(cfg, 'avgoverfreq', false));
avgovertime = istrue(ft_getopt(cfg, 'avgovertime', false));
avgoverrpt = istrue(ft_getopt(cfg, 'avgoverrpt', false));
% do a sanity check for the averaging options
if avgoverpos, assert(haspos, 'there are no source positions, so averaging is not possible'); end
if avgoverchan, assert(haschan, 'there is no channel dimension, so averaging is not possible'); end
if avgoverchancmb, assert(haschancmb, 'there are no channel combinations, so averaging is not possible'); end
if avgoverfreq, assert(hasfreq, 'there is no frequency dimension, so averaging is not possible'); end
if avgovertime, assert(hastime, 'there is no time dimension, so averaging over time is not possible'); end
if avgoverrpt, assert(hasrpt||hasrpttap, 'there are no repetitions, so averaging is not possible'); end
% set averaging function
cfg.nanmean = ft_getopt(cfg, 'nanmean', 'no');
if strcmp(cfg.nanmean, 'yes')
average = @nanmean;
else
average = @mean;
end
% by default we keep most of the dimensions in the data structure when averaging over them
keepposdim = istrue(ft_getopt(cfg, 'keepposdim', true));
keepchandim = istrue(ft_getopt(cfg, 'keepchandim', true));
keepchancmbdim = istrue(ft_getopt(cfg, 'keepchancmbdim', true));
keepfreqdim = istrue(ft_getopt(cfg, 'keepfreqdim', true));
keeptimedim = istrue(ft_getopt(cfg, 'keeptimedim', true));
keeprptdim = istrue(ft_getopt(cfg, 'keeprptdim', ~avgoverrpt));
if ~keepposdim, assert(avgoverpos, 'removing a dimension is only possible when averaging'); end
if ~keepchandim, assert(avgoverchan, 'removing a dimension is only possible when averaging'); end
if ~keepchancmbdim, assert(avgoverchancmb, 'removing a dimension is only possible when averaging'); end
if ~keepfreqdim, assert(avgoverfreq, 'removing a dimension is only possible when averaging'); end
if ~keeptimedim, assert(avgovertime, 'removing a dimension is only possible when averaging'); end
if ~keeprptdim, assert(avgoverrpt, 'removing a dimension is only possible when averaging'); end
% trim the selection to all inputs, rpt and rpttap are dealt with later
if hasspike, [selspike, cfg] = getselection_spike (cfg, varargin{:}); end
if haspos, [selpos, cfg] = getselection_pos (cfg, varargin{:}, cfg.tolerance, cfg.select); end
if haschan, [selchan, cfg] = getselection_chan (cfg, varargin{:}, cfg.select); end
if haschancmb, [selchancmb, cfg] = getselection_chancmb(cfg, varargin{:}, cfg.select); end
if hasfreq, [selfreq, cfg] = getselection_freq (cfg, varargin{:}, cfg.tolerance, cfg.select); end
if hastime, [seltime, cfg] = getselection_time (cfg, varargin{:}, cfg.tolerance, cfg.select); end
% this is to keep track of all fields that should be retained in the output
keepfield = datfield;
for i=1:numel(varargin)
for j=1:numel(datfield)
dimtok = tokenize(dimord{j}, '_');
% the rpt selection should only work with a single data argument
% in case tapers were kept, selrpt~=selrpttap, otherwise selrpt==selrpttap
[selrpt{i}, dum, rptdim{i}, selrpttap{i}] = getselection_rpt(cfg, varargin{i}, dimord{j});
% check for the presence of each dimension in each datafield
fieldhasspike = ismember('spike', dimtok);
fieldhaspos = ismember('pos', dimtok) || ismember('{pos}', dimtok);
fieldhaschan = (ismember('chan', dimtok) || ismember('{chan}', dimtok)) && isfield(varargin{1}, 'label');
fieldhaschancmb = ismember('chancmb', dimtok);
fieldhastime = ismember('time', dimtok) && ~hasspike;
fieldhasfreq = ismember('freq', dimtok);
fieldhasrpt = ismember('rpt', dimtok) | ismember('subj', dimtok) | ismember('{rpt}', dimtok);
fieldhasrpttap = ismember('rpttap', dimtok);
% cfg.latency is used to select individual spikes, not to select from a continuously sampled time axis
if fieldhasspike, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, find(strcmp(dimtok,'spike')), selspike{i}, false, 'intersect', average); end
if fieldhaspos, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, find(ismember(dimtok, {'pos', '{pos}'})), selpos{i}, avgoverpos, cfg.select, average); end
if fieldhaschan, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, find(ismember(dimtok,{'chan' '{chan}'})), selchan{i}, avgoverchan, cfg.select, average); end
if fieldhaschancmb, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, find(strcmp(dimtok,'chancmb')), selchancmb{i}, avgoverchancmb, cfg.select, average); end
if fieldhastime, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, find(strcmp(dimtok,'time')), seltime{i}, avgovertime, cfg.select, average); end
if fieldhasfreq, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, find(strcmp(dimtok,'freq')), selfreq{i}, avgoverfreq, cfg.select, average); end
if fieldhasrpt, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, rptdim{i}, selrpt{i}, avgoverrpt, 'intersect', average); end
if fieldhasrpttap, varargin{i} = makeselection(varargin{i}, datfield{j}, dimtok, rptdim{i}, selrpttap{i}, avgoverrpt, 'intersect', average); end
% update the fields that should be kept in the structure as a whole
% and update the dimord for this specific datfield
keepdim = true(size(dimtok));
if avgoverchan && ~keepchandim
keepdim(strcmp(dimtok, 'chan')) = false;
keepfield = setdiff(keepfield, 'label');
else
keepfield = [keepfield 'label'];
end
if avgoverchancmb && ~keepchancmbdim
keepdim(strcmp(dimtok, 'chancmb')) = false;
keepfield = setdiff(keepfield, 'labelcmb');
else
keepfield = [keepfield 'labelcmb'];
end
if avgoverfreq && ~keepfreqdim
keepdim(strcmp(dimtok, 'freq')) = false;
keepfield = setdiff(keepfield, 'freq');
else
keepfield = [keepfield 'freq'];
end
if avgovertime && ~keeptimedim
keepdim(strcmp(dimtok, 'time')) = false;
keepfield = setdiff(keepfield, 'time');
else
keepfield = [keepfield 'time'];
end
if avgoverpos && ~keepposdim
keepdim(strcmp(dimtok, 'pos')) = false;
keepdim(strcmp(dimtok, '{pos}')) = false;
keepdim(strcmp(dimtok, 'dim')) = false;
keepfield = setdiff(keepfield, {'pos' '{pos}' 'dim'});
elseif avgoverpos && keepposdim
keepfield = setdiff(keepfield, {'dim'}); % this should be removed anyway
else
keepfield = [keepfield {'pos' '{pos}' 'dim'}];
end
if avgoverrpt && ~keeprptdim
keepdim(strcmp(dimtok, 'rpt')) = false;
keepdim(strcmp(dimtok, 'rpttap')) = false;
keepdim(strcmp(dimtok, 'subj')) = false;
end
% update the sampleinfo, if possible, and needed
if strcmp(datfield{j}, 'sampleinfo') && ~isequal(cfg.latency, 'all')
if iscell(seltime{i}) && numel(seltime{i})==size(varargin{i}.sampleinfo,1)
for k = 1:numel(seltime{i})
varargin{i}.sampleinfo(k,:) = varargin{i}.sampleinfo(k,1) - 1 + seltime{i}{k}([1 end]);
end
elseif ~iscell(seltime{i}) && ~isempty(seltime{i}) && ~all(isnan(seltime{i}))
nrpt = size(varargin{i}.sampleinfo,1);
seltime{i} = seltime{i}(:)';
varargin{i}.sampleinfo = varargin{i}.sampleinfo(:,[1 1]) - 1 + repmat(seltime{i}([1 end]),nrpt,1);
end
end
varargin{i}.(datfield{j}) = squeezedim(varargin{i}.(datfield{j}), ~keepdim);
end % for datfield
% also update the fields that describe the dimensions, time/freq/pos have been dealt with as data
if haschan, varargin{i} = makeselection_chan (varargin{i}, selchan{i}, avgoverchan); end % update the label field
if haschancmb, varargin{i} = makeselection_chancmb(varargin{i}, selchancmb{i}, avgoverchancmb); end % update the labelcmb field
end % for varargin
if strcmp(cfg.select, 'union')
% create the union of the descriptive axes
if haspos, varargin = makeunion(varargin, 'pos'); end
if haschan, varargin = makeunion(varargin, 'label'); end
if haschancmb, varargin = makeunion(varargin, 'labelcmb'); end
if hastime, varargin = makeunion(varargin, 'time'); end
if hasfreq, varargin = makeunion(varargin, 'freq'); end
end
% remove all fields from the data structure that do not pertain to the selection
sel = strcmp(keepfield, '{pos}'); if any(sel), keepfield(sel) = {'pos'}; end
sel = strcmp(keepfield, 'chan'); if any(sel), keepfield(sel) = {'label'}; end
sel = strcmp(keepfield, 'chancmb'); if any(sel), keepfield(sel) = {'labelcmb'}; end
if avgoverrpt
% these are invalid after averaging
keepfield = setdiff(keepfield, {'cumsumcnt' 'cumtapcnt' 'trialinfo' 'sampleinfo'});
end
if avgovertime
% these are invalid after averaging or making a latency selection
keepfield = setdiff(keepfield, {'sampleinfo'});
end
for i=1:numel(varargin)
varargin{i} = keepfields(varargin{i}, [keepfield ignorefields('selectdata')']);
end
% restore the original dimord fields in the data
for i=1:length(orgdim1)
dimtok = tokenize(orgdim2{i}, '_');
% using a setdiff may result in double occurrences of chan and pos to
% disappear, so this causes problems as per bug 2962
% if ~keeprptdim, dimtok = setdiff(dimtok, {'rpt' 'rpttap' 'subj'}); end
% if ~keepposdim, dimtok = setdiff(dimtok, {'pos' '{pos}'}); end
% if ~keepchandim, dimtok = setdiff(dimtok, {'chan'}); end
% if ~keepfreqdim, dimtok = setdiff(dimtok, {'freq'}); end
% if ~keeptimedim, dimtok = setdiff(dimtok, {'time'}); end
if ~keeprptdim, dimtok = dimtok(~ismember(dimtok, {'rpt' 'rpttap' 'subj'})); end
if ~keepposdim, dimtok = dimtok(~ismember(dimtok, {'pos' '{pos}'})); end
if ~keepchandim, dimtok = dimtok(~ismember(dimtok, {'chan'})); end
if ~keepfreqdim, dimtok = dimtok(~ismember(dimtok, {'freq'})); end
if ~keeptimedim, dimtok = dimtok(~ismember(dimtok, {'time'})); end
dimord = sprintf('%s_', dimtok{:});
dimord = dimord(1:end-1); % remove the trailing _
for j=1:length(varargin)
varargin{j}.(orgdim1{i}) = dimord;
end
end
% restore the source.avg field, this keeps the output reasonably consistent with the
% old-style source representation of the input
if strcmp(dtype, 'source') && ~isempty(restoreavg)
for i=1:length(varargin)
varargin{i}.avg = keepfields(varargin{i}, restoreavg);
varargin{i} = removefields(varargin{i}, restoreavg);
end
end
varargout = varargin;
ft_postamble debug
ft_postamble previous varargin
ft_postamble provenance varargout
ft_postamble history varargout
ft_postamble savevar varargout
% the varargout variable can be cleared when written to outputfile
if exist('varargout', 'var') && ft_nargout>numel(varargout)
% also return the input cfg with the combined selection over all input data structures
varargout{end+1} = cfg;
end
end % function ft_selectdata
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SUBFUNCTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data = makeselection(data, datfield, dimtok, seldim, selindx, avgoverdim, selmode, average)
if numel(seldim) > 1
for k = 1:numel(seldim)
data = makeselection(data, datfield, dimtok, seldim(k), selindx, avgoverdim, selmode, average);
end
return;
end
if isnumeric(data.(datfield))
if isrow(data.(datfield)) && seldim==1
if length(dimtok)==1
seldim = 2; % switch row and column
end
elseif iscolumn(data.(datfield)) && seldim==2
if length(dimtok)==1
seldim = 1; % switch row and column
end
end
elseif iscell(data.(datfield))
if isrow(data.(datfield){1}) && seldim==2
if length(dimtok)==2
seldim = 3; % switch row and column
end
elseif iscolumn(data.(datfield){1}) && seldim==3
if length(dimtok)==2
seldim = 2; % switch row and column
end
end
end
% an empty selindx means that nothing(!) should be selected and hence everything should be removed, which is different than keeping everything
% the selindx value of NaN indicates that it is not needed to make a selection
switch selmode
case 'intersect'
if iscell(selindx)
% there are multiple selections in multipe vectors, the selection is in the matrices contained within the cell-array
for j=1:numel(selindx)
if ~isempty(selindx{j}) && all(isnan(selindx{j}))
% no selection needs to be made
else
data.(datfield){j} = cellmatselect(data.(datfield){j}, seldim-1, selindx{j}, numel(dimtok)==1);
end
end
else
% there is a single selection in a single vector
if ~isempty(selindx) && all(isnan(selindx))
% no selection needs to be made
else
data.(datfield) = cellmatselect(data.(datfield), seldim, selindx, numel(dimtok)==1);
end
end
if avgoverdim
data.(datfield) = cellmatmean(data.(datfield), seldim, average);
end
case 'union'
if ~isempty(selindx) && all(isnan(selindx))
% no selection needs to be made
elseif isequal(seldim,1) && any(strcmp({'time' 'freq'}, datfield))
% treat this as an exception, because these fields should only be
% unionized along the second dimension, so here also no selection
% needs to be made
else
tmp = data.(datfield);
siz = size(tmp);
siz(seldim) = numel(selindx);
data.(datfield) = nan(siz);
sel = isfinite(selindx);
switch seldim
case 1
data.(datfield)(sel,:,:,:,:,:) = tmp(selindx(sel),:,:,:,:,:);
case 2
data.(datfield)(:,sel,:,:,:,:) = tmp(:,selindx(sel),:,:,:,:);
case 3
data.(datfield)(:,:,sel,:,:,:) = tmp(:,:,selindx(sel),:,:,:);
case 4
data.(datfield)(:,:,:,sel,:,:) = tmp(:,:,:,selindx(sel),:,:);
case 5
data.(datfield)(:,:,:,:,sel,:) = tmp(:,:,:,:,selindx(sel),:);
case 6
data.(datfield)(:,:,:,:,:,sel) = tmp(:,:,:,:,:,selindx(sel));
otherwise
ft_error('unsupported dimension (%d) for making a selection for %s', seldim, datfield);
end
end
if avgoverdim
data.(datfield) = average(data.(datfield), seldim);
end
end % switch
end % function makeselection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data = makeselection_chan(data, selchan, avgoverchan)
if isempty(selchan)
%error('no channels were selected');
data.label = {};
elseif avgoverchan && all(isnan(selchan))
str = sprintf('%s, ', data.label{:});
str = str(1:end-2);
str = sprintf('mean(%s)', str);
data.label = {str};
elseif avgoverchan && ~any(isnan(selchan))
str = sprintf('%s, ', data.label{selchan});
str = str(1:end-2);
str = sprintf('mean(%s)', str);
data.label = {str}; % remove the last '+'
elseif all(isfinite(selchan))
data.label = data.label(selchan);
data.label = data.label(:);
elseif numel(selchan)==1 && any(~isfinite(selchan))
% do nothing
elseif numel(selchan)>1 && any(~isfinite(selchan))
tmp = cell(numel(selchan),1);
for k = 1:numel(tmp)
if isfinite(selchan(k))
tmp{k} = data.label{selchan(k)};
end
end
data.label = tmp;
else
% this should never happen
ft_error('cannot figure out how to select channels');
end
end % function makeselection_chan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data = makeselection_chancmb(data, selchancmb, avgoverchancmb)
if isempty(selchancmb)
ft_error('no channel combinations were selected');
elseif avgoverchancmb && all(isnan(selchancmb))
% naming the channel combinations becomes ambiguous, but should not
% suggest that the mean was computed prior to combining
str1 = sprintf('%s, ', data.labelcmb{:,1});
str1 = str1(1:end-2);
% str1 = sprintf('mean(%s)', str1);
str2 = sprintf('%s, ', data.labelcmb{:,2});
str2 = str2(1:end-2);
% str2 = sprintf('mean(%s)', str2);
data.label = {str1, str2};
elseif avgoverchancmb && ~any(isnan(selchancmb))
% naming the channel combinations becomes ambiguous, but should not
% suggest that the mean was computed prior to combining
str1 = sprintf('%s, ', data.labelcmb{selchancmb,1});
str1 = str1(1:end-2);
% str1 = sprintf('mean(%s)', str1);
str2 = sprintf('%s, ', data.labelcmb{selchancmb,2});
str2 = str2(1:end-2);
% str2 = sprintf('mean(%s)', str2);
data.label = {str1, str2};
elseif all(isfinite(selchancmb))
data.labelcmb = data.labelcmb(selchancmb,:);
elseif numel(selchancmb)==1 && any(~isfinite(selchancmb))
% do nothing
elseif numel(selchancmb)>1 && any(~isfinite(selchancmb))
tmp = cell(numel(selchancmb),2);
for k = 1:size(tmp,1)
if isfinite(selchan(k))
tmp{k,1} = data.labelcmb{selchan(k),1};
tmp{k,2} = data.labelcmb{selchan(k),2};
end
end
data.labelcmb = tmp;
else
% this should never happen
ft_error('cannot figure out how to select channelcombinations');
end
end % function makeselection_chancmb
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [chanindx, cfg] = getselection_chan(cfg, varargin)
selmode = varargin{end};
ndata = numel(varargin)-1;
varargin = varargin(1:ndata);
% loop over data once to initialize
chanindx = cell(ndata,1);
label = cell(1,0);
if ndata==1 && (isequal(cfg.channel, 'all') || isequal(cfg.channel, varargin{1}.label))
% the loop across data arguments, as well as the expensive calls to
% FT_CHANNELSELECTION can be avoided if there is only a single data
% argument and if 'all' channels are to be returned in the output
label = varargin{1}.label(:);
else
for k = 1:ndata
selchannel = cell(0,1);
selgrad = [];
selelec = [];
selopto = [];
if isfield(varargin{k}, 'grad') && isfield(varargin{k}.grad, 'type')
% this makes channel selection more robust, e.g. when using wildcards in cfg.channel
[selgrad, dum] = match_str(varargin{k}.label, varargin{k}.grad.label);
selchannel = cat(1, selchannel, ft_channelselection(cfg.channel, varargin{k}.label(selgrad), varargin{k}.grad.type));
end
if isfield(varargin{k}, 'elec') && isfield(varargin{k}.elec, 'type')
% this makes channel selection more robust, e.g. when using wildcards in cfg.channel
[selelec, dum] = match_str(varargin{k}.label, varargin{k}.elec.label);
selchannel = cat(1, selchannel, ft_channelselection(cfg.channel, varargin{k}.label(selelec), varargin{k}.elec.type));
end
if isfield(varargin{k}, 'opto') && isfield(varargin{k}.opto, 'type')
% this makes channel selection more robust, e.g. when using wildcards in cfg.channel
[selopto, dum] = match_str(varargin{k}.label, varargin{k}.opto.label);
selchannel = cat(1, selchannel, ft_channelselection(cfg.channel, varargin{k}.label(selopto), varargin{k}.opto.type));
end
selrest = setdiff((1:numel(varargin{k}.label))', [selgrad; selelec; selopto]);
selchannel = cat(1, selchannel, ft_channelselection(cfg.channel, varargin{k}.label(selrest)));
label = union(label, selchannel);
end
label = label(:); % ensure that this is a column array
% this call to match_str ensures that that labels are always in the
% order of the first input argument see bug_2917, but also temporarily keep
% the labels from the other data structures not present in the first one
% (in case selmode = 'union')
[ix, iy] = match_str(varargin{1}.label, label);
label1 = varargin{1}.label(:); % ensure column array
label = [label1(ix); label(setdiff(1:numel(label),iy))];
end % if ndata==1 and all channels are to be returned
indx = nan+zeros(numel(label), ndata);
for k = 1:ndata
[ix, iy] = match_str(label, varargin{k}.label);
indx(ix,k) = iy;
end
switch selmode
case 'intersect'
sel = sum(isfinite(indx),2)==ndata;
indx = indx(sel,:);
label = varargin{1}.label(indx(:,1));
case 'union'
% don't do a subselection
otherwise
ft_error('invalid value for cfg.select');
end % switch
ok = false(size(indx,1),1);
for k = 1:ndata
% loop through the columns to preserve the order of the channels, where
% the order of the input arguments determines the final order
ix = find(~ok);
[srt,srtix] = sort(indx(ix,k));
indx(ix,:) = indx(ix(srtix),:);
ok = ok | isfinite(indx(:,k));
end
for k = 1:ndata
% do a sanity check on double occurrences
if numel(unique(indx(isfinite(indx(:,k)),k)))<sum(isfinite(indx(:,k)))
ft_error('the selection of channels across input arguments leads to double occurrences');
end
chanindx{k} = indx(:,k);
end
for k = 1:ndata
if isequal(chanindx{k}, (1:numel(varargin{k}.label))')
% no actual selection is needed for this data structure
chanindx{k} = nan;
end
end
cfg.channel = label;
end % function getselection_chan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [chancmbindx, cfg] = getselection_chancmb(cfg, varargin)
selmode = varargin{end};
ndata = numel(varargin)-1;
varargin = varargin(1:ndata);
chancmbindx = cell(ndata,1);
if ~isfield(cfg, 'channelcmb')
for k=1:ndata
% the nan return value specifies that no selection was specified
chancmbindx{k} = nan;
end
else
switch selmode
case 'intersect'
haslabel = false(ndata,1);
for k=1:ndata
haslabel = isfield(varargin{k}, 'label');
end
if all(haslabel)
for k=1:ndata
cfg.channelcmb = ft_channelcombination(cfg.channelcmb, varargin{k}.label);
end
cfgcmb = cellfun(@sprintf,repmat({'%s_%s'},size(cfg.channelcmb,1),1),cfg.channelcmb(:,1),cfg.channelcmb(:,2),'UniformOutput',false);
elseif all(~haslabel)
% the data already has labelcmb, and thus needs a slightly different way to
% preset the cfg.channelcmb
chancmb = cellfun(@sprintf,repmat({'%s_%s'},size(varargin{1}.labelcmb,1),1),varargin{1}.labelcmb(:,1),varargin{1}.labelcmb(:,2),'UniformOutput',false);
for k=2:ndata
tmp = cellfun(@sprintf,repmat({'%s_%s'},size(varargin{k}.labelcmb,1),1),varargin{k}.labelcmb(:,1),varargin{k}.labelcmb(:,2),'UniformOutput',false);
chancmb = intersect(chancmb, tmp);
end
cfgcmb = unique(chancmb);
if isequal(cfg.channelcmb, {'all' 'all'})
% nothing needed here
else
cfg.channelcmb = cellfun(@sprintf,repmat({'%s_%s'},size(cfg.channelcmb,1),1),cfg.channelcmb(:,1),cfg.channelcmb(:,2),'UniformOutput',false);
cfgcmb = intersect(cfg.channelcmb, cfgcmb);
end
else
ft_error('a combination of data with and without label field is not possible');
end
for k=1:ndata
datcmb = cellfun(@sprintf,repmat({'%s_%s'},size(varargin{k}.labelcmb,1),1),varargin{k}.labelcmb(:,1),varargin{k}.labelcmb(:,2),'UniformOutput',false);
% return the order according to the (joint) configuration, not according to the (individual) data
% FIXME this should adhere to the general code guidelines, where
% the order returned will be according to the first data argument!
[dum, chancmbindx{k}] = match_str(cfgcmb, datcmb);
end
case 'union'
% FIXME this is not yet implemented
ft_error('union of channel combination is not yet supported');
otherwise
ft_error('invalid value for cfg.select');
end % switch
end
end % function getselection_chancmb
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [spikeindx, cfg] = getselection_spike(cfg, varargin)
% possible specifications are
% cfg.latency = string -> 'all'
% cfg.latency = [beg end]
% cfg.trials = string -> 'all'
% cfg.trials = vector with indices
ndata = numel(varargin);
varargin = varargin(1:ndata);
if isequal(cfg.latency, 'all') && isequal(cfg.trials, 'all')
spikeindx = cell(1,ndata);
for i=1:ndata
spikeindx{i} = num2cell(nan(1, length(varargin{i}.time)));
end
return
end
trialbeg = varargin{1}.trialtime(:,1);
trialend = varargin{1}.trialtime(:,2);
for i=2:ndata
trialbeg = cat(1, trialbeg, varargin{1}.trialtime(:,1));
trialend = cat(1, trialend, varargin{1}.trialtime(:,2));
end
% convert string into a numeric selection
if ischar(cfg.latency)
switch cfg.latency
case 'all'
cfg.latency = [-inf inf];
case 'maxperiod'
cfg.latency = [min(trialbeg) max(trialend)];
case 'minperiod'
cfg.latency = [max(trialbeg) min(trialend)];
case 'prestim'
cfg.latency = [min(trialbeg) 0];
case 'poststim'
cfg.latency = [0 max(trialend)];
otherwise
ft_error('incorrect specification of cfg.latency');
end % switch
end
spikeindx = cell(1,ndata);
for i=1:ndata
nchan = length(varargin{i}.time);
spikeindx{i} = cell(1,nchan);
for j=1:nchan
selbegtime = varargin{i}.time{j}>=cfg.latency(1);
selendtime = varargin{i}.time{j}<=cfg.latency(2);
if isequal(cfg.trials, 'all')
seltrial = true(size(varargin{i}.trial{j}));
else
seltrial = ismember(varargin{i}.trial{j}, cfg.trials);
end
spikeindx{i}{j} = find(selbegtime & selendtime & seltrial);
end
end
end % function getselection_spiketime
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [timeindx, cfg] = getselection_time(cfg, varargin)
% possible specifications are
% cfg.latency = value -> can be 'all'
% cfg.latency = [beg end]
if ft_datatype(varargin{1}, 'spike')
ft_error('latency selection in spike data is not supported')
end
selmode = varargin{end};
tol = varargin{end-1};
ndata = numel(varargin)-2;
varargin = varargin(1:ndata);
if isequal(cfg.latency, 'all') && iscell(varargin{1}.time)
% for raw data this means that all trials should be selected as they are
% for timelock/freq data it is still needed to make the intersection between data arguments
timeindx = cell(1,ndata);
for i=1:ndata
% the nan return value specifies that no selection was specified
timeindx{i} = num2cell(nan(1, length(varargin{i}.time)));
end
return
end
% if there is a single timelock/freq input, there is one time vector
% if there are multiple timelock/freq inputs, there are multiple time vectors
% if there is a single raw input, there are multiple time vectors
% if there are multiple raw inputs, there are multiple time vectors
% collect all time axes in one large cell-array
alltimecell = {};
if iscell(varargin{1}.time)
for k = 1:ndata
alltimecell = [alltimecell varargin{k}.time{:}];
end
else
for k = 1:ndata
alltimecell = [alltimecell {varargin{k}.time}];
end
end
% the nan return value specifies that no selection was specified
timeindx = repmat({nan}, size(alltimecell));
% loop over data once to determine the union of all time axes
alltimevec = zeros(1,0);
for k = 1:length(alltimecell)
alltimevec = union(alltimevec, round(alltimecell{k}/tol)*tol);
end
indx = nan(numel(alltimevec), numel(alltimecell));
for k = 1:numel(alltimecell)
[dum, ix, iy] = intersect(alltimevec, round(alltimecell{k}/tol)*tol);
indx(ix,k) = iy;
end
if iscell(varargin{1}.time) && ~isequal(cfg.latency, 'minperiod')
% if the input data arguments are of type 'raw', temporarily set the
% selmode to union, otherwise the potentially different length trials
% will be truncated to the shortest epoch, prior to latency selection.
selmode = 'union';
elseif ischar(cfg.latency) && strcmp(cfg.latency, 'minperiod')
% enforce intersect
selmode = 'intersect';
end
switch selmode
case 'intersect'
sel = sum(isfinite(indx),2)==numel(alltimecell);
indx = indx(sel,:);
alltimevec = alltimevec(sel);
case 'union'
% don't do a subselection
otherwise
ft_error('invalid value for cfg.select');
end
% Note that cfg.toilim handling has been removed, as it was renamed to cfg.latency
% convert a string selection into a numeric selection
if ischar(cfg.latency)
switch cfg.latency
case {'all' 'maxperlen' 'maxperiod'}
cfg.latency = [min(alltimevec) max(alltimevec)];
case 'prestim'
cfg.latency = [min(alltimevec) 0];
case 'poststim'
cfg.latency = [0 max(alltimevec)];
case 'minperiod'
% the time vector has been pruned above
cfg.latency = [min(alltimevec) max(alltimevec)];
otherwise
ft_error('incorrect specification of cfg.latency');
end % switch
end
% deal with numeric selection
if isempty(cfg.latency)
for k = 1:numel(alltimecell)
% FIXME I do not understand this
% this signifies that all time bins are deselected and should be removed
timeindx{k} = [];
end
elseif numel(cfg.latency)==1
% this single value should be within the time axis of each input data structure
if numel(alltimevec)>1
tbin = nearest(alltimevec, cfg.latency, true, true); % determine the numerical tolerance
else
tbin = nearest(alltimevec, cfg.latency, true, false); % don't consider tolerance
end
cfg.latency = alltimevec(tbin);
for k = 1:ndata
timeindx{k} = indx(tbin, k);
end
elseif numel(cfg.latency)==2
% the [min max] range can be specifed with +inf or -inf, but should
% at least partially overlap with the time axis of the input data
mintime = min(alltimevec);
maxtime = max(alltimevec);
if all(cfg.latency<mintime) || all(cfg.latency>maxtime)
ft_error('the selected time range falls outside the time axis in the data');
end
tbeg = nearest(alltimevec, cfg.latency(1), false, false);
tend = nearest(alltimevec, cfg.latency(2), false, false);
cfg.latency = alltimevec([tbeg tend]);
for k = 1:numel(alltimecell)
timeindx{k} = indx(tbeg:tend, k);
% if the input data arguments are of type 'raw', the non-finite values
% need to be removed from the individual cells to ensure correct
% behavior
if iscell(varargin{1}.time)
timeindx{k} = timeindx{k}(isfinite(timeindx{k}));
end
end
elseif size(cfg.latency,2)==2
% this may be used for specification of the computation, not for data selection
else
ft_error('incorrect specification of cfg.latency');
end
for k = 1:numel(alltimecell)
if ~iscell(varargin{1}.time)
if isequal(timeindx{k}(:)', 1:length(alltimecell{k}))
% no actual selection is needed for this data structure
timeindx{k} = nan;
end
else
% if the input data arguments are of type 'raw', they need to be
% handled differently, because the individual trials can be of
% different length
end
end
if iscell(varargin{1}.time)
% split all time axes again over the different input raw data structures
dum = cell(1,ndata);
for k = 1:ndata
sel = 1:length(varargin{k}.time);
dum{k} = timeindx(sel); % get the first selection
timeindx(sel) = []; % remove the first selection
end
timeindx = dum;
else
% no splitting is needed, each input data structure has one selection
end
end % function getselection_time
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [freqindx, cfg] = getselection_freq(cfg, varargin)
% possible specifications are
% cfg.frequency = value -> can be 'all'
% cfg.frequency = [beg end]
selmode = varargin{end};
tol = varargin{end-1};
ndata = numel(varargin)-2;
varargin = varargin(1:ndata);
% loop over data once to initialize
freqindx = cell(ndata,1);
freqaxis = zeros(1,0);
for k = 1:ndata
% the nan return value specifies that no selection was specified
freqindx{k} = nan;
% update the axis along which the frequencies are defined
freqaxis = union(freqaxis, round(varargin{k}.freq(:)/tol)*tol);
end
indx = nan+zeros(numel(freqaxis), ndata);
for k = 1:ndata
[dum, ix, iy] = intersect(freqaxis, round(varargin{k}.freq(:)/tol)*tol);
indx(ix,k) = iy;
end
switch selmode
case 'intersect'
sel = sum(isfinite(indx),2)==ndata;
indx = indx(sel,:);
freqaxis = varargin{1}.freq(indx(:,1));
case 'union'
% don't do a subselection
otherwise
ft_error('invalid value for cfg.select');
end
if isfield(cfg, 'frequency')
% deal with string selection
% some of these do not make sense, but are here for consistency with ft_multiplotER
if ischar(cfg.frequency)
if strcmp(cfg.frequency, 'all')
cfg.frequency = [min(freqaxis) max(freqaxis)];
elseif strcmp(cfg.frequency, 'maxmin')
cfg.frequency = [min(freqaxis) max(freqaxis)]; % the same as 'all'
elseif strcmp(cfg.frequency, 'minzero')
cfg.frequency = [min(freqaxis) 0];
elseif strcmp(cfg.frequency, 'maxabs')
cfg.frequency = [-max(abs(freqaxis)) max(abs(freqaxis))];
elseif strcmp(cfg.frequency, 'zeromax')
cfg.frequency = [0 max(freqaxis)];
elseif strcmp(cfg.frequency, 'zeromax')
cfg.frequency = [0 max(freqaxis)];
else
ft_error('incorrect specification of cfg.frequency');
end
end
% deal with numeric selection
if isempty(cfg.frequency)
for k = 1:ndata
% FIXME I do not understand this
% this signifies that all frequency bins are deselected and should be removed
freqindx{k} = [];
end
elseif numel(cfg.frequency)==1
% this single value should be within the frequency axis of each input data structure
if numel(freqaxis)>1
fbin = nearest(freqaxis, cfg.frequency, true, true); % determine the numerical tolerance
else
fbin = nearest(freqaxis, cfg.frequency, true, false); % don't consider tolerance
end
cfg.frequency = freqaxis(fbin);
for k = 1:ndata
freqindx{k} = indx(fbin,k);
end
elseif numel(cfg.frequency)==2
% the [min max] range can be specifed with +inf or -inf, but should
% at least partially overlap with the freq axis of the input data
minfreq = min(freqaxis);
maxfreq = max(freqaxis);
if all(cfg.frequency<minfreq) || all(cfg.frequency>maxfreq)
ft_error('the selected range falls outside the frequency axis in the data');
end
fbeg = nearest(freqaxis, cfg.frequency(1), false, false);
fend = nearest(freqaxis, cfg.frequency(2), false, false);
cfg.frequency = freqaxis([fbeg fend]);
for k = 1:ndata
freqindx{k} = indx(fbeg:fend,k);
end
elseif size(cfg.frequency,2)==2
% this may be used for specification of the computation, not for data selection
else
ft_error('incorrect specification of cfg.frequency');
end
end % if cfg.frequency
for k = 1:ndata
if isequal(freqindx{k}, 1:length(varargin{k}.freq))
% the cfg was updated, but no selection is needed for the data
freqindx{k} = nan;
end
end
end % function getselection_freq
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [rptindx, cfg, rptdim, rpttapindx] = getselection_rpt(cfg, varargin)
% this should deal with cfg.trials
dimord = varargin{end};
ndata = numel(varargin)-1;
data = varargin{1:ndata}; % this syntax ensures that it will only work on a single data input
dimtok = tokenize(dimord, '_');
rptdim = find(strcmp(dimtok, '{rpt}') | strcmp(dimtok, 'rpt') | strcmp(dimtok, 'rpttap') | strcmp(dimtok, 'subj'));
if isequal(cfg.trials, 'all')
rptindx = nan; % the nan return value specifies that no selection was specified
rpttapindx = nan; % the nan return value specifies that no selection was specified
elseif isempty(rptdim)
% FIXME should [] not mean that none of the trials is to be selected?
rptindx = nan; % the nan return value specifies that no selection was specified
rpttapindx = nan; % the nan return value specifies that no selection was specified
else
rptindx = ft_getopt(cfg, 'trials');
if islogical(rptindx)
% convert from booleans to indices
rptindx = find(rptindx);
end
rptindx = unique(sort(rptindx));
if strcmp(dimtok{rptdim}, 'rpttap') && isfield(data, 'cumtapcnt')
% there are tapers in the data
% determine for each taper to which trial it belongs
nrpt = size(data.cumtapcnt, 1);
taper = zeros(nrpt, 1);
sumtapcnt = cumsum([0; data.cumtapcnt(:)]);
begtapcnt = sumtapcnt(1:end-1)+1;
endtapcnt = sumtapcnt(2:end);
for i=1:nrpt
taper(begtapcnt(i):endtapcnt(i)) = i;
end
rpttapindx = find(ismember(taper, rptindx));
else
% there are no tapers in the data
rpttapindx = rptindx;
end
end
end % function getselection_rpt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [posindx, cfg] = getselection_pos(cfg, varargin)
% possible specifications are <none>
ndata = numel(varargin)-2;
tol = varargin{end-1}; % FIXME this is still ignored
selmode = varargin{end}; % FIXME this is still ignored
data = varargin(1:ndata);
for i=1:ndata
if ~isequal(varargin{i}.pos, varargin{1}.pos)
% FIXME it would be possible here to make a selection based on intersect or union
ft_error('not yet implemented');
end
end
if strcmp(cfg.select, 'union')
% FIXME it would be possible here to make a selection based on intersect or union
ft_error('not yet implemented');
end
for i=1:ndata
posindx{i} = nan; % the nan return value specifies that no selection was specified
end
end % function getselection_pos
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x = squeezedim(x, dim)
siz = size(x);
for i=(numel(siz)+1):numel(dim)
% all trailing singleton dimensions have length 1
siz(i) = 1;
end
if isvector(x) && ~(isrow(x) && dim(1) && numel(x)>1)
% there is no harm to keep it as it is, unless the data matrix is 1xNx1x1
elseif istable(x)
% there is no harm to keep it as it is
else
x = reshape(x, [siz(~dim) 1]);
end
end % function squeezedim
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x = makeunion(x, field)
old = cellfun(@getfield, x, repmat({field}, size(x)), 'uniformoutput', false);
if iscell(old{1})
% empty is indicated to represent missing value for a cell-array (label, labelcmb)
new = old{1};
for i=2:length(old)
sel = ~cellfun(@isempty, old{i});
new(sel) = old{i}(sel);
end
else
% nan is indicated to represent missing value for a numeric array (time, freq, pos)
new = old{1};
for i=2:length(old)
sel = ~isnan(old{i});
new(sel) = old{i}(sel);
end
end
x = cellfun(@setfield, x, repmat({field}, size(x)), repmat({new}, size(x)), 'uniformoutput', false);
end % function makeunion
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SUBFUNCTION to make a selextion in data representations like {pos}_ori_time
% FIXME this will fail for {xxx_yyy}_zzz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x = cellmatselect(x, seldim, selindx, maybevector)
if nargin<4
% some fields are a vector with an unspecified singleton dimension, these can be transposed
% if the singleton dimension represents something explicit, they should not be transposed
% they might for example represent a single trial, or a single channel
maybevector = true;
end
if iscell(x)
if seldim==1
x = x(selindx);
else
for i=1:numel(x)
if isempty(x{i})
continue
end
switch seldim
case 2
if maybevector && isvector(x{i})
% sometimes the data is 1xN, whereas the dimord describes only the first dimension
% in this case a row and column vector can be interpreted as equivalent
x{i} = x{i}(selindx);
elseif istable(x)
% multidimensional indexing is not supported
x{i} = x{i}(selindx,:);
else
x{i} = x{i}(selindx,:,:,:,:);
end
case 3
x{i} = x{i}(:,selindx,:,:,:);
case 4
x{i} = x{i}(:,:,selindx,:,:);
case 5
x{i} = x{i}(:,:,:,selindx,:);
case 6
x{i} = x{i}(:,:,:,:,selindx);
otherwise
ft_error('unsupported dimension (%d) for making a selection', seldim);
end % switch
end % for
end
else
switch seldim
case 1
if maybevector && isvector(x)
% sometimes the data is 1xN, whereas the dimord describes only the first dimension
% in this case a row and column vector can be interpreted as equivalent
x = x(selindx);
elseif istable(x)
% multidimensional indexing is not supported
x = x(selindx,:);
else
x = x(selindx,:,:,:,:,:);
end
case 2
x = x(:,selindx,:,:,:,:);
case 3
x = x(:,:,selindx,:,:,:);
case 4
x = x(:,:,:,selindx,:,:);
case 5
x = x(:,:,:,:,selindx,:);
case 6
x = x(:,:,:,:,:,selindx);
otherwise
ft_error('unsupported dimension (%d) for making a selection', seldim);
end
end
end % function cellmatselect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SUBFUNCTION to take an average in data representations like {pos}_ori_time
% FIXME this will fail for {xxx_yyy}_zzz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x = cellmatmean(x, seldim, average)
if iscell(x)
if seldim==1
for i=2:numel(x)
x{1} = x{1} + x{i};
end
x = {x{1}/numel(x)};
else
for i=1:numel(x)
x{i} = average(x{i}, seldim-1);
end % for
end
elseif istable(x)
try
% try to convert to an array, depending on the table content this might fail
x = average(table2array(x), seldim);
catch
% construct an appropriately sized array with NaN values
s = size(x);
s(seldim) = 1;
x = nan(s);
end
% convert back to table
x = array2table(x);
else
x = average(x, seldim);
end
end % function cellmatmean
|
!
! The Laboratory of Algorithms
!
! The MIT License
!
! Copyright 2011-2015 Andrey Pudov.
!
! Permission is hereby granted, free of charge, to any person obtaining a copy
! of this software and associated documentation files (the 'Software'), to deal
! in the Software without restriction, including without limitation the rights
! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
! copies of the Software, and to permit persons to whom the Software is
! furnished to do so, subject to the following conditions:
!
! The above copyright notice and this permission notice shall be included in
! all copies or substantial portions of the Software.
!
! THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
! THE SOFTWARE.
!
module MHeap
implicit none
public
type, abstract :: THeap
contains
procedure(IAdd), deferred :: add
procedure(IContains), deferred :: contains
procedure(IGet), deferred :: get
procedure(IEmpty), deferred :: empty
!procedure(IExtractMin), deferred :: extractMin
procedure(IHeapify), deferred :: heapify
procedure(IDecreaseKey), deferred :: decreaseKey
end type
type, abstract :: THeapNode
integer :: x
end type
abstract interface
subroutine IAdd(instance, value)
import THeap
class(THeap), intent(in out) :: instance
integer, intent(in) :: value
end subroutine
function IContains(instance, value) result(status)
import THeap
class(THeap), intent(in) :: instance
integer, intent(in) :: value
logical :: status
end function
function IGet(instance, index) result(value)
import THeap
class(THeap), intent(in) :: instance
integer, intent(in) :: index
integer :: value
end function
function IEmpty(instance) result(value)
import THeap
class(THeap), intent(in) :: instance
logical :: value
end function
!function IExtractMin(instance) result(value)
! import THeap
! import THeadNode
! class(THeap), intent(in) :: instance
! class(THeadNode), pointer, intent(out) :: value
!end function
subroutine IHeapify(instance, index)
import THeap
class(THeap), intent(in out) :: instance
integer, intent(in) :: index
end subroutine
subroutine IDecreaseKey(instance, vertex, distance)
import THeap
class(THeap), intent(in out) :: instance
integer, intent(in) :: vertex
integer, intent(in) :: distance
end subroutine
end interface
end module
|
Operation Safe Canyons - Homeowners Issue?
Last week I published a note about the California Highway Patrol cracking down on speeding motorcycles under an initiative called, "Operation Safe Canyons".
So I ended up talking to a CHP officer tonight.. (no, he didn't pull me over).
He told me that operation safe canyon is spreading to other regions other than Malibu Canyon and the surrounding areas.
I thought I'd share what I heard.
The Las Virgenes Homeowners Federation had taken a special interest in the issue just prior to the April implementation of the operation. In an April update, the federation addressed the canyon operation and expressed its strong support. An aggressive stance against canyon carvers is alluded to in language that is evocative of a general's battle plan: "We had a very productive meeting where we discussed various "plans of attack" in place for both Calabasas and LA County.
The CHP contend that Operation Safe Canyons is about safety, pointing out that approximately 8 people per year are killed on the canyon roads.
Of course, 8 road deaths per year is not that much. And considering the CHP is using vehicle-confiscation as a tool to regain control, instead of just issuing warnings and tickets, it appears safety is not really their concern, caving into the fat-cats who're paying off the local politicians. |
program example5
implicit none
integer i, imax
parameter (imax = 3)
real a(0:imax)
do i = 0, imax
a(i) = a(i) + a(i+2)
end do
end
|
\section{Optimization of Surrogates on Sparse Grids}
\label{sec:52method}
\minitoc{72mm}{5}
\noindent
The methods presented in the last section can be combined to a
``meta-method'' for surrogate optimization.
The surrogates are constructed as interpolants on spatially adaptive
sparse grids, which we explain in the following.
\subsection{Novak--Ritter Adaptivity Criterion}
\label{sec:521novakRitter}
The classic surplus-based refinement strategy for
spatially adaptive sparse grids is not tailored to optimization,
as this refinement strategy aims to minimize the overall $\Ltwo$ error.
However, in optimization, it is reasonable to generate more
points in regions where we suspect the global minimum to be
to increase the interpolant's accuracy in these regions.
Hence, we employ an adaptivity criterion proposed by
Novak and Ritter \cite{Novak96Global} for hyperbolic cross points.
The Novak--Ritter criterion has also been applied to sparse grids
\multicite{Ferenczi05Globale,Valentin14Hierarchische,Valentin16Hierarchical}.
\paragraph{$m$-th order children}
As usual, the criterion works iteratively:
Starting with an initial regular sparse grid of a very coarse level,
the criterion selects a specific point $\gp{\*l,\*i}$ in each iteration
and inserts all its children into the grid.
This process is repeated until a given number $\ngpMax$ of grid points is
reached,
since we evaluate $\objfun$ at every grid point once, and we assume that
function evaluations dominate the overall complexity.
The difference to common refinement criteria is that
a point may be selected multiple times, in which case
\term{higher-order children} are inserted.
The $m$-th order children $\gp{\*l',\*i'}$ of a grid point $\gp{\*l,\*i}$
satisfy
\begin{equation}
\label{eq:indirectChild}
\*l'_{-t} = \*l^{}_{-t},\;\,
\*i'_{-t} = \*i^{}_{-t},\;\,
l'_t = l^{}_t + m,\;\,
i'_t \in
\begin{cases}
\{1\},&(l_t = 0) \land (i_t = 0),\\
\{2^m - 1\},&(l_t = 0) \land (i_t = 1),\\
\{2^m i_t - 1,\, 2^m i_t + 1\},&\hphantom{(}l_t > 0,
\end{cases}
\end{equation}
where $m \in \nat$ and $t \in \{1, \dotsc, d\}$
(cf.\ \cref{eq:directAncestor} for $m = 1$).
The order is chosen individually for each child point to be inserted
as the lowest number $m$ such that $\gp{\*l',\*i'}$ does not yet exist
in the grid.
%\todo{add figure for m-th order children?}
\paragraph{Criterion}
The Novak--Ritter refinement criterion \cite{Novak96Global}
refines the grid point $\gp{\*l,\*i}$ that minimizes the product%
\footnote{%
Compared to \cite{Novak96Global},
we added one in the base of each factor to avoid ambiguities
for $0^0$.
In addition, we swapped $\gamma$ with $1-\gamma$
to make $\gamma$ more consistent with its name as adaptivity.%
}
\begin{equation}
(r_{\*l,\*i} + 1)^\gamma \cdot
(\normone{\*l} + d_{\*l,\*i} + 1)^{1 - \gamma}.
\end{equation}
Here, $r_{\*l,\*i} \ceq \setsize{
\{(\*l',\*i') \in \liset \mid
\objfun(\gp{\*l',\*i'}) \le \objfun(\gp{\*l,\*i})\}
} \in \{1, \dotsc, \setsize{\liset}\}$ is the \term{rank} of $\gp{\*l,\*i}$
(where $\liset$ is the current set of level-index pairs of the grid), i.e.,
the place of the function value at $\gp{\*l,\*i}$
in the ascending order of the function values at all points
of the current grid.
We denote the \term{degree} $d_{\*l,\*i} \in \natz$ of $\gp{\*l,\*i}$
as the number of previous refinements of this point.
Finally, $\gamma \in \clint{0, 1}$ is the \term{adaptivity parameter.}
%By choosing $\gamma = 0$, the function values become irrelevant and the
%criterion produces regular-like sparse grids.
%If we choose $\gamma = 1$, then the criterion always refines the point with
%the lowest function value, which means that the criterion is easily stuck
%in local minima.
We have to choose a suitable compromise between exploration ($\gamma = 0$)
and exploitation ($\gamma = 1$).
The best choice of course depends on the objective function $\objfun$ at hand,
but for our purposes, we choose a priori a value of $\gamma = 0.15$.
However, it may be an option to adapt the value of $\gamma$ automatically
during the grid generation phase.
\subsection{Global Optimization of Sparse Grid Surrogates}
\label{sec:522method}
\paragraph{Global, local, and globalized optimization methods}
In \cref{sec:51algorithms}, we presented various optimization methods
for the unconstrained case,
divided into global gradient-free methods such as differential evolution and
local gradient-based methods, for example, gradient descent.
A subset of these methods has been implemented in \sgpp{}
\cite{Pflueger10Spatially}, see \cref{tbl:optimizationMethod}.
The gradient-based methods need an initial point, and
they may get stuck in local minima.
Hence, we additionally implemented globalized versions
of the gradient-based methods
via a multi-start Monte Carlo approach with $m \ceq \min(10d, 100)$
uniformly distributed pseudo-random initial points.%
\footnote{%
We split the number of permitted function evaluations evenly
among the $m$ parallel calls.%
%of the gradient-based method%
}
This means there are three types of methods:
\begin{enumerate}[label=T\arabic*.,ref=T\arabic*,leftmargin=2.7em]
\item
\label{item:globalMethods}
Global gradient-free methods listed as implemented in
\cref{tbl:optimizationMethod}
\item
\label{item:localMethods}
Local gradient-based methods listed as implemented in
\cref{tbl:optimizationMethod}%
%(need an initial point)%
\footnote{%
Excluding Levenberg--Marquardt, which is only applicable
to least-squares problems.%
}
\item
\label{item:globalizedMethods}
Globalized versions of the methods of type \ref{item:localMethods}
%(do not need an initial point)
\end{enumerate}
\paragraph{Unconstrained optimization of sparse grid surrogates}
Given the objective function $\objfun\colon \clint{\*0, \*1} \to \real$,
the maximal number $\ngpMax \in \nat$ of evaluations of $f$, and
the adaptivity parameter $\gamma \in \clint{0, 1}$,
we determine an approximation $\xoptappr \in \clint{\*0, \*1}$
of the global minimum $\xopt$ of $\objfun$ as follows:
\begin{enumerate}
\item
Generate a spatially adaptive sparse grid $\sgset$
with the Novak--Ritter refinement criterion
for $\objfun$, $\ngpMax$, and $\gamma$.
\item
Determine the sparse grid interpolant $\sgintp$ of $\objfun$
by solving the linear system \eqref{eq:hierarchizationProblem}.
\item
Optimize the interpolant:
First, find the best grid point
$\*x^{(0)} \ceq \vecargmin_{\gp{\*l,\*i} \in \sgset} \objfun(\*x_{\*l,\*i})$.
Second, apply the local methods of type \ref{item:localMethods}
to the interpolant $\sgintp$ with $\*x^{(0)}$ as initial point.
Let $\*x^{(1)}$ be the resulting point with minimal objective function value.
Third, we apply the global and globalized methods
of types \ref{item:globalMethods} and \ref{item:globalizedMethods}
to the interpolant $\sgintp$.
Again, let $\*x^{(2)}$ be the point with
minimal $\objfun$ value.
Finally, determine the point of $\{\*x^{(0)}, \*x^{(1)}, \*x^{(2)}\}$
with minimal $\objfun$ value and return it as $\xoptappr$.
\end{enumerate}
\noindent
Note that the third step requires a fixed number of additional
evaluations of the objective function,
which can be neglected compared to $\ngpMax$.
By default, we use the cubic modified hierarchical not-a-knot B-spline basis
$\bspl[\nak,\modified]{\*l,\*i}{p}$ ($p = 3$)
for the construction of the sparse grid surrogate.
However, we could apply any of the hierarchical (B-)spline bases presented in
\cref{chap:30BSplines,chap:40algorithms}.
\paragraph{Comparison methods}
We use two comparison methods.
First, we apply the gradient-free methods
(type \ref{item:globalMethods}) to the sparse grid interpolant
using modified piecewise linear hierarchical basis functions
(i.e., $p = 1$) on the same sparse grid as the cubic B-splines.
We cannot employ gradient-based optimization as the objective function
should be continuously differentiable and
discontinuous derivatives are usually numerically problematic
for gradient-based optimization methods
(see, e.g., \cite{Huebner14Mehrdimensionale}).
Second, we apply the gradient-free methods
(type \ref{item:globalMethods}) directly to the objective function.
We cannot use the gradient-based methods here as the gradient of the
objective function is assumed to be unknown.
For both of the comparison methods,
we make sure that the objective function is evaluated at most $\ngpMax$ times
by splitting the $\ngpMax$ evaluations
evenly among all employed optimization methods.
\paragraph{Constrained optimization}
For optimization problems with constraints,
we proceed exactly as for unconstrained optimization,
except that for optimizing the interpolant, we use the
constrained optimization algorithms implemented in \sgpp
as listed in \cref{tbl:optimizationMethod}.
We only replace the objective function $\objfun$ with a sparse grid
surrogate $\sgintp$, and we assume that the constraint function
$\ineqconfun$ can be evaluated fast.
However, it would also be possible to replace $\ineqconfun$
with a sparse grid surrogate.
In this case, it cannot be guaranteed that the resulting optimal point
$\xoptappr$ is feasible, i.e., we could have
$\lnot(\ineqconfun(\xoptappr) \le \*0)$.
|
lemma divide_i [simp]: "x / \<i> = - \<i> * x" |
# Course information button module ----
course_information_button_UI <- function(id, r) {
df <- r$df_course_info
showModal(
modalDialog(title = "Edit Course Information & Links", size = "l", easyClose = T
, fluidRow(
column(width = 6
, rHandsontableOutput(NS(id, "course_info"))
)
, column(width = 6
, rHandsontableOutput(NS(id, "links"))
)
)
, footer = fluidRow(
column(width = 12
, actionBttn(inputId = NS(id,"save")
, label = "Save Information"
, style = "material-flat"
, block = T
)
)
)
)
)
}
course_information_button_Server <- function(id, r){
moduleServer(id, function(input,output,session){
output$course_info <- renderRHandsontable({
rhandsontable(
r$df_course_info
, rowHeaders = NULL
, stretchH = 'all'
)
})
output$links <- renderRHandsontable({
rhandsontable(
r$df_links
, rowHeaders = NULL
, stretchH = 'all'
)
})
observeEvent(input$save, {
req(input$course_info, input$links)
r$df_course_info <- hot_to_r(input$course_info)
r$df_links <- hot_to_r(input$links)
write_rds(r$df_course_info, "data/df_course_info.RDS")
write_rds(r$df_links, "data/df_links.RDS")
showNotification("Saved in session.")
removeModal()
})
})
} |
[STATEMENT]
lemma neqif [simp]: "x \<noteq> y \<Longrightarrow> (if y = x then a else b) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. x \<noteq> y \<Longrightarrow> (if y = x then a else b) = b
[PROOF STEP]
apply (case_tac "y \<noteq> x")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>x \<noteq> y; y \<noteq> x\<rbrakk> \<Longrightarrow> (if y = x then a else b) = b
2. \<lbrakk>x \<noteq> y; \<not> y \<noteq> x\<rbrakk> \<Longrightarrow> (if y = x then a else b) = b
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done |
If $A_1 \subseteq A_2 \subseteq \cdots$ is an increasing sequence of sets, then $\mu(\bigcup_{i=1}^\infty A_i) = \lim_{n \to \infty} \mu(A_n)$. |
MODULE physical_type_methods
use parallel_module
use rgrid_variables, only: dV
use rsdft_mpi_module
implicit none
PRIVATE
PUBLIC :: dSpatialIntegral
CONTAINS
SUBROUTINE dSpatialIntegral( d )
implicit none
real(8) :: d(:)
call rsdft_allreduce_sum( d, comm_grid )
d=d*dV
END SUBROUTINE dSpatialIntegral
END MODULE physical_type_methods
|
//
// Copyright (c) 2018 Stefan Seefeld
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef boost_numeric_ublas_opencl_hpp_
#define boost_numeric_ublas_opencl_hpp_
#include <boost/numeric/ublas/opencl/library.hpp>
#include <boost/numeric/ublas/opencl/vector.hpp>
#include <boost/numeric/ublas/opencl/matrix.hpp>
#include <boost/numeric/ublas/opencl/operations.hpp>
#endif
|
# Further information
(difference_between_a_list_and_a_tuple)=
## What is the difference between a Python list and a Python tuple?
Two of the most used Python iterables are lists and tuples. In practice they
have a number of similarities, they are both ordered collections of objects that
can be used in list comprehensions as well as in other ways.
- Tuples are **immutable**
- Lists are **mutable**
This means that once created tuples cannot be changed and lists can.
As a general rule of thumb: if you do not need to modify your iterable then use
a tuple as they are more computationally efficient.
This blog post is a good explanation of the difference:
<https://www.afternerd.com/blog/difference-between-list-tuple/>
## Why does the sum of booleans counts the `True`s?
In the tutorial and elsewhere we created a list of booleans and then take the
sum. Here are some of the steps:
```python
samples = ("Red", "Red", "Blue")
```
```python
booleans = [sample == "Red" for sample in samples]
booleans
```
[True, True, False]
When we take the `sum` of that list we get a numeric value:
```python
sum(booleans)
```
2
This has in fact counted the `True` values as 1 and the `False` values as 0.
```python
int(True)
```
1
```python
int(False)
```
0
## What is the difference between `print` and `return`?
In functions you see we use the `return` statement. This does two things:
1. Assigns a value to the function run;
2. Ends the function.
The `print` statement **only** displays the output.
As an example let us create the following set:
$$
S = \{f(x)\text{ for }x \in \{0, \pi / 4, \pi / 2, 3\pi / 4\}\}
$$
where $f(x)= \cos^2(x)$.
The correct way to do this is:
```python
import sympy as sym
def f(x):
"""
Return the square of the cosine of x
"""
return sym.cos(x) ** 2
S = [f(x) for x in (0, sym.pi / 4, sym.pi / 2, 3 * sym.pi / 4)]
S
```
[1, 1/2, 0, 1/2]
If we replaced the `return` statement in the function definition with a `print` we obtain:
```python
def f(x):
"""
Return the square of the cosine of x
"""
print(sym.cos(x) ** 2)
S = [f(x) for x in (0, sym.pi / 4, sym.pi / 2, 3 * sym.pi / 4)]
```
1
1/2
0
1/2
We see now that as the function has been run it displays the output.
**However** if we look at what `S` is we see that the function has not returned
anything:
```python
S
```
[None, None, None, None]
Here are some other materials on this subject:
- <https://www.tutorialspoint.com/Why-would-you-use-the-return-statement-in-Python>
- <https://pythonprinciples.com/blog/print-vs-return/>
## How does Python sample randomness?
When using the Python random module we are in fact generating a pseudo random
process. True randomness is actually not common.
Pseudo randomness is an important area of mathematics as strong algorithms that
create unpredictable sequences of numbers are vital to cryptographic security.
The specific algorithm using in Python for randomness is called the Mersenne
twister algorithm is state of the art.
You can read more about this here:
<https://docs.python.org/3/library/random.html#module-random>.
## What is the difference between a docstring and a comment
In Python it is possible to write statements that are ignored using the `#`
symbol. This creates something called a "comment". For example:
```python
# create a list to represent the tokens in a bag
bag = ["Red", "Red", "Blue"]
```
A docstring however is something that is "attached" to a function and can be
accessed by Python.
If we rewrite the function to sample the experiment of the tutorial without a
docstring but using comments we will have:
```python
def sample_experiment(bag):
# Select a token
selected_token = pick_a_token(container=bag)
# If the token is red then the probability of selecting heads is 2/3
if selected_token == "Red":
probability_of_selecting_heads = 2 / 3
# Otherwise it is 1 / 2
else:
probability_of_selecting_heads = 1 / 2
# Select a coin according to the probability.
if random.random() < probability_of_selecting_heads:
coin = "Heads"
else:
coin = "Tails"
# Return both the selected token and the coin.
return selected_token, coin
```
Now if we try to access the help for the function we will not get it:
```python
help(sample_experiment)
```
Help on function sample_experiment in module __main__:
sample_experiment(bag)
Furthermore, if you look at the code with comments you will see that because of
the choice of variable names the comments are in fact redundant.
In software engineering it is generally accepted that comments indicate that
your code is not clear and so it is preferable to write clear documentation
explaining why something is done through docstrings.
```python
def sample_experiment(bag):
"""
This samples a token from a given bag and then
selects a coin with a given probability.
If the sampled token is red then the probability
of selecting heads is 2/3 otherwise it is 1/2.
This function returns both the selected token
and the coin face.
"""
selected_token = pick_a_token(container=bag)
if selected_token == "Red":
probability_of_selecting_heads = 2 / 3
else:
probability_of_selecting_heads = 1 / 2
if random.random() < probability_of_selecting_heads:
coin = "Heads"
else:
coin = "Tails"
return selected_token, coin
```
Here are some resources on this:
- <https://blog.codinghorror.com/coding-without-comments/>
- <https://visualstudiomagazine.com/articles/2013/07/26/why-commenting-code-is-still-bad.aspx>
|
[STATEMENT]
lemma \<AA>\<^sub>1_nodes_finite:
"finite (DCA.nodes (\<AA>\<^sub>1 \<phi> xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite (DCA.nodes (\<AA>\<^sub>1 \<phi> xs))
[PROOF STEP]
unfolding \<AA>\<^sub>1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finite (DCA.nodes (\<CC> \<phi> (set xs)))
[PROOF STEP]
by (metis (no_types, lifting) finite_subset \<CC>_nodes finite_SigmaI nested_prop_atoms\<^sub>\<nu>_finite nested_prop_atoms_finite) |
(*
Copyright 2016 Luxembourg University
Copyright 2017 Luxembourg University
This file is part of Velisarios.
Velisarios is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Velisarios is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Velisarios. If not, see <http://www.gnu.org/licenses/>.
Authors: Vincent Rahli
Ivana Vukotic
*)
Require Export PBFTprops3.
Section PBFTprops4.
Local Open Scope eo.
Local Open Scope proc.
Context { pbft_context : PBFTcontext }.
Context { pbft_auth : PBFTauth }.
Context { pbft_keys : PBFTinitial_keys }.
Context { pbft_hash : PBFThash }.
Lemma find_pre_prepare_certificate_in_prepared_infos_some_implies :
forall F n P nfo,
find_pre_prepare_certificate_in_prepared_infos F n P = Some nfo
-> In nfo P
/\ n = prepared_info2seq nfo
/\ F nfo = true.
Proof.
induction P; introv find; simpl in *; ginv.
smash_pbft; apply IHP in find; tcsp.
Qed.
Lemma info_is_prepared_implies_prepared_info_has_correct_digest :
forall p, info_is_prepared p = true -> prepared_info_has_correct_digest p = true.
Proof.
introv h.
unfold info_is_prepared in h; smash_pbft.
Qed.
Hint Resolve info_is_prepared_implies_prepared_info_has_correct_digest : pbft.
Lemma valid_prepared_info_implies_prepared_info_has_correct_digest :
forall L p, valid_prepared_info L p = true -> prepared_info_has_correct_digest p = true.
Proof.
introv h.
unfold valid_prepared_info in h; smash_pbft.
Qed.
Hint Resolve valid_prepared_info_implies_prepared_info_has_correct_digest : pbft.
Lemma create_new_prepare_message_true_implies_correct :
forall (sn : SeqNum) v keys P pp d (n : SeqNum),
n < sn
-> create_new_prepare_message sn v keys P = (true,(pp,d))
-> correct_new_view_opre_prepare v n P pp = true.
Proof.
introv ltsn create.
unfold create_new_prepare_message in create; smash_pbft.
unfold correct_new_view_opre_prepare; simpl; smash_pbft;
allrw SeqNumLt_true; allrw SeqNumLt_false; simpl in *; try omega; GC.
unfold oexists_last_prepared; simpl.
match goal with
| [ |- ?x = _ ] => remember x as b; symmetry in Heqb; destruct b; auto;[]
end.
assert False; tcsp.
rewrite existsb_false in Heqb.
pose proof (Heqb x) as q; clear Heqb.
match goal with
| [ H : find_pre_prepare_certificate_in_prepared_infos _ _ _ = _ |- _ ] =>
apply find_pre_prepare_certificate_in_prepared_infos_some_implies in H
end.
repnd.
autodimp q hyp.
smash_pbft.
match goal with
| [ H : _ <> _ |- _ ] => destruct H
end.
match goal with
| [ H : valid_prepared_info _ _ = _ |- _ ] =>
apply valid_prepared_info_implies_prepared_info_has_correct_digest in H
end.
unfold prepared_info_has_correct_digest in *; smash_pbft.
Qed.
Lemma create_new_prepare_messages_implies_correct_OPs :
forall n sns v keys P OP NP,
(forall (x : SeqNum) ppd,
In x sns
-> create_new_prepare_message x v keys P = (true, ppd)
-> n < x)
-> create_new_prepare_messages sns v keys P = (OP, NP)
-> forallb
(correct_new_view_opre_prepare v n P)
(map fst OP) = true.
Proof.
induction sns; introv imp create; simpl in *; smash_pbft; dands; tcsp;
try (complete (eapply IHsns; eauto)).
repnd; simpl in *.
pose proof (imp a (x2,x1)) as q.
repeat (autodimp q hyp).
eapply create_new_prepare_message_true_implies_correct;[|eauto]; tcsp.
Qed.
Lemma view_change2view_refresh_view_change :
forall e st,
view_change2view (refresh_view_change e st) = view_change2view e.
Proof.
tcsp.
Qed.
Hint Rewrite view_change2view_refresh_view_change : pbft.
Lemma correct_view_change_implies_same_views :
forall v vc,
correct_view_change v vc = true
-> v = view_change2view vc.
Proof.
introv cor; unfold correct_view_change in cor; smash_pbft.
unfold same_views in *; smash_pbft.
Qed.
Lemma ViewLe_true :
forall v1 v2, ViewLe v1 v2 = true <-> v1 <= v2.
Proof.
introv; unfold ViewLe.
rewrite Nat.leb_le; tcsp.
Qed.
Lemma ViewLe_false :
forall v1 v2, ViewLe v1 v2 = false <-> v1 > v2.
Proof.
introv; unfold ViewLe.
rewrite leb_iff_conv. tcsp.
Qed.
Lemma le_max_view_left :
forall (a b : View), a <= max_view a b.
Proof.
introv; destruct a, b; unfold max_view; smash_pbft.
Qed.
Hint Resolve le_max_view_left : pbft.
Lemma le_max_view_right :
forall (a b : View), a <= max_view b a.
Proof.
introv; destruct a, b; unfold max_view; smash_pbft.
allrw ViewLe_false; simpl in *; omega.
Qed.
Hint Resolve le_max_view_right : pbft.
Lemma le_max_seq_num :
forall (a b : SeqNum), a <= max_seq_num a b.
Proof.
introv; destruct a, b; unfold max_seq_num; simpl; smash_pbft;
allrw SeqNumLe_true; auto; try omega.
Qed.
Hint Resolve le_max_seq_num : pbft.
Lemma le_max_seq_num_right :
forall (a b : SeqNum), b <= max_seq_num a b.
Proof.
introv; destruct a, b; unfold max_seq_num; simpl; smash_pbft;
allrw SeqNumLe_true; auto; try omega.
Qed.
Hint Resolve le_max_seq_num_right : pbft.
Lemma le_max_seq_num_op :
forall (a : SeqNum) b, a <= max_seq_num_op a b.
Proof.
introv; destruct b; simpl; eauto 3 with pbft.
Qed.
Hint Resolve le_max_seq_num_op : pbft.
Lemma PreparedInfos2max_seq_none_implies :
forall F l,
PreparedInfos2max_seq F l = None
-> forall p, In p l -> F p = false.
Proof.
induction l; introv prep i; simpl in *; smash_pbft.
repndors; subst; tcsp.
Qed.
Lemma PreparedInfos2max_seq_is_max :
forall pi F l n,
In pi l
-> F pi = true
-> PreparedInfos2max_seq F l = Some n
-> prepared_info2seq pi <= n.
Proof.
induction l; introv i Fpi prep; simpl in *; tcsp; repndors; subst; smash_pbft;[].
remember (PreparedInfos2max_seq F l) as m; symmetry in Heqm; destruct m; simpl in *; smash_pbft.
eapply PreparedInfos2max_seq_none_implies in Heqm;[|eauto]; pbft_simplifier.
Qed.
Hint Resolve PreparedInfos2max_seq_is_max : pbft.
Lemma implies_in_from_min_to_max :
forall (n x m : SeqNum),
n < x
-> x <= m
-> In x (from_min_to_max n m).
Proof.
introv h q.
unfold from_min_to_max; smash_pbft; simpl in *; try omega;[].
apply in_map_iff.
exists x; simpl; dands; autorewrite with pbft; auto.
apply in_seq; simpl; dands; try omega.
Qed.
Hint Resolve implies_in_from_min_to_max : pbft.
Lemma in_from_min_to_max_trans :
forall (x n m k : SeqNum),
k <= m
-> In x (from_min_to_max n k)
-> In x (from_min_to_max n m).
Proof.
introv lek i.
unfold from_min_to_max in *; smash_pbft.
- apply in_map_iff in i; exrepnd; subst; simpl in *.
allrw in_seq; repnd; try omega.
- allrw in_map_iff; exrepnd; subst; simpl in *.
allrw in_seq; repnd; try omega.
exists x0; simpl; dands; auto.
apply in_seq; dands; simpl; try omega.
Qed.
Hint Resolve in_from_min_to_max_trans : pbft.
Lemma view_change_cert2max_seq_preps_vc_none_implies :
forall F l,
view_change_cert2max_seq_preps_vc F l = None
-> forall p, In p (view_change_cert2prep l) -> F p = false.
Proof.
induction l; introv prep i; simpl in *; smash_pbft.
allrw in_app_iff; repndors; tcsp.
unfold view_change2max_seq_preps in *.
eapply PreparedInfos2max_seq_none_implies; eauto.
Qed.
Lemma implies_prepared_info2max_seq_in_from_min_to_max :
forall l pi (n m : SeqNum) vc F,
In pi (view_change_cert2prep l)
-> F pi = true
-> n < prepared_info2seq pi
-> view_change_cert2max_seq_preps_vc F l = Some (m, vc)
-> In (prepared_info2seq pi) (from_min_to_max n m).
Proof.
induction l; introv i Ft ltn eqv; simpl in *; tcsp;
smash_pbft; simpl in *; try omega.
- allrw in_app_iff; repndors; tcsp.
+ unfold view_change2max_seq_preps in *.
dup i as les.
eapply PreparedInfos2max_seq_is_max in les;[| |eauto];auto;[].
eapply implies_in_from_min_to_max; simpl in *; try omega.
+ eapply IHl; eauto.
- allrw in_app_iff; repndors; tcsp.
+ unfold view_change2max_seq_preps in *.
dup i as les.
eapply PreparedInfos2max_seq_is_max in les;[| |eauto];auto;[].
eapply implies_in_from_min_to_max; simpl in *; try omega.
+ dup i as j.
eapply IHl in j;[| |eauto|eauto];auto; eauto 3 with pbft.
- allrw in_app_iff; repndors; tcsp.
+ unfold view_change2max_seq_preps in *.
dup i as les.
eapply PreparedInfos2max_seq_is_max in les;[| |eauto];auto;[].
eapply implies_in_from_min_to_max; simpl in *; try omega.
+ eapply view_change_cert2max_seq_preps_vc_none_implies in i;[|eauto]; pbft_simplifier.
- allrw in_app_iff; repndors; tcsp.
+ unfold view_change2max_seq_preps in *.
dup i as les.
eapply PreparedInfos2max_seq_none_implies in i;[|eauto]; pbft_simplifier.
+ eapply IHl; eauto.
Qed.
Hint Resolve implies_prepared_info2max_seq_in_from_min_to_max : pbft.
Lemma from_min_to_max_of_view_changes_nil_implies_all_sequence_numbers_are_accounted_for_op_true :
forall entry OP,
is_some (vce_view_change entry) = true
-> from_min_to_max_of_view_changes entry = []
-> all_sequence_numbers_are_accounted_for_op
(view_change_cert2prep (view_change_entry2view_changes entry))
(view_change_cert2max_seq (view_change_entry2view_changes entry))
OP = true.
Proof.
introv issome h.
unfold from_min_to_max_of_view_changes in h.
destruct entry, vce_view_change; simpl in *; tcsp; GC.
unfold all_sequence_numbers_are_accounted_for_op.
unfold all_sequence_numbers_are_accounted_for.
remember (view_change_cert2max_seq (v :: vce_view_changes)) as maxVop.
symmetry in HeqmaxVop.
destruct maxVop; simpl in *;
[|unfold view_change_cert2max_seq in *; simpl in *; smash_pbft];[].
unfold from_min_to_max_op in h.
rewrite forallb_forall.
introv i.
unfold sequence_number_is_accounted_for; smash_pbft;[].
unfold from_min_to_max_of_view_changes_cert in *.
rewrite HeqmaxVop in *; simpl in *.
(* WARNING *)
clear HeqmaxVop.
assert (view_change2prep v ++ view_change_cert2prep vce_view_changes
= view_change_cert2prep (v :: vce_view_changes)) as xx by tcsp.
rewrite xx in *; clear xx.
(* WARNING *)
remember (v :: vce_view_changes) as l; clear Heql.
remember (valid_prepared_info (view_change_cert2prep l)) as F; clear HeqF.
smash_pbft;[|].
- unfold view_change_cert2max_seq_preps in *; smash_pbft;[].
eapply implies_prepared_info2max_seq_in_from_min_to_max in i;
[| |eauto|eauto];auto.
rewrite h in *; simpl in *; tcsp.
- unfold view_change_cert2max_seq_preps in *; smash_pbft;[].
eapply view_change_cert2max_seq_preps_vc_none_implies in i;[|eauto]; pbft_simplifier.
Qed.
Hint Resolve from_min_to_max_of_view_changes_nil_implies_all_sequence_numbers_are_accounted_for_op_true : pbft.
Lemma view_change_cert_max_seq_preps_vc_none_implies_all_sequence_numbers_are_accounted_for :
forall k min OP,
view_change_cert2max_seq_preps_vc (valid_prepared_info (view_change_cert2prep k)) k = None
-> all_sequence_numbers_are_accounted_for (view_change_cert2prep k) min OP = true.
Proof.
introv vcmax.
unfold all_sequence_numbers_are_accounted_for.
apply forallb_forall.
introv i.
unfold sequence_number_is_accounted_for; smash_pbft.
assert False; tcsp.
remember (valid_prepared_info (view_change_cert2prep k)) as F; clear HeqF.
eapply view_change_cert2max_seq_preps_vc_none_implies in vcmax;[|eauto]; pbft_simplifier.
Qed.
Hint Resolve view_change_cert_max_seq_preps_vc_none_implies_all_sequence_numbers_are_accounted_for : pbft.
Lemma create_new_prepare_message_true_of_valid_prepared_info_in_implies :
forall x l v keys ppd,
In x l
-> valid_prepared_info l x = true
-> create_new_prepare_message (prepared_info2seq x) v keys l = (true, ppd)
-> same_digests (prepared_info2digest x) (pre_prepare2digest (fst ppd)) = true
/\ same_seq_nums (prepared_info2seq x) (pre_prepare2seq (fst ppd)) = true.
Proof.
introv i valid create.
repnd; simpl in *.
unfold create_new_prepare_message in create; smash_pbft.
rename_hyp_with find_pre_prepare_certificate_in_prepared_infos fprep.
apply find_pre_prepare_certificate_in_prepared_infos_some_implies in fprep.
repnd.
unfold same_seq_nums; smash_pbft; dands; auto;[].
unfold pre_prepare2digest; simpl.
unfold valid_prepared_info in *; smash_pbft.
unfold last_prepared_info in *.
allrw forallb_forall.
applydup valid0 in fprep0.
smash_pbft;[|].
- match goal with
| [ H : info_is_prepared x0 = true |- _ ] => rename H into isprep
end.
unfold info_is_prepared in isprep.
smash_pbft.
unfold prepared_info_has_correct_digest in *; smash_pbft.
- applydup fprep2 in i.
smash_pbft;[].
try omega.
Qed.
Hint Resolve create_new_prepare_message_true_of_valid_prepared_info_in_implies : pbft.
Lemma create_new_prepare_message_false_of_valid_prepared_info_in_implies :
forall x l v keys ppd,
In x l
-> valid_prepared_info l x = true
-> create_new_prepare_message (prepared_info2seq x) v keys l = (false, ppd)
-> False.
Proof.
introv i valid create.
repnd; simpl in *.
unfold create_new_prepare_message in create; smash_pbft.
rename_hyp_with find_pre_prepare_certificate_in_prepared_infos fprep.
eapply find_pre_prepare_certificate_in_prepared_infos_none_implies in i; eauto.
repndors; pbft_simplifier.
Qed.
Hint Resolve create_new_prepare_message_false_of_valid_prepared_info_in_implies : pbft.
Lemma create_new_prepare_messages_of_valid_prepared_info_in_implies :
forall N v keys l OP NP x,
create_new_prepare_messages N v keys l = (OP, NP)
-> In x l
-> valid_prepared_info l x = true
-> In (prepared_info2seq x) N
-> exists_prepared_info_in_pre_prepares x (map fst OP) = true.
Proof.
induction N; introv create i valid j; simpl in *; tcsp.
repndors; subst; smash_pbft.
Qed.
Hint Resolve create_new_prepare_messages_of_valid_prepared_info_in_implies : pbft.
Lemma create_new_prepare_messages_implies_all_sequence_numbers_are_accounted_for :
forall l v keys OP NP min max vc,
create_new_prepare_messages (from_min_to_max min max) v keys (view_change_cert2prep l) = (OP, NP)
-> view_change_cert2max_seq l = Some min
-> view_change_cert2max_seq_preps_vc (valid_prepared_info (view_change_cert2prep l)) l = Some (max, vc)
-> all_sequence_numbers_are_accounted_for (view_change_cert2prep l) min (map fst OP) = true.
Proof.
introv create vcmin vcmax.
unfold all_sequence_numbers_are_accounted_for.
apply forallb_forall.
introv i.
unfold sequence_number_is_accounted_for; smash_pbft.
Qed.
Hint Resolve create_new_prepare_messages_implies_all_sequence_numbers_are_accounted_for : pbft.
Lemma check_broadcast_new_view_generates :
forall i state entry nv entry' OP NP,
check_broadcast_new_view i state entry = Some (nv, entry', OP, NP)
-> correct_new_view nv = true.
Proof.
introv check.
dup check as check_backup.
hide_hyp check_backup.
unfold check_broadcast_new_view in check; smash_pbft.
rename_hyp_with view_changed_entry changed.
dup changed as changed_backup.
hide_hyp changed_backup.
unfold view_changed_entry in changed; smash_pbft.
pose proof (implies_length_view_change_entry2view_changes entry (length (vce_view_changes entry))) as lenvcs.
repeat (autodimp lenvcs hyp); allrw; auto;[].
remember (replace_own_view_change_in_entry (refresh_view_change x state) entry) as entry'.
remember (view_change_cert2max_seq (view_change_entry2view_changes entry')) as minop.
symmetry in Heqminop.
rename_hyp_with create_new_prepare_messages cr.
destruct minop as [min|];
[|applydup create_new_prepare_messages_view_change_cert2max_seq_none_implies in cr as eqs; auto;
repnd; subst; simpl in *;
rewrite eqs in *; simpl in *; GC;
unfold correct_new_view; simpl; smash_pbft; try omega;
destruct entry, vce_view_change; simpl in *; smash_pbft; try omega;
[eapply from_min_to_max_of_view_changes_nil_implies_all_sequence_numbers_are_accounted_for_op_true in eqs;
simpl in *; auto; exact eqs|];[];
match goal with
| [ H : correct_view_change _ _ = _ |- _ ] =>
applydup correct_view_change_implies_same_views in H as sv; simpl in sv
end; autorewrite with pbft in *; subst; tcsp];[].
assert (forall n, In n (from_min_to_max_of_view_changes entry') -> n <= max_O OP) as imp1.
{ introv i; eapply view_changed_entry_some_and_check_broadcast_new_view_implies_le; eauto. }
clear check_backup.
clear changed_backup.
rename_hyp_with correct_view_change corvcs.
assert (vce_view entry = view_change2view x) as eqviews.
{
unfold view_change_entry2view_changes in corvcs.
subst entry'; simpl in *.
destruct entry; simpl in *; smash_pbft.
unfold correct_view_change in *; smash_pbft.
unfold same_views in *; smash_pbft.
}
unfold correct_new_view; simpl; smash_pbft; try omega;
try (complete (destruct entry, vce_view_change; simpl in *; smash_pbft; try omega));
[| |].
- rename_hyp_with correct_new_view_opre_prepare_op coro.
rename_hyp_with correct_new_view_npre_prepare_op corn.
rename_hyp_with SeqNumDeq nrep1.
hide_hyp imp1.
hide_hyp coro.
hide_hyp corn.
hide_hyp nrep1.
rewrite Heqminop; simpl.
remember (replace_own_view_change_in_entry (refresh_view_change x state) entry) as l.
unfold from_min_to_max_of_view_changes in *; simpl in *.
unfold from_min_to_max_of_view_changes_cert in *; simpl in *.
rewrite Heqminop in *; simpl in *.
unfold view_change_cert2max_seq_preps in *; smash_pbft.
- match goal with
| [ H1 : create_new_prepare_messages _ _ _ _ = _, H2 : forallb _ _ = false |- _ ] =>
apply (create_new_prepare_messages_implies_correct_NPs
min (pre_prepares2max_seq (map fst OP))) in H1
end.
{
rewrite Heqminop in *; simpl in *; autorewrite with pbft in *; smash_pbft.
}
introv i create; repnd.
dands; eauto 2 with pbft.
rewrite <- max_O_as_pre_prepares2max_seq.
applydup imp1 in i.
apply le_lt_or_eq in i0; repndors; tcsp;[].
apply implies_eq_seq_nums in i0.
assert False; tcsp.
clear imp1.
unfold from_min_to_max_of_view_changes in *.
unfold from_min_to_max_of_view_changes_cert in *.
applydup in_from_min_to_max_op_implies in i.
exrepnd.
rewrite i2 in *; ginv.
rewrite i3 in *; ginv.
simpl in *.
pose proof (max_O_in OP) as q.
apply (view_change_cert2max_seq_preps_implies_exists_create_new_prepare_message
(view_change2view x) (local_keys state)) in i3.
exrepnd.
match goal with
| [ H1 : create_new_prepare_message _ _ _ _ = (false, _),
H2 : create_new_prepare_messages _ _ _ _ = _
|- _ ] =>
applydup create_new_prepare_message_implies_same_sequence_number in H1 as eqsn;
dup H2 as c1; dup H2 as c2; dup H2 as c3; rename H1 into fcreate
end.
(* c1 part *)
eapply create_new_prepare_message_true_implies_oprep_not_nil in c1;
[| |eauto]; eauto 2 with pbft;[].
(* c2 part *)
eapply false_implies_in_create_new_prepare_messages_n_pre_prepare in c2;
[| |exact fcreate];[|unfold from_min_to_max_of_view_changes;allrw;simpl;auto];[].
(* c3 part *)
apply create_new_prepare_messages_implies_norepeatsb in c3; eauto 2 with pbft;[].
autodimp q hyp; eauto 2 with pbft;[].
exrepnd.
eapply norepeatsb_pre_prepare2seq_oprep_nprep_implies;[eauto| |eauto|eauto].
congruence.
- match goal with
| [ H1 : create_new_prepare_messages _ _ _ _ = _, H2 : forallb _ _ = false |- _ ] =>
apply (create_new_prepare_messages_implies_correct_OPs min) in H1
end.
{
rewrite Heqminop in *; simpl in *; autorewrite with pbft in *; smash_pbft.
}
introv i create.
dands; eauto 2 with pbft.
Qed.
Hint Resolve check_broadcast_new_view_generates : pbft.
End PBFTprops4.
Hint Resolve info_is_prepared_implies_prepared_info_has_correct_digest : pbft.
Hint Resolve valid_prepared_info_implies_prepared_info_has_correct_digest : pbft.
Hint Resolve le_max_view_left : pbft.
Hint Resolve le_max_view_right : pbft.
Hint Resolve le_max_seq_num : pbft.
Hint Resolve le_max_seq_num_right : pbft.
Hint Resolve le_max_seq_num_op : pbft.
Hint Resolve PreparedInfos2max_seq_is_max : pbft.
Hint Resolve implies_in_from_min_to_max : pbft.
Hint Resolve in_from_min_to_max_trans : pbft.
Hint Resolve implies_prepared_info2max_seq_in_from_min_to_max : pbft.
Hint Resolve from_min_to_max_of_view_changes_nil_implies_all_sequence_numbers_are_accounted_for_op_true : pbft.
Hint Resolve view_change_cert_max_seq_preps_vc_none_implies_all_sequence_numbers_are_accounted_for : pbft.
Hint Resolve create_new_prepare_message_true_of_valid_prepared_info_in_implies : pbft.
Hint Resolve create_new_prepare_message_false_of_valid_prepared_info_in_implies : pbft.
Hint Resolve create_new_prepare_messages_of_valid_prepared_info_in_implies : pbft.
Hint Resolve create_new_prepare_messages_implies_all_sequence_numbers_are_accounted_for : pbft.
Hint Resolve check_broadcast_new_view_generates : pbft.
Hint Rewrite @view_change2view_refresh_view_change : pbft.
|
Formal statement is: lemma seq_compact_eq_acc_point: fixes s :: "'a :: first_countable_topology set" shows "seq_compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s --> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)))" Informal statement is: A set $S$ is sequentially compact if and only if every infinite countable subset of $S$ has an accumulation point in $S$. |
Inspiration can come from many places but this past weekend I found inspiration at the Arlene Abend Exhibit and Reception. The event was located at the Stone Quarry Hill Art Park in Cazenovia, New York and hosted by the Cazenovia Counterpoint. The Stone Quarry Hill Art Parks grounds are open daily from dawn to dusk and has unique outdoor art throughout the 104 acres. There are four miles of trails with breathtaking views.
Land was purchased in 1958 by Dorothy and Robert Riester and the house and studio at the top of the hill are now listed on the National Register of Historic Places.
Arlene Abend’s reception included a documentary film by Courtney Rile which I found entertaining and inspirational. Abend is a small woman with a big personality. She has spent the last four decades creating her wonderful sculptures. Some of her favorite tools are the welding torch, plasma cutters, vices and grinders.
I found her large sculptures captivating and thought-provoking. Her story of overcoming challenges was inspiring to me and I was very happy to watch the film by Courtney Rile. Abend worked as an artist in the field of metal work which was pretty much dominated by men. She was not deterred but forged ahead with new ideas and techniques. She has great enthusiasm which motivates me to continue on with my art.
If you are in the area, I would invite you to stop in at the Stone Quarry Art Park to walk some trails, look at some art and then head into town to visit some of the great little shops and restaurants in Cazenovia. |
#python example to infer document vectors from trained doc2vec model
import gensim.models as g
import codecs
import sys
import pandas as pd
import pandas_datareader as pdr
from pandas_datareader import data, wb
import time
import math
import os
from datetime import datetime
from datetime import date
from datetime import timedelta
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
test_docs = sys.argv[-1]
writer = pd.ExcelWriter('/home/ubuntu/fakenewsclean.xlsx')
breitbartData = pd.read_csv('/home/ubuntu/doc2vec-master/breitbartclean.csv')
huffingtonData = pd.read_csv('/home/ubuntu/doc2vec-master/huffingtonclean.csv')
voanewsData = pd.read_csv('/home/ubuntu/doc2vec-master/voanewsclean.csv')
rtData = pd.read_csv('/home/ubuntu/doc2vec-master/rtclean.csv')
##########################################################################
#### I can't remember how to create a new pandas dataframe ###############
##########################################################################
##########################################################################
####labeledData = pd.new????##############################################
##########################################################################
#parameters
model="toy_data/model.bin"
#test_docs="toy_data/test_docs.txt"
output_file="toy_data/test_vectors.txt"
#inference hyper-parameters
start_alpha=0.01
infer_epoch=1000
#load model
m = g.Doc2Vec.load(model) #yup
##########################################################################
####I think this is reading each line of the .txt document to an array?###
##########################################################################
test_docs = [ x.strip().split() for x in codecs.open(test_docs, "r", "utf-8").readlines() ]
##########################################################################
####I think this is reading each line of the .txt document to an array?###
##########################################################################
#infer test vectors
output = open(output_file, "w") ### we want to write to a csv or .xlsx instead of .txt ###
#################################################################
####I think this is processing the .txt document line by line?###
#################################################################
for d in test_docs:
output.write( " ".join([str(x) for x in m.infer_vector(d, alpha=start_alpha, steps=infer_epoch)]) + "\n" ) ## this line should be modified accordingly
#################################################################
####I think this is processing the .txt document line by line?###
#################################################################
output.flush() # once the pandas datapipeline is done, this can be commented out/deleted
output.close() # once the pandas datapipeline is done, this can be commented out/deleted
#Data labeling
#TODO: add new column to the pandas dataframe
#Breitbart = (1,0,0,0)
#Huffington = (0,1,0,0)
#VOANews = (0,0,1,0)
#RT.com = (0,0,0,1)
labeledData.to_excel(writer,'Sheet1')
writer.save()
|
import tools.super
open super tactic monad
example (a b : ℕ → Prop) (h : ∀x, (¬a x → b x) ∧ ¬b x ∧ ¬a x) := by do
c ← get_local `h >>= clause.of_classical_proof,
trace c,
cs ← get_clauses_classical [c],
trace cs,
c0 ← returnopt $ cs^.nth 0,
c1 ← returnopt $ cs^.nth 1,
c2 ← returnopt $ cs^.nth 2,
trace c0^.type,
trace c0^.proof,
triv
|
# -*- coding: utf-8 -*-
'''
An implementation of the StoBatch
'''
#import matplotlib.pyplot as plt
import numpy as np;
import random
import tensorflow as tf;
from tensorflow.python.framework import ops;
#from tensorflow.examples.tutorials.mnist import input_data;
import argparse;
import pickle;
from datetime import datetime
import time
import os
import math
import input_data
import smtplib
from mlp import EncLayer
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import candidate_sampling_ops
from tensorflow.python.ops import embedding_ops
from tensorflow.python.ops import gen_nn_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import sparse_ops
from tensorflow.python.ops import variables
from more_attack import *
from cleverhans.attacks import BasicIterativeMethod, CarliniWagnerL2, DeepFool, FastGradientMethod, MadryEtAl, MomentumIterativeMethod, SPSA, SpatialTransformationMethod
from cleverhans.attacks_tf import fgm, fgsm
from cleverhans import utils_tf
from cleverhans.model import CallableModelWrapper, CustomCallableModelWrapper
from cleverhans.utils import set_log_level
import logging
import copy
import robustness
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "4"
set_log_level(logging.ERROR)
AECODER_VARIABLES = 'AECODER_VARIABLES'
CONV_VARIABLES = 'CONV_VARIABLES'
def parse_time(time_sec):
time_string = "{} hours {} minutes".format(int(time_sec/3600), int((time_sec%3600)/60))
return time_string
#def weight_variable(shape):
# initial = tf.truncated_normal(shape, stddev=0.1);
# return tf.Variable(initial);
def weight_variable(name, shape, collect):
#initial = tf.truncated_normal(shape, stddev=np.sqrt(2.0/(5*5*32))/math.ceil(5 / 2));
#return tf.Variable(initial, collections=[collect]);
var = tf.get_variable(name = name, shape=shape, initializer=tf.contrib.layers.xavier_initializer(), dtype=tf.float32)
tf.add_to_collections(collect, var)
return var
def bias_variable(name, shape, collect):
#initial = tf.constant(0.1, shape=shape);
#return tf.Variable(initial, collections=[collect]);
var = tf.get_variable(name = name, shape=shape, dtype=tf.float32, initializer=tf.constant_initializer(0.0001))
tf.add_to_collections(collect, var)
return var
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 2, 2, 1], padding='SAME');
def max_pool_2x2(x):
return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],
strides=[1, 2, 2, 1], padding='SAME');
def generateIdLMNoise(image_size, Delta2, epsilon2, L):
#Initiate the noise for the first hidden layer#
W_conv1Noise = np.random.laplace(0.0, Delta2/(L*epsilon2), image_size**2).astype(np.float32);
W_conv1Noise = np.reshape(W_conv1Noise, [-1, image_size, image_size, 1]);
return W_conv1Noise;
def generateHkNoise(hk, Delta, epsilon, L):
perturbFM = np.random.laplace(0.0, Delta/(epsilon*L), hk)
perturbFM = np.reshape(perturbFM, [hk]);
return perturbFM;
def generateNoise(image_size, Delta2, _beta, epsilon2, L):
#Initiate the noise for the first hidden layer#
W_conv1Noise = np.random.laplace(0.0, 0.1, image_size**2).astype(np.float32);
W_conv1Noise = np.reshape(W_conv1Noise, [-1, image_size, image_size, 1]);
#Redistribute the noise#
for i in range(0, image_size):
for j in range(0, image_size):
W_conv1Noise[0][i][j] = np.random.laplace(0.0, Delta2/(L*(_beta[i+2][j+2])*epsilon2), 1);
###
return W_conv1Noise;
FLAGS = None;
def avg_pool(input, s):
return tf.nn.avg_pool(input, [ 1, s, s, 1 ], [1, s, s, 1 ], 'VALID')
def max_out(inputs, num_units, axis=None):
shape = inputs.get_shape().as_list()
if shape[0] is None:
shape[0] = -1
if axis is None: # Assume that channel is the last dimension
axis = -1
num_channels = shape[axis]
if num_channels % num_units:
raise ValueError('number of features({}) is not '
'a multiple of num_units({})'.format(num_channels, num_units))
shape[axis] = num_units
shape += [num_channels // num_units]
outputs = tf.reduce_max(tf.reshape(inputs, shape), -1, keep_dims=False)
return outputs
def batch_adv(sess, adv_op, x_images, y_, test_input, test_labels):
'''
Generate adv samples in batch
'''
feed_dict = {x_images:test_input, y_:test_labels}
adv_list = sess.run(adv_op, feed_dict=feed_dict)
return adv_list
def inference(x_image, perturbFM, hk, perturbFM_h, params):
z = x_image;
"""W_conv1 = weight_variable([5, 5, 1, 32]);
b_conv1 = bias_variable([32]);"""
W_conv1 = params[0];
b_conv1 = params[1];
h_conv1 = tf.nn.relu(conv2d(z, W_conv1) + b_conv1 + perturbFM_h);
h_conv1 = tf.contrib.layers.batch_norm(h_conv1, scale=True, is_training=True, updates_collections=[CONV_VARIABLES])
#h_pool1 = max_pool_2x2(h_conv1);
h_pool1 = avg_pool(h_conv1, 2);
print(h_pool1)
"""W_conv2 = weight_variable([5, 5, 32, 64]);
b_conv2 = bias_variable([64]);"""
W_conv2 = params[2];
b_conv2 = params[3];
h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2);
#h_pool2 = max_pool_2x2(h_conv2);
#h_pool2 = avg_pool(h_conv2, 2);
print(h_conv2)
"""W_fc1 = weight_variable([7 * 7 * 64, hk]);
b_fc1 = bias_variable([hk]);"""
W_fc1 = params[4];
b_fc1 = params[5];
h_pool2_flat = tf.reshape(h_conv2, [-1, 4*4*64]);
z2 = tf.matmul(h_pool2_flat, W_fc1) + b_fc1;
#Applying normalization for the flat connected layer h_fc1#
#batch_mean2, batch_var2 = tf.nn.moments(z2,[0])
################################################################################################################### changed this
# scale2 = tf.Variable(tf.ones([hk]))
# beta2 = tf.Variable(tf.zeros([hk]))
#scale2 = params[8]
#beta2 = params[9]
################################################################################################################### changed this
BN_norm = tf.contrib.layers.batch_norm(z2, scale=True, is_training=True, updates_collections=[CONV_VARIABLES]) #tf.nn.batch_normalization(z2,batch_mean2,batch_var2,beta2,scale2,1e-3)
###
#h_fc1 = tf.nn.relu(BN_norm);
h_fc1 = max_out(BN_norm, hk)
h_fc1 = tf.clip_by_value(h_fc1, -1, 1) #hidden neurons must be bounded in [-1, 1]
#perturbFM = tf.placeholder(tf.float32, [hk]);
#h_fc1 += perturbFM;
#Sometime bound the 2-norm of h_fc1 can help to stablize the training process. Use with care.
#h_fc1 = tf.clip_by_norm(h_fc1, c[2], 1);
#place holder for dropout, however we do not use dropout in this code#
#h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob);
###
"""W_fc2 = weight_variable([hk, 10]);
b_fc2 = bias_variable([10]);"""
W_fc2 = params[6];
b_fc2 = params[7];
y_conv = tf.matmul(h_fc1, W_fc2) + b_fc2;
###
return y_conv
def inference_robust_mask(y_conv, Delta2, L, eps, robustness_T):
##Robustness####
softmax = tf.nn.softmax(y_conv)
values, indices = tf.nn.top_k(softmax,2)
values = tf.unstack(values, num=2, axis=1)
print('nn_tok_k: ')
print(values)
print(indices)
eps_r = tf.log(values[0] / values[1]) / 2.0
print('eps_r')
print(eps_r)
kappa_phi = (Delta2 * eps_r * (1 + 2e-5))/(L * eps)
print('kappa_phi')
print(kappa_phi)
robust_pos = tf.ones(shape=tf.shape(kappa_phi))
robust_neg = tf.zeros(shape=tf.shape(kappa_phi))
robust_mask = tf.where(eps_r >= robustness_T, robust_pos, robust_neg)
print('robust_mask')
print(robust_mask)
#####
return robust_mask
def inference_probs(x_image, perturbFM, hk, params):
logits = inference(x_image, perturbFM, hk, params)
return tf.nn.softmax(logits)
def inference_test_input(x, hk, params, image_size, adv_noise):
z = tf.reshape(x, [-1,image_size,image_size,1]) + adv_noise
W_conv1 = params[0];
b_conv1 = params[1];
h_conv1 = tf.nn.relu(conv2d(z, W_conv1) + b_conv1);
h_conv1 = tf.contrib.layers.batch_norm(h_conv1, scale=True, is_training=False, updates_collections=None)
h_pool1 = avg_pool(h_conv1, 2);
print(h_pool1)
W_conv2 = params[2];
b_conv2 = params[3];
h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2);
#h_pool2 = max_pool_2x2(h_conv2);
#h_pool2 = avg_pool(h_conv2, 2);
print(h_conv2)
W_fc1 = params[4];
b_fc1 = params[5];
h_pool2_flat = tf.reshape(h_conv2, [-1, 4*4*64]);
z2 = tf.matmul(h_pool2_flat, W_fc1) + b_fc1;
#Applying normalization for the flat connected layer h_fc1#
batch_mean2, batch_var2 = tf.nn.moments(z2,[0])
#scale2 = params[8]
#beta2 = params[9]
#BN_norm = tf.nn.batch_normalization(z2,batch_mean2,batch_var2,beta2,scale2,1e-3)
BN_norm = tf.contrib.layers.batch_norm(z2, scale=True, is_training=False, updates_collections=None)
###
#h_fc1 = tf.nn.relu(BN_norm);
h_fc1 = max_out(BN_norm, hk)
#h_fc1 = tf.clip_by_value(h_fc1, -1, 1) #hidden neurons must be bounded in [-1, 1]
#perturbFM = tf.placeholder(tf.float32, [hk]);
#h_fc1 += perturbFM;
###
"""W_fc2 = weight_variable([hk, 10]);
b_fc2 = bias_variable([10]);"""
W_fc2 = params[6];
b_fc2 = params[7];
y_conv = tf.matmul(h_fc1, W_fc2) + b_fc2;
###
return y_conv
def inference_test_input_probs(x, hk, params, image_size, adv_noise):
logits = inference_test_input(x, hk, params, image_size, adv_noise)
return tf.nn.softmax(logits)
def train(alpha, eps2_ratio, gen_ratio, fgsm_eps, LR, logfile):
logfile.write("fgsm_eps \t %g, LR \t %g, alpha \t %d , eps2_ratio \t %d , gen_ratio \t %d \n"%(fgsm_eps, LR, alpha, eps2_ratio, gen_ratio))
#############################
##Hyper-parameter Setting####
#############################
hk = 256; #number of hidden units at the last layer
Delta2 = (14*14+2)*25; #global sensitivity for the first hidden layer
Delta3_adv = 2*hk #10*(hk + 1/4 * hk**2) #10*(hk) #global sensitivity for the output layer
Delta3_benign = 2*hk #10*(hk); #global sensitivity for the output layer
D = 50000; #size of the dataset
L = 2499; #batch size
image_size = 28;
padding = 4;
#numHidUnits = 14*14*32 + 7*7*64 + M + 10; #number of hidden units
#gen_ratio = 1
epsilon1 = 0.0; #0.175; #epsilon for dpLRP
epsilon2 = 0.1*(1 + gen_ratio); #epsilon for the first hidden layer
epsilon3 = 0.1*(1); #epsilon for the last hidden layer
total_eps = epsilon1 + epsilon2 + epsilon3
print(total_eps)
uncert = 0.1; #uncertainty modeling at the output layer
infl = 1; #inflation rate in the privacy budget redistribution
R_lowerbound = 1e-5; #lower bound of the LRP
c = [0, 40, 50, 200] #norm bounds
epochs = 200; #number of epochs
preT_epochs = 50; #number of epochs
T = int(D/L*epochs + 1); #number of steps T
pre_T = int(D/L*preT_epochs + 1);
step_for_epoch = int(D/L); #number of steps for one epoch
broken_ratio = 1
#alpha = 9.0 # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
#eps2_ratio = 10; # [1/10, 1/8, 1/6, 1/4, 1/2, 1, 2, 4, 6, 8, 10]
#eps_benign = 1/(1+eps2_ratio)*(2*epsilon2)
#eps_adv = eps2_ratio/(1+eps2_ratio)*(2*epsilon2)
#fgsm_eps = 0.1
rand_alpha = 0.05
##Robustness##
robustness_T = (fgsm_eps*18*18*L*epsilon2)/Delta2;
####
LRPfile = os.getcwd() + '/Relevance_R_0_075.txt';
#############################
mnist = input_data.read_data_sets("MNIST_data/", one_hot = True);
#############################
##Construct the Model########
#############################
#Step 4: Randomly initiate the noise, Compute 1/|L| * Delta3 for the output layer#
#Compute the 1/|L| * Delta3 for the last hidden layer#
"""eps3_ratio = Delta3_adv/Delta3_benign;
eps3_benign = 1/(1+eps3_ratio)*(epsilon3)
eps3_adv = eps3_ratio/(1+eps3_ratio)*(epsilon3)"""
loc, scale3_benign, scale3_adv = 0., Delta3_benign/(epsilon3*L), Delta3_adv/(epsilon3*L);
###
#End Step 4#
# Parameters Declarification
W_conv1 = weight_variable('W_conv1', [5, 5, 1, 32], collect=[AECODER_VARIABLES]);
b_conv1 = bias_variable('b_conv1', [32], collect=[AECODER_VARIABLES]);
shape = W_conv1.get_shape().as_list()
w_t = tf.reshape(W_conv1, [-1, shape[-1]])
w = tf.transpose(w_t)
sing_vals = tf.svd(w, compute_uv=False)
sensitivity = tf.reduce_max(sing_vals)
gamma = 2*(14*14 + 2)*25/(L*sensitivity)
dp_epsilon=0.005 #0.1
delta_r = fgsm_eps*(image_size**2);
#delta_h = 1.0 * delta_r; #sensitivity*(14**2) = sensitivity*(\beta**2) can also be used
#dp_mult = (Delta2/(L*epsilon2))/(delta_r / dp_epsilon) + (2*Delta2/(L*epsilon2))/(delta_h / dp_epsilon)
W_conv2 = weight_variable('W_conv2', [5, 5, 32, 64], collect=[CONV_VARIABLES]);
b_conv2 = bias_variable('b_conv2', [64], collect=[CONV_VARIABLES]);
W_fc1 = weight_variable('W_fc1', [4 * 4 * 64, hk], collect=[CONV_VARIABLES]);
b_fc1 = bias_variable('b_fc1', [hk], collect=[CONV_VARIABLES]);
W_fc2 = weight_variable('W_fc2', [hk, 10], collect=[CONV_VARIABLES]);
b_fc2 = bias_variable('b_fc2', [10], collect=[CONV_VARIABLES]);
"""scale2 = tf.Variable(tf.ones([hk]))
beta2 = tf.Variable(tf.zeros([hk]))
tf.add_to_collections([CONV_VARIABLES], scale2)
tf.add_to_collections([CONV_VARIABLES], beta2)"""
params = [W_conv1, b_conv1, W_conv2, b_conv2, W_fc1, b_fc1, W_fc2, b_fc2]
###
#Step 5: Create the model#
noise = tf.placeholder(tf.float32, [None, image_size, image_size, 1]);
adv_noise = tf.placeholder(tf.float32, [None, image_size, image_size, 1]);
keep_prob = tf.placeholder(tf.float32);
x = tf.placeholder(tf.float32, [None, image_size*image_size]);
x_image = tf.reshape(x, [-1,image_size,image_size,1]);
#perturbFMx = np.random.laplace(0.0, Delta2/(2*epsilon2*L), 28*28)
#perturbFMx = np.reshape(perturbFMx, [-1, 28, 28, 1]);
# pretrain ###
#Enc_Layer1 = EncLayer(inpt=x_image, n_filter_in = 1, n_filter_out = 32, filter_size = 5, W=W_conv1, b=b_conv1, activation=tf.nn.relu)
#pretrain = Enc_Layer1.get_train_ops2(xShape = tf.shape(x_image)[0], Delta = Delta2, epsilon = 2*epsilon2, batch_size = L, learning_rate= LR, W = W_conv1, b = b_conv1, perturbFMx = noise)
###########
adv_x = tf.placeholder(tf.float32, [None, image_size*image_size]);
adv_image = tf.reshape(adv_x, [-1,image_size,image_size,1]);
#perturbFMx_adv = np.random.laplace(0.0, Delta2/(2*epsilon2*L), 28*28)
#perturbFMx_adv = np.reshape(perturbFMx_adv, [-1, 28, 28, 1]);
# pretrain adv ###
#perturbFM_h = np.random.laplace(0.0, 2*Delta2/(epsilon2*L), 14*14*32)
#perturbFM_h = np.reshape(perturbFM_h, [-1, 14, 14, 32]);
FM_h = tf.placeholder(tf.float32, [None, 14, 14, 32]);
Enc_Layer2 = EncLayer(inpt=adv_image, n_filter_in = 1, n_filter_out = 32, filter_size = 5, W=W_conv1, b=b_conv1, activation=tf.nn.relu)
pretrain_adv = Enc_Layer2.get_train_ops2(xShape = tf.shape(adv_image)[0], Delta = Delta2, batch_size = L, learning_rate= LR, W = W_conv1, b = b_conv1, perturbFMx = adv_noise, perturbFM_h = FM_h)
Enc_Layer3 = EncLayer(inpt=x_image, n_filter_in = 1, n_filter_out = 32, filter_size = 5, W=W_conv1, b=b_conv1, activation=tf.nn.relu)
pretrain_benign = Enc_Layer3.get_train_ops2(xShape = tf.shape(x_image)[0], Delta = Delta2, batch_size = L, learning_rate= LR, W = W_conv1, b = b_conv1, perturbFMx = noise, perturbFM_h = FM_h)
###########
x_image += noise;
x_image = tf.clip_by_value(x_image, -10, 10) #Clip the values of each input feature.
adv_image += adv_noise;
adv_image = tf.clip_by_value(adv_image, -10, 10) #Clip the values of each input feature.
#perturbFM = np.random.laplace(0.0, scale3_benign, hk)
#perturbFM = np.reshape(perturbFM, [hk]);
perturbFM = np.random.laplace(0.0, scale3_benign, hk * 10)
perturbFM = np.reshape(perturbFM, [hk, 10]);
y_conv = inference(x_image, perturbFM, hk, FM_h, params);
softmax_y_conv = tf.nn.softmax(y_conv)
#robust_mask = inference_robust_mask(y_conv, Delta2, L, epsilon2, robustness_T)
#perturbFM = np.random.laplace(0.0, scale3_adv, hk)
#perturbFM = np.reshape(perturbFM, [hk]);
y_adv_conv = inference(adv_image, perturbFM, hk, FM_h, params);
#adv_robust_mask = inference_robust_mask(y_adv_conv, Delta2, L, epsilon2, robustness_T)
# test model
perturbFM_test = np.random.laplace(0.0, 0, hk)
perturbFM_test = np.reshape(perturbFM_test, [hk]);
x_test = tf.reshape(x, [-1,image_size,image_size,1]);
y_test = inference(x_test, perturbFM_test, hk, FM_h, params);
#test_robust_mask = inference_robust_mask(y_test, Delta2, L, epsilon2, robustness_T)
#Define a place holder for the output label#
y_ = tf.placeholder(tf.float32, [None, 10]);
adv_y_ = tf.placeholder(tf.float32, [None, 10]);
#End Step 5#
#############################
#############################
##Define loss and Optimizer##
#############################
'''
Computes differentially private sigmoid cross entropy given `logits`.
Measures the probability error in discrete classification tasks in which each
class is independent and not mutually exclusive.
For brevity, let `x = logits`, `z = labels`. The logistic loss is
z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x))
= z * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x)))
= z * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x)))
= z * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x))
= (1 - z) * x + log(1 + exp(-x))
= x - x * z + log(1 + exp(-x))
For x < 0, to avoid overflow in exp(-x), we reformulate the above
x - x * z + log(1 + exp(-x))
= log(exp(x)) - x * z + log(1 + exp(-x))
= - x * z + log(1 + exp(x))
Hence, to ensure stability and avoid overflow, the implementation uses this
equivalent formulation
max(x, 0) - x * z + log(1 + exp(-abs(x)))
`logits` and `labels` must have the same type and shape. Let denote neg_abs_logits = -abs(y_conv) = -abs(h_fc1 * W_fc2). By Applying Taylor Expansion, we have:
Taylor = max(y_conv, 0) - y_conv * y_ + log(1 + exp(-abs(y_conv)));
= max(h_fc1 * W_fc2, 0) - (y_ * h_fc1) * W_fc2 + (math.log(2.0) + 0.5*neg_abs_logits + 1.0/8.0*neg_abs_logits**2)
= max(h_fc1 * W_fc2, 0) - (y_ * h_fc1) * W_fc2 + (math.log(2.0) + 0.5*(-abs(h_fc1 * W_fc2)) + 1.0/8.0*(-abs(h_fc1 * W_fc2))**2)
= F1 + F2
where: F1 = max(h_fc1 * W_fc2, 0) + (math.log(2.0) + 0.5*(-abs(h_fc1 * W_fc2)) + 1.0/8.0*(-abs(h_fc1 * W_fc2))**2) and F2 = - (y_ * h_fc1) * W_fc2
To ensure that Taylor is differentially private, we need to perturb all the coefficients, including the term y_ * h_fc1 * W_fc2.
Note that h_fc1 is differentially private, since its computation on top of the DP Affine transformation does not access the original data.
Therefore, F1 should be differentially private. We need to preserve DP in F2, which reads the groundtruth label y_, as follows:
By applying Funtional Mechanism, we perturb (y_ * h_fc1) * W_fc2 as ((y_ * h_fc1) + perturbFM) * W_fc2 = (y_ * h_fc1)*W_fc2 + (perturbFM * W_fc2):
perturbFM = np.random.laplace(0.0, scale3, hk * 10)
perturbFM = np.reshape(perturbFM/L, [hk, 10]);
where scale3 = Delta3/(epsilon3) = 2*hk/(epsilon3);
To allow computing gradients at zero, we define custom versions of max and abs functions [Tensorflow].
Source: https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/python/ops/nn_impl.py @ TensorFlow
'''
### Taylor for benign x
zeros = array_ops.zeros_like(y_conv, dtype=y_conv.dtype)
cond = (y_conv >= zeros)
relu_logits = array_ops.where(cond, y_conv, zeros)
neg_abs_logits = array_ops.where(cond, -y_conv, y_conv)
#Taylor = math_ops.add(relu_logits - y_conv * y_, math_ops.log1p(math_ops.exp(neg_abs_logits)))
Taylor_benign = math_ops.add(relu_logits - y_conv * y_, math.log(2.0) + 0.5*neg_abs_logits + 1.0/8.0*neg_abs_logits**2) - tf.reduce_sum(perturbFM*W_fc2)
#Taylor_benign = tf.abs(y_conv - y_)
### Taylor for adv_x
zeros_adv = array_ops.zeros_like(y_adv_conv, dtype=y_conv.dtype)
cond_adv = (y_adv_conv >= zeros_adv)
relu_logits_adv = array_ops.where(cond_adv, y_adv_conv, zeros_adv)
neg_abs_logits_adv = array_ops.where(cond_adv, -y_adv_conv, y_adv_conv)
#Taylor = math_ops.add(relu_logits - y_conv * y_, math_ops.log1p(math_ops.exp(neg_abs_logits)))
Taylor_adv = math_ops.add(relu_logits_adv - y_adv_conv * adv_y_, math.log(2.0) + 0.5*neg_abs_logits_adv + 1.0/8.0*neg_abs_logits_adv**2) - tf.reduce_sum(perturbFM*W_fc2)
#Taylor_adv = tf.abs(y_adv_conv - adv_y_)
### Adversarial training loss
adv_loss = (1/(L + L*alpha))*(Taylor_benign + alpha * Taylor_adv)
'''Some time, using learning rate decay can help to stablize training process. However, use this carefully, since it may affect the convergent speed.'''
global_step = tf.Variable(0, trainable=False)
pretrain_var_list = tf.get_collection(AECODER_VARIABLES)
train_var_list = tf.get_collection(CONV_VARIABLES)
#print(pretrain_var_list)
#print(train_var_list)
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
pretrain_step = tf.train.AdamOptimizer(LR).minimize(pretrain_adv+pretrain_benign, global_step=global_step, var_list=pretrain_var_list);
train_step = tf.train.AdamOptimizer(LR).minimize(adv_loss, global_step=global_step, var_list=train_var_list);
sess = tf.InteractiveSession();
# Define the correct prediction and accuracy
# This needs to be changed to "Robust Prediction"
correct_prediction_x = tf.equal(tf.argmax(y_test,1), tf.argmax(y_,1));
accuracy_x = tf.reduce_mean(tf.cast(correct_prediction_x, tf.float32));
#############
# use these to get predictions wrt to robust conditions
"""robust_correct_prediction_x = tf.multiply(test_robust_mask, tf.cast(correct_prediction_x, tf.float32))
accuracy_x_robust = tf.reduce_sum(robust_correct_prediction_x) / tf.reduce_sum(test_robust_mask)
#certified_utility = 2/(1/accuracy_x_robust + 1/(tf.reduce_sum(test_robust_mask)/(1.0*tf.cast(tf.size(test_robust_mask), tf.float32))))
certified_utility = (1.0*tf.reduce_sum(test_robust_mask))/(1.0*tf.cast(tf.size(test_robust_mask), tf.float32))"""
#############
# craft adversarial samples from x for training
dynamic_eps = tf.placeholder(tf.float32);
emsemble_L = int(L/3)
softmax_y = tf.nn.softmax(y_test)
#c_x_adv = fgsm(x, softmax_y, eps=fgsm_eps, clip_min=0.0, clip_max=1.0)
c_x_adv = fgsm(x, softmax_y, eps=(dynamic_eps)/10, clip_min=-1.0, clip_max=1.0) # for I-FGSM
x_adv = tf.reshape(c_x_adv, [emsemble_L,image_size*image_size]);
#====================== attack =========================
#attack_switch = {'randfgsm':True, 'fgsm':True, 'ifgsm':True, 'deepfool':True, 'mim':True, 'spsa':False, 'cwl2':False, 'madry':True, 'stm':True}
#attack_switch = {'fgsm':True, 'ifgsm':True, 'deepfool':True, 'mim':True, 'spsa':False, 'cwl2':False, 'madry':True, 'stm':True}
attack_switch = {'fgsm':True, 'ifgsm':True, 'deepfool':False, 'mim':True, 'spsa':False, 'cwl2':False, 'madry':True, 'stm':False}
#other possible attacks:
# ElasticNetMethod
# FastFeatureAdversaries
# LBFGS
# SaliencyMapMethod
# VirtualAdversarialMethod
# y_test = logits (before softmax)
# softmax_y_test = preds (probs, after softmax)
softmax_y_test = tf.nn.softmax(y_test)
# create saver
saver = tf.train.Saver(tf.all_variables())
sess.run(W_conv1.initializer)
_gamma = sess.run(gamma)
_gamma_x = Delta2/L
epsilon2_update = epsilon2/(1.0 + 1.0/_gamma + 1/_gamma_x)
print(epsilon2_update/_gamma + epsilon2_update/_gamma_x)
print(epsilon2_update)
_sensitivityW = sess.run(sensitivity)
delta_h = _sensitivityW*(14**2)
#dp_mult = (Delta2/(L*epsilon2_update))/(delta_r / dp_epsilon) + (2*Delta2/(L*epsilon2_update))/(delta_h / dp_epsilon)
dp_mult = (Delta2) / (L*epsilon2_update * (delta_h / 2 + delta_r))
#############################
iterativeStep = 100
# load the most recent models
_global_step = 0
ckpt = tf.train.get_checkpoint_state(os.getcwd() + './tmp/train')
if ckpt and ckpt.model_checkpoint_path:
print(ckpt.model_checkpoint_path);
saver.restore(sess, ckpt.model_checkpoint_path)
_global_step = int(ckpt.model_checkpoint_path.split('/')[-1].split('-')[-1])
else:
print('No checkpoint file found')
start_time = time.time();
# adv pretrain model (Auto encoder layer)
cost = tf.reduce_sum(Enc_Layer2.cost);
logfile.write("pretrain: \n")
# define cleverhans abstract models for using cleverhans attacks
ch_model_logits = CustomCallableModelWrapper(callable_fn=inference_test_input, output_layer='logits', hk=hk, params=params, image_size=image_size, adv_noise = adv_noise)
ch_model_probs = CustomCallableModelWrapper(callable_fn=inference_test_input_probs, output_layer='probs', hk=hk, params=params, image_size=image_size, adv_noise = adv_noise)
# rand+fgsm
# if attack_switch['randfgsm']:
# randfgsm_obj = FastGradientMethod(model=ch_model_probs, sess=sess)
# x_randfgsm_t = (fgsm_eps - rand_alpha) * randfgsm_obj.generate(x=x, eps=fgsm_eps, clip_min=-1.0, clip_max=1.0)
# x_rand_t = rand_alpha * tf.sign(tf.random_normal(shape=tf.shape(x), mean=0.0, stddev=1.0))
# define each attack method's tensor
mu_alpha = tf.placeholder(tf.float32, [1]);
attack_tensor_dict = {}
# FastGradientMethod
if attack_switch['fgsm']:
print('creating attack tensor of FastGradientMethod')
fgsm_obj = FastGradientMethod(model=ch_model_probs, sess=sess)
#x_adv_test_fgsm = fgsm_obj.generate(x=x, eps=fgsm_eps, clip_min=-1.0, clip_max=1.0, ord=2) # testing now
x_adv_test_fgsm = fgsm_obj.generate(x=x, eps=mu_alpha, clip_min=-1.0, clip_max=1.0) # testing now
attack_tensor_dict['fgsm'] = x_adv_test_fgsm
# Iterative FGSM (BasicIterativeMethod/ProjectedGradientMethod with no random init)
# default: eps_iter=0.05, nb_iter=10
if attack_switch['ifgsm']:
print('creating attack tensor of BasicIterativeMethod')
ifgsm_obj = BasicIterativeMethod(model=ch_model_probs, sess=sess)
#x_adv_test_ifgsm = ifgsm_obj.generate(x=x, eps=fgsm_eps, eps_iter=fgsm_eps/10, nb_iter=10, clip_min=-1.0, clip_max=1.0, ord=2)
x_adv_test_ifgsm = ifgsm_obj.generate(x=x, eps=mu_alpha, eps_iter=mu_alpha/iterativeStep, nb_iter=iterativeStep, clip_min=-1.0, clip_max=1.0)
attack_tensor_dict['ifgsm'] = x_adv_test_ifgsm
# Deepfool
if attack_switch['deepfool']:
print('creating attack tensor of DeepFool')
deepfool_obj = DeepFool(model=ch_model_logits, sess=sess)
#x_adv_test_deepfool = deepfool_obj.generate(x=x, nb_candidate=10, overshoot=0.02, max_iter=50, nb_classes=10, clip_min=-1.0, clip_max=1.0, ord=2)
x_adv_test_deepfool = deepfool_obj.generate(x=x, nb_candidate=10, overshoot=0.02, max_iter=50, nb_classes=10, clip_min=-1.0, clip_max=1.0)
attack_tensor_dict['deepfool'] = x_adv_test_deepfool
# MomentumIterativeMethod
# default: eps_iter=0.06, nb_iter=10
if attack_switch['mim']:
print('creating attack tensor of MomentumIterativeMethod')
mim_obj = MomentumIterativeMethod(model=ch_model_probs, sess=sess)
#x_adv_test_mim = mim_obj.generate(x=x, eps=fgsm_eps, eps_iter=fgsm_eps/10, nb_iter=10, decay_factor=1.0, clip_min=-1.0, clip_max=1.0, ord=2)
x_adv_test_mim = mim_obj.generate(x=x, eps=mu_alpha, eps_iter=mu_alpha/iterativeStep, nb_iter=iterativeStep, decay_factor=1.0, clip_min=-1.0, clip_max=1.0)
attack_tensor_dict['mim'] = x_adv_test_mim
# SPSA
# note here the epsilon is the infinity norm instead of precent of perturb
# Maybe exclude this method first, since it seems to have some constrain about the data value range
if attack_switch['spsa']:
print('creating attack tensor of SPSA')
spsa_obj = SPSA(model=ch_model_logits, sess=sess)
#x_adv_test_spsa = spsa_obj.generate(x=x, epsilon=fgsm_eps, num_steps=10, is_targeted=False, early_stop_loss_threshold=None, learning_rate=0.01, delta=0.01,spsa_samples=1000, spsa_iters=1, ord=2)
x_adv_test_spsa = spsa_obj.generate(x=x, epsilon=fgsm_eps, num_steps=10, is_targeted=False, early_stop_loss_threshold=None, learning_rate=0.01, delta=0.01,spsa_samples=1000, spsa_iters=1)
attack_tensor_dict['spsa'] = x_adv_test_spsa
# CarliniWagnerL2
# confidence=0 is fron their paper
# it is said to be slow, maybe exclude first
if attack_switch['cwl2']:
print('creating attack tensor of CarliniWagnerL2')
cwl2_obj = CarliniWagnerL2(model=ch_model_logits, sess=sess)
#x_adv_test_cwl2 = cwl2_obj.generate(x=x, confidence=0, batch_size=1000, learning_rate=0.005, binary_search_steps=5, max_iterations=500, abort_early=True, initial_const=0.01, clip_min=-1.0, clip_max=1.0, ord=2)
x_adv_test_cwl2 = cwl2_obj.generate(x=x, confidence=0, batch_size=1000, learning_rate=0.005, binary_search_steps=5, max_iterations=500, abort_early=True, initial_const=0.01, clip_min=-1.0, clip_max=1.0)
attack_tensor_dict['cwl2'] = x_adv_test_cwl2
# MadryEtAl (Projected Grdient with random init, same as rand+fgsm)
# default: eps_iter=0.01, nb_iter=40
if attack_switch['madry']:
print('creating attack tensor of MadryEtAl')
madry_obj = MadryEtAl(model=ch_model_probs, sess=sess)
#x_adv_test_madry = madry_obj.generate(x=x, eps=fgsm_eps, eps_iter=fgsm_eps/10, nb_iter=10, clip_min=-1.0, clip_max=1.0, ord=2)
x_adv_test_madry = madry_obj.generate(x=x, eps=mu_alpha, eps_iter=fgsm_eps/iterativeStep, nb_iter=iterativeStep, clip_min=-1.0, clip_max=1.0)
attack_tensor_dict['madry'] = x_adv_test_madry
# SpatialTransformationMethod
# the params are pretty different from on the paper
# so I use default
# exclude since there's bug
if attack_switch['stm']:
print('creating attack tensor of SpatialTransformationMethod')
stm_obj = SpatialTransformationMethod(model=ch_model_probs, sess=sess)
#x_adv_test_stm = stm_obj.generate(x=x, batch_size=1000, n_samples=None, dx_min=-0.1, dx_max=0.1, n_dxs=2, dy_min=-0.1, dy_max=0.1, n_dys=2, angle_min=-30, angle_max=30, n_angles=6, ord=2)
x_adv_test_stm = stm_obj.generate(x=x, batch_size=1000, n_samples=None, dx_min=-0.1, dx_max=0.1, n_dxs=2, dy_min=-0.1, dy_max=0.1, n_dys=2, angle_min=-30, angle_max=30, n_angles=6)
attack_tensor_dict['stm'] = x_adv_test_stm
#====================== attack =========================
sess.run(tf.initialize_all_variables());
##perturb h for training
perturbFM_h = np.random.laplace(0.0, 2*Delta2/(epsilon2_update*L), 14*14*32)
perturbFM_h = np.reshape(perturbFM_h, [-1, 14, 14, 32]);
##perturb h for testing
perturbFM_h_test = np.random.laplace(0.0, 0, 14*14*32)
perturbFM_h_test = np.reshape(perturbFM_h_test, [-1, 14, 14, 32]);
'''for i in range(_global_step, _global_step + pre_T):
d_eps = random.random();
batch = mnist.train.next_batch(L); #Get a random batch.
adv_images = sess.run(x_adv, feed_dict = {x:batch[0], y_:batch[1], FM_h: perturbFM_h_test, dynamic_eps: d_eps})
for iter in range(0, 9):
adv_images = sess.run(x_adv, feed_dict = {x:adv_images, y_:batch[1], FM_h: perturbFM_h_test, dynamic_eps: d_eps})
"""batch = mnist.train.next_batch(emsemble_L)
adv_images_mim = sess.run(attack_tensor_dict['mim'], feed_dict = {x:batch[0], y_: batch[1]})
batch = mnist.train.next_batch(emsemble_L)
adv_images_madry = sess.run(attack_tensor_dict['mim'], feed_dict = {x:batch[0], y_: batch[1]})
train_images = np.append(np.append(adv_images, adv_images_mim, axis = 0),adv_images_madry, axis = 0)"""
batch_2 = mnist.train.next_batch(L);
pretrain_step.run(feed_dict={adv_x: np.append(adv_images, batch_2[0], axis = 0), adv_noise: AdvLnoise, FM_h: perturbFM_h});
if i % int(5*step_for_epoch) == 0:
cost_value = sess.run(cost, feed_dict={adv_x:mnist.test.images, adv_noise: AdvLnoise_test, FM_h: perturbFM_h_test})/(test_size*32)
logfile.write("step \t %d \t %g \n"%(i, cost_value))
print(cost_value)
pre_train_finish_time = time.time()
print('pre_train finished in: ' + parse_time(pre_train_finish_time - start_time))'''
# train and test model with adv samples
max_benign_acc = -1;
max_robust_benign_acc = -1
#max_adv_acc = -1;
test_size = len(mnist.test.images)
AdvLnoise = generateIdLMNoise(image_size, Delta2, epsilon2_update, L);
AdvLnoise_test = generateIdLMNoise(image_size, 0, epsilon2_update, test_size);
Lnoise_empty = generateIdLMNoise(image_size, 0, epsilon2_update, L);
BenignLNoise = generateIdLMNoise(image_size, Delta2, epsilon2_update, L);
last_eval_time = -1
accum_time = 0
accum_epoch = 0
max_adv_acc_dict = {}
max_robust_adv_acc_dict = {}
#max_robust_adv_utility_dict = {}
for atk in attack_switch.keys():
if atk not in max_adv_acc_dict:
max_adv_acc_dict[atk] = -1
max_robust_adv_acc_dict[atk] = -1
for i in range(_global_step, _global_step + T):
# this batch is for generating adv samples
batch = mnist.train.next_batch(emsemble_L); #Get a random batch.
y_adv_batch = batch[1]
#The number of epochs we print out the result. Print out the result every 5 epochs.
if i % int(10*step_for_epoch) == 0 and i > int(10*step_for_epoch):
cost_value = sess.run(cost, feed_dict={adv_x:mnist.test.images, adv_noise: AdvLnoise_test, FM_h: perturbFM_h_test})/(test_size*32)
print(cost_value)
if last_eval_time < 0:
last_eval_time = time.time()
#===================benign samples=====================
predictions_form_argmax = np.zeros([test_size, 10])
#test_bach = mnist.test.next_batch(test_size)
softmax_predictions = softmax_y_conv.eval(feed_dict={x: mnist.test.images, noise: BenignLNoise, FM_h: perturbFM_h})
argmax_predictions = np.argmax(softmax_predictions, axis=1)
for n_draws in range(0, 1):
_BenignLNoise = generateIdLMNoise(image_size, Delta2, epsilon2_update, L);
_perturbFM_h = np.random.laplace(0.0, 2*Delta2/(epsilon2_update*L), 14*14*32)
_perturbFM_h = np.reshape(_perturbFM_h, [-1, 14, 14, 32]);
for j in range(test_size):
pred = argmax_predictions[j]
predictions_form_argmax[j, pred] += 1;
softmax_predictions = softmax_y_conv.eval(feed_dict={x: mnist.test.images, noise: (BenignLNoise + _BenignLNoise/2), FM_h: (perturbFM_h + _perturbFM_h/2)})
argmax_predictions = np.argmax(softmax_predictions, axis=1)
final_predictions = predictions_form_argmax;
is_correct = []
is_robust = []
for j in range(test_size):
is_correct.append(np.argmax(mnist.test.labels[j]) == np.argmax(final_predictions[j]))
robustness_from_argmax = robustness.robustness_size_argmax(counts=predictions_form_argmax[j],eta=0.05,dp_attack_size=fgsm_eps, dp_epsilon=1.0, dp_delta=0.05, dp_mechanism='laplace') * dp_mult
is_robust.append(robustness_from_argmax >= fgsm_eps)
acc = np.sum(is_correct)*1.0/test_size
robust_acc = np.sum([a and b for a,b in zip(is_robust, is_correct)])*1.0/np.sum(is_robust)
robust_utility = np.sum(is_robust)*1.0/test_size
max_benign_acc = max(max_benign_acc, acc)
max_robust_benign_acc = max(max_robust_benign_acc, robust_acc*robust_utility)
log_str = "step: {:.1f}\t epsilon: {:.1f}\t benign: {:.4f} \t {:.4f} \t {:.4f} \t {:.4f} \t".format(i, total_eps, acc, robust_acc, robust_utility, robust_acc*robust_utility)
#===================adv samples=====================
#log_str = "step: {:.1f}\t epsilon: {:.1f}\t".format(i, total_eps)
"""adv_images_dict = {}
for atk in attack_switch.keys():
if attack_switch[atk]:
adv_images_dict[atk] = sess.run(attack_tensor_dict[atk], feed_dict = {x:mnist.test.images, y_:mnist.test.labels})
print("Done with the generating of Adversarial samples")"""
#===================adv samples=====================
adv_acc_dict = {}
robust_adv_acc_dict = {}
robust_adv_utility_dict = {}
for atk in attack_switch.keys():
if atk not in adv_acc_dict:
adv_acc_dict[atk] = -1
robust_adv_acc_dict[atk] = -1
robust_adv_utility_dict[atk] = -1
if attack_switch[atk]:
adv_images_dict = sess.run(attack_tensor_dict[atk], feed_dict = {x:mnist.test.images, y_: mnist.test.labels, adv_noise: AdvLnoise_test, mu_alpha:[fgsm_eps]})
### PixelDP Robustness ###
predictions_form_argmax = np.zeros([test_size, 10])
softmax_predictions = softmax_y_conv.eval(feed_dict={x: adv_images_dict, noise: BenignLNoise, FM_h: perturbFM_h})
argmax_predictions = np.argmax(softmax_predictions, axis=1)
for n_draws in range(0, 2000):
if n_draws % 1000 == 0:
print(n_draws)
_BenignLNoise = generateIdLMNoise(image_size, Delta2, epsilon2_update, L);
_perturbFM_h = np.random.laplace(0.0, 2*Delta2/(epsilon2_update*L), 14*14*32)
_perturbFM_h = np.reshape(_perturbFM_h, [-1, 14, 14, 32]);
for j in range(test_size):
pred = argmax_predictions[j]
predictions_form_argmax[j, pred] += 1;
softmax_predictions = softmax_y_conv.eval(feed_dict={x: adv_images_dict, noise: BenignLNoise, FM_h: (perturbFM_h + _perturbFM_h/2)}) * softmax_y_conv.eval(feed_dict={x: adv_images_dict, noise: (BenignLNoise + _BenignLNoise/2), FM_h: perturbFM_h})
#softmax_predictions = softmax_y_conv.eval(feed_dict={x: adv_images_dict, noise: BenignLNoise, FM_h: (_perturbFM_h)}) * softmax_y_conv.eval(feed_dict={x: adv_images_dict, noise: (_BenignLNoise), FM_h: perturbFM_h})
argmax_predictions = np.argmax(softmax_predictions, axis=1)
final_predictions = predictions_form_argmax;
is_correct = []
is_robust = []
for j in range(test_size):
is_correct.append(np.argmax(mnist.test.labels[j]) == np.argmax(final_predictions[j]))
robustness_from_argmax = robustness.robustness_size_argmax(counts=predictions_form_argmax[j],eta=0.05,dp_attack_size=fgsm_eps, dp_epsilon=1.0, dp_delta=0.05, dp_mechanism='laplace') * dp_mult
is_robust.append(robustness_from_argmax >= fgsm_eps)
adv_acc_dict[atk] = np.sum(is_correct)*1.0/test_size
robust_adv_acc_dict[atk] = np.sum([a and b for a,b in zip(is_robust, is_correct)])*1.0/np.sum(is_robust)
robust_adv_utility_dict[atk] = np.sum(is_robust)*1.0/test_size
##############################
for atk in attack_switch.keys():
if attack_switch[atk]:
# added robust prediction
log_str += " {}: {:.4f} {:.4f} {:.4f} {:.4f}".format(atk, adv_acc_dict[atk], robust_adv_acc_dict[atk], robust_adv_utility_dict[atk], robust_adv_acc_dict[atk]*robust_adv_utility_dict[atk])
max_adv_acc_dict[atk] = max(max_adv_acc_dict[atk], adv_acc_dict[atk])
max_robust_adv_acc_dict[atk] = max(max_robust_adv_acc_dict[atk], robust_adv_acc_dict[atk]*robust_adv_utility_dict[atk])
print(log_str)
logfile.write(log_str + '\n')
# logfile.write("step \t %d \t %g \t %g \n"%(i, benign_acc, adv_acc))
# print("step \t %d \t %g \t %g"%(i, benign_acc, adv_acc));
# estimate end time
"""if i > 0 and i % int(10*step_for_epoch) == 0:
current_time_interval = time.time() - last_eval_time
last_eval_time = time.time()
print('during last eval interval, {} epoch takes {}'.format(10, parse_time(current_time_interval)))
accum_time += current_time_interval
accum_epoch += 10
estimate_time = ((_global_step + T - i) / step_for_epoch) * (accum_time / accum_epoch)
print('estimate finish in: {}'.format(parse_time(estimate_time)))"""
#print("step \t %d \t adversarial test accuracy \t %g"%(i, accuracy_x.eval(feed_dict={x: adv_images, y_: mnist.test.labels, noise: Lnoise_empty})));
"""checkpoint_path = os.path.join(os.getcwd() + '/tmp/train', 'model.ckpt')
saver.save(sess, checkpoint_path, global_step=i);"""
d_eps = random.random();
y_adv = batch[1]
adv_images = sess.run(attack_tensor_dict['ifgsm'], feed_dict = {x:batch[0], y_: batch[1], adv_noise: AdvLnoise, mu_alpha:[d_eps]})
"""for iter in range(0, 9):
adv_images = sess.run(x_adv, feed_dict = {x:adv_images, y_:batch[1], FM_h: perturbFM_h_test, dynamic_eps: d_eps})"""
batch = mnist.train.next_batch(emsemble_L)
adv_images_mim = sess.run(attack_tensor_dict['mim'], feed_dict = {x:batch[0], y_: batch[1], adv_noise: AdvLnoise, mu_alpha:[d_eps]})
y_adv = np.append(y_adv, batch[1], axis = 0)
batch = mnist.train.next_batch(emsemble_L)
adv_images_madry = sess.run(attack_tensor_dict['madry'], feed_dict = {x:batch[0], y_: batch[1], adv_noise: AdvLnoise, mu_alpha:[d_eps]})
y_adv = np.append(y_adv, batch[1], axis = 0)
train_images = np.append(np.append(adv_images, adv_images_mim, axis = 0),adv_images_madry, axis = 0)
batch = mnist.train.next_batch(L); #Get a random batch.
# train with benign and adv samples
pretrain_step.run(feed_dict={adv_x: train_images, x: batch[0], adv_noise: AdvLnoise_test, noise: BenignLNoise, FM_h: perturbFM_h});
train_step.run(feed_dict={x: batch[0], adv_x: train_images, y_: batch[1], adv_y_: y_adv, noise: BenignLNoise, adv_noise: AdvLnoise_test, FM_h: perturbFM_h});
duration = time.time() - start_time;
# print(parse_time(duration)); #print running time duration#
max_acc_string = "max acc: benign: \t{:.4f} {:.4f}".format(max_benign_acc, max_robust_benign_acc)
for atk in attack_switch.keys():
if attack_switch[atk]:
max_acc_string += " {}: \t{:.4f} {:.4f}".format(atk, max_adv_acc_dict[atk], max_robust_adv_acc_dict[atk])
logfile.write(max_acc_string + '\n')
logfile.write(str(duration) + '\n')
# logfile.write("max accuracy \t %g \t %g \n"%(max_benign_acc, max_adv_acc))
# logfile.write(str(float(duration)) + '\n')
# send email
#send_email(subject="Training of epsilon = {} is done in {}".format(total_eps, parse_time(duration)), content=max_acc_string)
def main(_):
#logfile = open('./tmp/results/DPAL_PixelDP_run1_1.txt','w')
LR = 1e-4; #learning rate
for fgsm_eps in [5, 10, 20, 30, 40, 50, 60]:
for gen_ratio in [0]: #[0, 8]: #range(0, 20, 2):
for alpha in [1.0]:# fix
for eps2_ratio in [1]:# fix
logfile = open('./tmp/results/StoBatch' + str(fgsm_eps) + '_eps_' + str(0.1*(1 + gen_ratio) + 0.1) + '.txt','w')
train(alpha, eps2_ratio, gen_ratio, (fgsm_eps*1.0)/100.0, LR, logfile)
logfile.flush()
logfile.close();
if __name__ == '__main__':
logging.basicConfig(level=logging.ERROR)
if tf.gfile.Exists('./tmp/mnist_logs'):
tf.gfile.DeleteRecursively('./tmp/mnist_logs');
tf.gfile.MakeDirs('./tmp/mnist_logs');
parser = argparse.ArgumentParser();
parser.add_argument('--data_dir', type=str, default='./tmp/data',
help='Directory for storing data');
FLAGS = parser.parse_args();
tf.app.run();
|
/-
Copyright (c) 2019 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Mario Carneiro
-/
import Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.data.rat.order
import Mathlib.data.int.sqrt
import Mathlib.PostPort
namespace Mathlib
/-!
# Square root on rational numbers
This file defines the square root function on rational numbers, `rat.sqrt` and proves several theorems about it.
-/
namespace rat
/-- Square root function on rational numbers, defined by taking the (integer) square root of the
numerator and the square root (on natural numbers) of the denominator. -/
def sqrt (q : ℚ) : ℚ := mk (int.sqrt (num q)) ↑(nat.sqrt (denom q))
theorem sqrt_eq (q : ℚ) : sqrt (q * q) = abs q := sorry
theorem exists_mul_self (x : ℚ) : (∃ (q : ℚ), q * q = x) ↔ sqrt x * sqrt x = x := sorry
theorem sqrt_nonneg (q : ℚ) : 0 ≤ sqrt q := sorry
end Mathlib |
[STATEMENT]
lemma (in linorder) iterate_sel_no_map_linord_correct :
assumes it_OK: "set_iterator_linord it S0"
shows "iterate_sel_no_map it P = None \<longleftrightarrow> (\<forall>x\<in>S0. \<not>(P x))"
"iterate_sel_no_map it P = Some x \<Longrightarrow> (x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x) &&& (iterate_sel_no_map it P = Some x \<Longrightarrow> x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x'))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x)
2. iterate_sel_no_map it P = Some x \<Longrightarrow> x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x')
[PROOF STEP]
note iterate_sel_no_map_genord_correct [OF it_OK[unfolded set_iterator_linord_def], of P]
[PROOF STATE]
proof (state)
this:
(iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x)
iterate_sel_no_map it P = Some ?x \<Longrightarrow> ?x \<in> S0 \<and> P ?x \<and> (\<forall>x'\<in>S0 - {?x}. P x' \<longrightarrow> ?x \<le> x')
goal (2 subgoals):
1. (iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x)
2. iterate_sel_no_map it P = Some x \<Longrightarrow> x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x')
[PROOF STEP]
thus "iterate_sel_no_map it P = None \<longleftrightarrow> (\<forall>x\<in>S0. \<not>(P x))"
"iterate_sel_no_map it P = Some x \<Longrightarrow> (x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x'))"
[PROOF STATE]
proof (prove)
using this:
(iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x)
iterate_sel_no_map it P = Some ?x \<Longrightarrow> ?x \<in> S0 \<and> P ?x \<and> (\<forall>x'\<in>S0 - {?x}. P x' \<longrightarrow> ?x \<le> x')
goal (1 subgoal):
1. (iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x) &&& (iterate_sel_no_map it P = Some x \<Longrightarrow> x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(iterate_sel_no_map it P = None) = (\<forall>x\<in>S0. \<not> P x)
iterate_sel_no_map it P = Some x \<Longrightarrow> x \<in> S0 \<and> P x \<and> (\<forall>x'\<in>S0. P x' \<longrightarrow> x \<le> x')
goal:
No subgoals!
[PROOF STEP]
qed |
If $f$ and $g$ are functions that agree on a set $T$ containing all points of $S$ except $a$, then $f$ converges to $x$ at $a$ within $S$ if and only if $g$ converges to $y$ at $b$ within $T$. |
[STATEMENT]
lemma Diagonalize_Tensor_Arr_Unity [simp]:
assumes "Arr t"
shows "\<^bold>\<lfloor>t \<^bold>\<otimes> \<^bold>\<I>\<^bold>\<rfloor> = \<^bold>\<lfloor>t\<^bold>\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<^bold>\<lfloor>t \<^bold>\<otimes> \<^bold>\<I>\<^bold>\<rfloor> = \<^bold>\<lfloor>t\<^bold>\<rfloor>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Arr t
goal (1 subgoal):
1. \<^bold>\<lfloor>t \<^bold>\<otimes> \<^bold>\<I>\<^bold>\<rfloor> = \<^bold>\<lfloor>t\<^bold>\<rfloor>
[PROOF STEP]
by simp |
Require Import ZArith Omega Znumtheory.
Require Import Coq.micromega.Lia.
(** * Contains some useful lemmas not in stdlib and a tactic *)
(** A convenient and simple tactic to prove 0<x or 0<>x *)
Lemma Zmult_neq_0_compat : forall a b, 0 <> a -> 0 <> b -> 0 <> a * b.
Proof.
intros [] [] P Q I; simpl in *;
inversion I; tauto.
Qed.
Lemma Zmult_le_1_compat : forall a b, 1 <= a -> 1 <= b -> 1 <= a * b.
Proof.
intros a b.
replace a with (1 + (a - 1)) by omega.
replace b with (1 + (b - 1)) by omega.
generalize (a - 1).
generalize (b - 1).
intros c d.
intros.
assert (0 <= c) by omega.
assert (0 <= d) by omega.
ring_simplify.
assert (0 <= d * c) by auto with *.
omega.
Qed.
Lemma Zsquare_pos : forall x, 0 <> x -> 0 < x * x.
Proof.
intros [] E; simpl; reflexivity || tauto.
Qed.
Ltac notzero :=
lazymatch goal with
| |- ?a <> 0 => apply not_eq_sym; notzero
| |- ?a > 0 => cut (0 < a); [ apply Zcompare_Gt_Lt_antisym | ]; notzero
| |- 0 < ?a * ?a => apply Zsquare_pos; notzero
| |- 0 < ?a ^ 2 => replace (a ^ 2) with (a * a) by ring; notzero
| |- 0 < ?a * ?b => apply Zmult_lt_0_compat; notzero
| |- 0 <> ?a * ?b => apply Zmult_neq_0_compat; notzero
| |- 0 < Zpos _ => reflexivity
| |- 0 > Zneg _ => reflexivity
| |- 0 <> Zpos _ => let I := fresh "I" in intros I; inversion I
| |- 0 <> Zneg _ => let I := fresh "I" in intros I; inversion I
| Pp : prime ?p |- 0 < ?p => pose proof prime_ge_2 p Pp; lia
| Pp : prime ?p |- 0 <> ?p => pose proof prime_ge_2 p Pp; lia
| Pp : prime ?p |- 1 <> ?p => pose proof prime_ge_2 p Pp; lia
| Pp : prime ?p |- ?p <> 0 => pose proof prime_ge_2 p Pp; lia
| Pp : prime ?p |- ?p <> 1 => pose proof prime_ge_2 p Pp; lia
| Pp : prime ?p |- ?p > 0 => pose proof prime_ge_2 p Pp; lia
| |- 0 < _ => auto with *; try (zify; omega)
| |- 0 <> _ => auto with *; try (zify; omega)
| |- _ => idtac
end.
(** Subsumed by tactic [notzero] but also useful, since it shows up in
Search *)
Lemma prime_not_0 p : prime p -> p <> 0.
Proof.
intro; notzero.
Qed.
Lemma prime_not_1 p : prime p -> p <> 1.
Proof.
intro; notzero.
Qed.
(** Extraction from the Zdivide predicate *)
Lemma Zdivide_inf : forall a b, (a | b) -> { q | b = q * a }.
Proof.
intros a b D.
exists (b / a).
rewrite Zmult_comm.
destruct (Z.eq_dec a 0).
subst; destruct D; omega.
apply Z_div_exact_full_2; auto with *.
apply Zdivide_mod; auto.
Defined.
(** About Zmod or Zdiv *)
Lemma Z_mult_div_mod : forall a b, b <> 0 -> b * (a / b) = a - a mod b.
Proof.
intros a b N.
pose proof Z_div_mod_eq_full a b N; omega.
Qed.
Lemma Zdivide_square : forall a b, (a | b) -> (a * a | b * b).
Proof.
intros a b (k, Ek).
exists (k * k); subst; ring.
Qed.
Lemma Zmult_divide_compat_rev_l: forall a b c : Z, c <> 0 -> (c * a | c * b) -> (a | b).
Proof.
intros a b c Nc (k, Hk).
exists k.
eapply Zmult_reg_l; eauto.
rewrite Hk; ring.
Qed.
Lemma Z_mult_div_bounds : forall a b, 0 < b -> a - b < b * (a / b) <= a.
Proof.
intros a b N; split.
pose proof Z_mod_lt a b.
rewrite Z_mult_div_mod; omega.
apply Z_mult_div_ge; omega.
Qed.
(** About square *)
Lemma Zle_0_square : forall a, 0 <= a * a.
Proof.
intros []; intuition.
simpl; intro H; inversion H.
Qed.
Lemma Zeq_0_square : forall a, a * a = 0 -> a = 0.
Proof.
intros [] H; intuition simpl; inversion H.
Qed.
Lemma rewrite_power_2 : forall x, x ^ 2 = x * x.
Proof.
(* TODO virer ça .. ? *)
intros; ring.
Qed.
Lemma sqrt_eq_compat : forall a b, 0 <= a -> 0 <= b ->
a * a = b * b -> a = b.
Proof.
intros a b Pa Pb E.
destruct (Z.eq_dec 0 (a + b)) as [F|F].
omega.
cut (a - b = 0); [ omega | ].
apply (Zmult_reg_l _ _ (a + b)); notzero.
ring_simplify.
rewrite rewrite_power_2, E.
ring.
Qed.
Lemma sqrt_eq_compat_abs : forall a b, a * a = b * b -> Z.abs a = Z.abs b.
Proof.
intros a b E.
destruct (Z.eq_dec 0 (Z.abs a + Z.abs b)) as [F|F].
zify; omega.
cut (Z.abs a - Z.abs b = 0); [ omega | ].
apply (Zmult_reg_l _ _ (Z.abs a + Z.abs b)); notzero.
ring_simplify.
rewrite <- Z.abs_square, <- (Z.abs_square b) in E.
rewrite rewrite_power_2, E.
ring.
Qed.
Lemma sqrt_le_compat : forall a b, 0 <= a -> 0 <= b ->
a * a <= b * b -> a <= b.
Proof.
intros a b Pa Pb E.
destruct (Z.eq_dec 0 (a + b)) as [F|F].
omega.
cut (0 <= b - a); [ omega | ].
apply Zmult_le_reg_r with (a + b); notzero.
ring_simplify.
do 2 rewrite rewrite_power_2; omega.
Qed.
(** About Z.abs *)
Lemma Zabs_nat_inj : forall a b, 0 <= a -> 0 <= b -> Z.abs_nat a = Z.abs_nat b -> a = b.
Proof.
intros a b Pa Pb E.
rewrite <- (Z.abs_eq a), <- (Z.abs_eq b); eauto.
do 2 rewrite <- inj_Zabs_nat.
auto.
Qed.
(* TODO (prouver et déplacer) ou virer *)
Lemma Zdivide_square_rev : forall a b, (a * a | b * b) -> (a | b).
Proof.
intros a b D.
destruct (Z.eq_dec a 0).
subst; simpl in D.
destruct D as (q, Hq); ring_simplify (q * 0) in Hq.
destruct b; inversion Hq.
exists 0; ring.
exists (b / a).
rewrite Zmult_comm, Z_mult_div_mod; auto.
(* TODO déplacer et prouver : inutilisé mais intéressant.
un peu intéressant, c'est dur environ comme sqrt(n)∈Q => sqrt(n)∈N *)
Abort.
Lemma Zpow_mod (a b m : Z) : (a ^ b) mod m = ((a mod m) ^ b) mod m.
Proof.
assert (b < 0 \/ 0 <= b) as [bz | bz] by lia.
- rewrite 2 Z.pow_neg_r; auto.
- rewrite <-(Z2Nat.id b); auto.
rewrite <-2Zpower_nat_Z.
generalize (Z.to_nat b); intros n. clear b bz.
destruct (Z.eq_dec m 0).
+ subst. now rewrite !Zmod_0_r.
+ induction n. easy. simpl.
rewrite Z.mul_mod, IHn, Z.mul_mod_idemp_r; auto.
Qed.
(* When we already have a proof [pr] of [P] and the goal is [Q], it is
enough to prove [P = Q] *)
Ltac exact_eq pr :=
generalize pr;
let A := fresh in
assert (A : forall P Q : Prop, P = Q -> P -> Q) by congruence;
apply A; clear A.
(* If [H] is a hypothesis of the form [P -> Q], assert a proof of [P]
and remove the [P ->] from [H] *)
Tactic Notation "spec" hyp(H) :=
match type of H with
| ?P -> _ =>
let h := fresh in
assert (h : P); [ | specialize (H h); clear h ]
end.
Tactic Notation "spec" hyp(H) "by" tactic(t) :=
match type of H with
| ?P -> _ =>
let h := fresh in
assert (h : P) by t;
specialize (H h); clear h
end.
|
If $X$ is a countable set and $M$ is a measure space such that each point in $X$ has measure zero, then almost every point in $M$ is not in $X$. |
import Std
inductive Expr where
| var (i : Nat)
| op (lhs rhs : Expr)
deriving Inhabited, Repr
def List.getIdx : List α → Nat → α → α
| [], i, u => u
| a::as, 0, u => a
| a::as, i+1, u => getIdx as i u
structure Context (α : Type u) where
op : α → α → α
unit : α
assoc : (a b c : α) → op (op a b) c = op a (op b c)
comm : (a b : α) → op a b = op b a
vars : List α
theorem Context.left_comm (ctx : Context α) (a b c : α) : ctx.op a (ctx.op b c) = ctx.op b (ctx.op a c) := by
rw [← ctx.assoc, ctx.comm a b, ctx.assoc]
def Expr.denote (ctx : Context α) : Expr → α
| Expr.op a b => ctx.op (denote ctx a) (denote ctx b)
| Expr.var i => ctx.vars.getIdx i ctx.unit
theorem Expr.denote_op (ctx : Context α) (a b : Expr) : denote ctx (Expr.op a b) = ctx.op (denote ctx a) (denote ctx b) :=
rfl
def Expr.length : Expr → Nat
| op a b => 1 + b.length
| _ => 1
def Expr.sort (e : Expr) : Expr :=
loop e.length e
where
loop : Nat → Expr → Expr
| fuel+1, Expr.op a e =>
let (e₁, e₂) := swap a e
Expr.op e₁ (loop fuel e₂)
| _, e => e
swap : Expr → Expr → Expr × Expr
| Expr.var i, Expr.op (Expr.var j) e =>
if i > j then
let (e₁, e₂) := swap (Expr.var j) e
(e₁, Expr.op (Expr.var i) e₂)
else
let (e₁, e₂) := swap (Expr.var i) e
(e₁, Expr.op (Expr.var j) e₂)
| Expr.var i, Expr.var j =>
if i > j then
(Expr.var j, Expr.var i)
else
(Expr.var i, Expr.var j)
| e₁, e₂ => (e₁, e₂)
theorem Expr.denote_swap (ctx : Context α) (e₁ e₂ : Expr) : denote ctx (Expr.op (sort.swap e₁ e₂).1 (sort.swap e₁ e₂).2) = denote ctx (Expr.op e₁ e₂) := by
induction e₂ generalizing e₁ with
| op a b ih' ih =>
cases e₁ with
| var i =>
have ih' := ih (var i)
match h:sort.swap (var i) b with
| (r₁, r₂) =>
rw [denote_op _ (var i)] at ih'
admit
| _ => admit
| _ => admit
|
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_TR1_MEMORY_HPP_INCLUDED
# define BOOST_TR1_MEMORY_HPP_INCLUDED
# include <boost/tr1/detail/config.hpp>
# include <boost/detail/workaround.hpp>
# include <memory>
#ifndef BOOST_HAS_TR1_SHARED_PTR
//
// This header can get included by boost/shared_ptr.hpp which leads
// to cyclic dependencies, the workaround is to forward declare all
// the boost components, and then include the actual headers afterwards.
// This is fragile, but seems to work, and doesn't require modification
// of boost/shared_ptr.hpp.
//
namespace boost{
class bad_weak_ptr;
template<class T> class weak_ptr;
template<class T> class shared_ptr;
template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b);
template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b);
template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r);
template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r);
template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r);
template<class D, class T> D * get_deleter(shared_ptr<T> const & p);
template<class T> class enable_shared_from_this;
namespace detail{
class shared_count;
class weak_count;
}
}
namespace std{ namespace tr1{
using ::boost::bad_weak_ptr;
using ::boost::shared_ptr;
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
using ::boost::swap;
#endif
using ::boost::static_pointer_cast;
using ::boost::dynamic_pointer_cast;
using ::boost::const_pointer_cast;
using ::boost::get_deleter;
using ::boost::weak_ptr;
using ::boost::enable_shared_from_this;
} }
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#else
# ifdef BOOST_HAS_INCLUDE_NEXT
# include_next BOOST_TR1_HEADER(memory)
# else
# include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(memory))
# endif
#endif
#endif
|
[STATEMENT]
lemma s_cond_def:
"t \<le> 0 \<Longrightarrow> s t = s0"
"0 \<le> t \<Longrightarrow> t \<le> t_stop \<Longrightarrow> s t = p t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (t \<le> 0 \<Longrightarrow> s t = s0) &&& (\<lbrakk>0 \<le> t; t \<le> t_stop\<rbrakk> \<Longrightarrow> s t = p t)
[PROOF STEP]
by (simp_all add: s_def) |
using Pkg
Pkg.activate(joinpath(@__DIR__, ".."))
using Pluto, MLCourse, MLJ, MLJLinearModels, StatsPlots, DataFrames,
Distributions
X, y = make_regression()
mach = fit!(machine(LinearRegressor(), X, y), verbosity = 0)
predict(mach)
plot(rand(10), rand(10))
df = DataFrame(a = rand(10), b = rand(10))
@df df scatter(:a, :b)
rand(Bernoulli(.4))
redirect_stdout(Pipe()) do
session = Pluto.ServerSession()
session.options.server.port = 40404
session.options.server.launch_browser = false
session.options.security.require_secret_for_access = false
path = tempname()
original = joinpath(@__DIR__, "..", "index.jl")
# so that we don't overwrite the file:
Pluto.readwrite(original, path)
# @info "Loading notebook"
nb = Pluto.load_notebook(Pluto.tamepath(path));
session.notebooks[nb.notebook_id] = nb;
# @info "Running notebook"
Pluto.update_save_run!(session, nb, nb.cells; run_async=false, prerender_text=true)
# nice! we ran the notebook, so we already precompiled a lot
# @info "Starting HTTP server"
# next, we'll run the HTTP server which needs a bit of nasty code
t = @async Pluto.run(session)
sleep(5)
# download("http://localhost:40404/")
# this is async because it blocks for some reason
@async Base.throwto(t, InterruptException())
sleep(2) # i am pulling these numbers out of thin air
end
@info "Warmup done"
|
chapter \<open>VT-Comp Library Setup\<close>
theory VTcomp
imports
Array_Map_Default
Dynamic_Array
(*Impl_List_Set_Ndj*)
Synth_Definition
Exc_Nres_Monad
begin
(* TODO: Move these stuff to AFP! *)
no_notation Ref.lookup ("!_" 61)
no_notation Ref.update ("_ := _" 62)
section \<open>Extra Stuff\<close>
text \<open>We added this stuff as preparation for the competition. \<close>
subsection \<open>Specialized Rules for Foreach Loops\<close>
lemma nfoldli_upt_rule:
assumes INTV: "lb\<le>ub"
assumes I0: "I lb \<sigma>0"
assumes IS: "\<And>i \<sigma>. \<lbrakk> lb\<le>i; i<ub; I i \<sigma>; c \<sigma> \<rbrakk> \<Longrightarrow> f i \<sigma> \<le> SPEC (I (i+1))"
assumes FNC: "\<And>i \<sigma>. \<lbrakk> lb\<le>i; i\<le>ub; I i \<sigma>; \<not>c \<sigma> \<rbrakk> \<Longrightarrow> P \<sigma>"
assumes FC: "\<And>\<sigma>. \<lbrakk> I ub \<sigma>; c \<sigma> \<rbrakk> \<Longrightarrow> P \<sigma>"
shows "nfoldli [lb..<ub] c f \<sigma>0 \<le> SPEC P"
apply (rule nfoldli_rule[where I="\<lambda>l _ \<sigma>. I (lb+length l) \<sigma>"])
apply simp_all
apply (simp add: I0)
subgoal using IS
by (metis Suc_eq_plus1 add_diff_cancel_left' eq_diff_iff le_add1 length_upt upt_eq_lel_conv)
subgoal for l1 l2 \<sigma>
apply (rule FNC[where i="lb + length l1"])
apply (auto simp: INTV)
using INTV upt_eq_append_conv by auto
apply (rule FC) using INTV
by auto
definition [enres_unfolds]: "efor (lb::int) ub f \<sigma> \<equiv> doE {
EASSERT (lb\<le>ub);
(_,\<sigma>) \<leftarrow> EWHILET (\<lambda>(i,\<sigma>). i<ub) (\<lambda>(i,\<sigma>). doE { \<sigma> \<leftarrow> f i \<sigma>; ERETURN (i+1,\<sigma>) }) (lb,\<sigma>);
ERETURN \<sigma>
}"
lemma efor_rule:
assumes INTV: "lb\<le>ub"
assumes I0: "I lb \<sigma>0"
assumes IS: "\<And>i \<sigma>. \<lbrakk> lb\<le>i; i<ub; I i \<sigma> \<rbrakk> \<Longrightarrow> f i \<sigma> \<le> ESPEC E (I (i+1))"
assumes FC: "\<And>\<sigma>. \<lbrakk> I ub \<sigma> \<rbrakk> \<Longrightarrow> P \<sigma>"
shows "efor lb ub f \<sigma>0 \<le> ESPEC E P"
unfolding efor_def
supply EWHILET_rule[where R="measure (\<lambda>(i,_). nat (ub-i))" and I="\<lambda>(i,\<sigma>). lb\<le>i \<and> i\<le>ub \<and> I i \<sigma>", refine_vcg]
apply refine_vcg
apply auto
using assms apply auto
done
subsection \<open>Nicer do-notation for the nres-monad\<close>
abbreviation (do_notation) bind_doN where "bind_doN \<equiv> Refine_Basic.bind"
notation (output) bind_doN (infixl "\<bind>" 54)
notation (ASCII output) bind_doN (infixl ">>=" 54)
nonterminal doN_binds and doN_bind
syntax
"_doN_block" :: "doN_binds \<Rightarrow> 'a" ("doN {//(2 _)//}" [12] 62)
"_doN_bind" :: "[pttrn, 'a] \<Rightarrow> doN_bind" ("(2_ \<leftarrow>/ _)" 13)
"_doN_let" :: "[pttrn, 'a] \<Rightarrow> doN_bind" ("(2let _ =/ _)" [1000, 13] 13)
"_doN_then" :: "'a \<Rightarrow> doN_bind" ("_" [14] 13)
"_doN_final" :: "'a \<Rightarrow> doN_binds" ("_")
"_doN_cons" :: "[doN_bind, doN_binds] \<Rightarrow> doN_binds" ("_;//_" [13, 12] 12)
"_thenM" :: "['a, 'b] \<Rightarrow> 'c" (infixl "\<then>" 54)
syntax (ASCII)
"_doN_bind" :: "[pttrn, 'a] \<Rightarrow> doN_bind" ("(2_ <-/ _)" 13)
"_thenM" :: "['a, 'b] \<Rightarrow> 'c" (infixl ">>" 54)
translations
"_doN_block (_doN_cons (_doN_then t) (_doN_final e))"
\<rightleftharpoons> "CONST bind_doN t (\<lambda>_. e)"
"_doN_block (_doN_cons (_doN_bind p t) (_doN_final e))"
\<rightleftharpoons> "CONST bind_doN t (\<lambda>p. e)"
"_doN_block (_doN_cons (_doN_let p t) bs)"
\<rightleftharpoons> "let p = t in _doN_block bs"
"_doN_block (_doN_cons b (_doN_cons c cs))"
\<rightleftharpoons> "_doN_block (_doN_cons b (_doN_final (_doN_block (_doN_cons c cs))))"
"_doN_cons (_doN_let p t) (_doN_final s)"
\<rightleftharpoons> "_doN_final (let p = t in s)"
"_doN_block (_doN_final e)" \<rightharpoonup> "e"
"(m \<then> n)" \<rightharpoonup> "(m \<bind> (\<lambda>_. n))"
subsection \<open>Array Blit exposed to Sepref (Added after Competition)\<close>
definition "op_list_blit src si dst di len \<equiv>
(take di dst @ take len (drop si src) @ drop (di+len) dst)"
context
notes op_list_blit_def[simp]
begin
sepref_decl_op (no_def) list_blit :
"op_list_blit"
:: "[\<lambda>((((src,si),dst),di),len). si+len \<le> length src \<and> di+len \<le> length dst]\<^sub>f
((((\<langle>A\<rangle>list_rel \<times>\<^sub>r nat_rel) \<times>\<^sub>r \<langle>A\<rangle>list_rel) \<times>\<^sub>r nat_rel) \<times>\<^sub>r nat_rel) \<rightarrow> \<langle>A\<rangle>list_rel" .
end
lemma blit_len[simp]: "si + len \<le> length src \<and> di + len \<le> length dst
\<Longrightarrow> length (op_list_blit src si dst di len) = length dst"
by (auto simp: op_list_blit_def)
context
notes [fcomp_norm_unfold] = array_assn_def[symmetric]
begin
lemma array_blit_hnr_aux:
"(uncurry4 (\<lambda>src si dst di len. do { blit src si dst di len; return dst }),
uncurry4 mop_list_blit)
\<in> is_array\<^sup>k*\<^sub>anat_assn\<^sup>k*\<^sub>ais_array\<^sup>d*\<^sub>anat_assn\<^sup>k*\<^sub>anat_assn\<^sup>k \<rightarrow>\<^sub>a is_array"
apply sepref_to_hoare
apply (clarsimp simp: refine_pw_simps)
apply (sep_auto simp: is_array_def op_list_blit_def)
done
sepref_decl_impl (ismop) array_blit: array_blit_hnr_aux .
end
end
|
# --------------------------------------------------------
# TRIPLET LOSS
# Copyright (c) 2015 Pinguo Tech.
# Written by David Lu
# --------------------------------------------------------
"""Blob helper functions."""
import numpy as np
import cv2
def im_list_to_blob(ims):
"""Convert a list of images into a network input.
Assumes images are already prepared (means subtracted, BGR order, ...).
"""
max_shape = np.array([im.shape for im in ims]).max(axis=0)
num_images = len(ims)
blob = np.zeros((num_images, max_shape[0], max_shape[1], 3),
dtype=np.float32)
for i in xrange(num_images):
im = ims[i]
blob[i, 0:im.shape[0], 0:im.shape[1], :] = im
channel_swap = (0, 3, 1, 2)
blob = blob.transpose(channel_swap)
return blob
def prep_im_for_blob(im):
target_size = 224
pixel_means = np.array([[[102.9801, 115.9465, 122.7717]]])
im = im.astype(np.float32, copy=False)
im -= pixel_means
im = cv2.resize(im, (224,224),
interpolation=cv2.INTER_LINEAR)
return im
|
function y = wmean(x, w)
%WMEAN Weighted average or mean value.
%
% Description
% WMEAN(X,W) is the weighted mean value of the elements in X
% (along first dimension) given weights W.
%
% See also wprctile
%
% Copyright (c) 2000-2013 Aki Vehtari
% This software is distributed under the GNU General Public
% License (version 3 or later); please refer to the file
% License.txt, included with the software, for details.
y=sum(bsxfun(@times,x,w),1);
|
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
(** This file is deprecated, for a tree on list, use [Mergesort.v]. *)
(** A development of Treesort on Heap trees. It has an average
complexity of O(n.log n) but of O(n²) in the worst case (e.g. if
the list is already sorted) *)
(* G. Huet 1-9-95 uses Multiset *)
Require Import List Multiset PermutSetoid Relations Sorting.
Section defs.
(** * Trees and heap trees *)
(** ** Definition of trees over an ordered set *)
Variable A : Type.
Variable leA : relation A.
Variable eqA : relation A.
Let gtA (x y:A) := ~ leA x y.
Hypothesis leA_dec : forall x y:A, {leA x y} + {leA y x}.
Hypothesis eqA_dec : forall x y:A, {eqA x y} + {~ eqA x y}.
Hypothesis leA_refl : forall x y:A, eqA x y -> leA x y.
Hypothesis leA_trans : forall x y z:A, leA x y -> leA y z -> leA x z.
Hypothesis leA_antisym : forall x y:A, leA x y -> leA y x -> eqA x y.
Hint Resolve leA_refl.
Hint Immediate eqA_dec leA_dec leA_antisym.
Let emptyBag := EmptyBag A.
Let singletonBag := SingletonBag _ eqA_dec.
Inductive Tree :=
| Tree_Leaf : Tree
| Tree_Node : A -> Tree -> Tree -> Tree.
(** [a] is lower than a Tree [T] if [T] is a Leaf
or [T] is a Node holding [b>a] *)
Definition leA_Tree (a:A) (t:Tree) :=
match t with
| Tree_Leaf => True
| Tree_Node b T1 T2 => leA a b
end.
Lemma leA_Tree_Leaf : forall a:A, leA_Tree a Tree_Leaf.
Proof.
simpl; auto with datatypes.
Qed.
Lemma leA_Tree_Node :
forall (a b:A) (G D:Tree), leA a b -> leA_Tree a (Tree_Node b G D).
Proof.
simpl; auto with datatypes.
Qed.
(** ** The heap property *)
Inductive is_heap : Tree -> Prop :=
| nil_is_heap : is_heap Tree_Leaf
| node_is_heap :
forall (a:A) (T1 T2:Tree),
leA_Tree a T1 ->
leA_Tree a T2 ->
is_heap T1 -> is_heap T2 -> is_heap (Tree_Node a T1 T2).
Lemma invert_heap :
forall (a:A) (T1 T2:Tree),
is_heap (Tree_Node a T1 T2) ->
leA_Tree a T1 /\ leA_Tree a T2 /\ is_heap T1 /\ is_heap T2.
Proof.
intros; inversion H; auto with datatypes.
Qed.
(* This lemma ought to be generated automatically by the Inversion tools *)
Lemma is_heap_rect :
forall P:Tree -> Type,
P Tree_Leaf ->
(forall (a:A) (T1 T2:Tree),
leA_Tree a T1 ->
leA_Tree a T2 ->
is_heap T1 -> P T1 -> is_heap T2 -> P T2 -> P (Tree_Node a T1 T2)) ->
forall T:Tree, is_heap T -> P T.
Proof.
simple induction T; auto with datatypes.
intros a G PG D PD PN.
elim (invert_heap a G D); auto with datatypes.
intros H1 H2; elim H2; intros H3 H4; elim H4; intros.
apply X0; auto with datatypes.
Qed.
(* This lemma ought to be generated automatically by the Inversion tools *)
Lemma is_heap_rec :
forall P:Tree -> Set,
P Tree_Leaf ->
(forall (a:A) (T1 T2:Tree),
leA_Tree a T1 ->
leA_Tree a T2 ->
is_heap T1 -> P T1 -> is_heap T2 -> P T2 -> P (Tree_Node a T1 T2)) ->
forall T:Tree, is_heap T -> P T.
Proof.
simple induction T; auto with datatypes.
intros a G PG D PD PN.
elim (invert_heap a G D); auto with datatypes.
intros H1 H2; elim H2; intros H3 H4; elim H4; intros.
apply X; auto with datatypes.
Qed.
Lemma low_trans :
forall (T:Tree) (a b:A), leA a b -> leA_Tree b T -> leA_Tree a T.
Proof.
simple induction T; auto with datatypes.
intros; simpl; apply leA_trans with b; auto with datatypes.
Qed.
(** ** Merging two sorted lists *)
Inductive merge_lem (l1 l2:list A) : Type :=
merge_exist :
forall l:list A,
Sorted leA l ->
meq (list_contents _ eqA_dec l)
(munion (list_contents _ eqA_dec l1) (list_contents _ eqA_dec l2)) ->
(forall a, HdRel leA a l1 -> HdRel leA a l2 -> HdRel leA a l) ->
merge_lem l1 l2.
Import Morphisms.
Instance: Equivalence (@meq A).
Proof. constructor; auto with datatypes. red. apply meq_trans. Defined.
Instance: Proper (@meq A ++> @meq _ ++> @meq _) (@munion A).
Proof. intros x y H x' y' H'. now apply meq_congr. Qed.
Lemma merge :
forall l1:list A, Sorted leA l1 ->
forall l2:list A, Sorted leA l2 -> merge_lem l1 l2.
Proof.
fix merge 1; intros; destruct l1.
apply merge_exist with l2; auto with datatypes.
rename l1 into l.
revert l2 H0. fix merge0 1. intros.
destruct l2 as [|a0 l0].
apply merge_exist with (a :: l); simpl; auto with datatypes.
induction (leA_dec a a0) as [Hle|Hle].
(* 1 (leA a a0) *)
apply Sorted_inv in H. destruct H.
destruct (merge l H (a0 :: l0) H0) as [l1 H2 H3 H4].
apply merge_exist with (a :: l1). clear merge merge0.
auto using cons_sort, cons_leA with datatypes.
simpl. rewrite H3. now rewrite munion_ass.
intros. apply cons_leA.
apply (@HdRel_inv _ leA) with l; trivial with datatypes.
(* 2 (leA a0 a) *)
apply Sorted_inv in H0. destruct H0.
destruct (merge0 l0 H0) as [l1 H2 H3 H4]. clear merge merge0.
apply merge_exist with (a0 :: l1);
auto using cons_sort, cons_leA with datatypes.
simpl; rewrite H3. simpl. setoid_rewrite munion_ass at 1. rewrite munion_comm.
repeat rewrite munion_ass. setoid_rewrite munion_comm at 3. reflexivity.
intros. apply cons_leA.
apply (@HdRel_inv _ leA) with l0; trivial with datatypes.
Qed.
(** ** From trees to multisets *)
(** contents of a tree as a multiset *)
(** Nota Bene : In what follows the definition of SingletonBag
in not used. Actually, we could just take as postulate:
[Parameter SingletonBag : A->multiset]. *)
Fixpoint contents (t:Tree) : multiset A :=
match t with
| Tree_Leaf => emptyBag
| Tree_Node a t1 t2 =>
munion (contents t1) (munion (contents t2) (singletonBag a))
end.
(** equivalence of two trees is equality of corresponding multisets *)
Definition equiv_Tree (t1 t2:Tree) := meq (contents t1) (contents t2).
(** * From lists to sorted lists *)
(** ** Specification of heap insertion *)
Inductive insert_spec (a:A) (T:Tree) : Type :=
insert_exist :
forall T1:Tree,
is_heap T1 ->
meq (contents T1) (munion (contents T) (singletonBag a)) ->
(forall b:A, leA b a -> leA_Tree b T -> leA_Tree b T1) ->
insert_spec a T.
Lemma insert : forall T:Tree, is_heap T -> forall a:A, insert_spec a T.
Proof.
simple induction 1; intros.
apply insert_exist with (Tree_Node a Tree_Leaf Tree_Leaf);
auto using node_is_heap, nil_is_heap, leA_Tree_Leaf with datatypes.
simpl; unfold meq, munion; auto using node_is_heap with datatypes.
elim (leA_dec a a0); intros.
elim (X a0); intros.
apply insert_exist with (Tree_Node a T2 T0);
auto using node_is_heap, nil_is_heap, leA_Tree_Leaf with datatypes.
simpl; apply treesort_twist1; trivial with datatypes.
elim (X a); intros T3 HeapT3 ConT3 LeA.
apply insert_exist with (Tree_Node a0 T2 T3);
auto using node_is_heap, nil_is_heap, leA_Tree_Leaf with datatypes.
apply node_is_heap; auto using node_is_heap, nil_is_heap, leA_Tree_Leaf with datatypes.
apply low_trans with a; auto with datatypes.
apply LeA; auto with datatypes.
apply low_trans with a; auto with datatypes.
simpl; apply treesort_twist2; trivial with datatypes.
Qed.
(** ** Building a heap from a list *)
Inductive build_heap (l:list A) : Type :=
heap_exist :
forall T:Tree,
is_heap T ->
meq (list_contents _ eqA_dec l) (contents T) -> build_heap l.
Lemma list_to_heap : forall l:list A, build_heap l.
Proof.
simple induction l.
apply (heap_exist nil Tree_Leaf); auto with datatypes.
simpl; unfold meq; exact nil_is_heap.
simple induction 1.
intros T i m; elim (insert T i a).
intros; apply heap_exist with T1; simpl; auto with datatypes.
apply meq_trans with (munion (contents T) (singletonBag a)).
apply meq_trans with (munion (singletonBag a) (contents T)).
apply meq_right; trivial with datatypes.
apply munion_comm.
apply meq_sym; trivial with datatypes.
Qed.
(** ** Building the sorted list *)
Inductive flat_spec (T:Tree) : Type :=
flat_exist :
forall l:list A,
Sorted leA l ->
(forall a:A, leA_Tree a T -> HdRel leA a l) ->
meq (contents T) (list_contents _ eqA_dec l) -> flat_spec T.
Lemma heap_to_list : forall T:Tree, is_heap T -> flat_spec T.
Proof.
intros T h; elim h; intros.
apply flat_exist with (nil (A:=A)); auto with datatypes.
elim X; intros l1 s1 i1 m1; elim X0; intros l2 s2 i2 m2.
elim (merge _ s1 _ s2); intros.
apply flat_exist with (a :: l); simpl; auto with datatypes.
apply meq_trans with
(munion (list_contents _ eqA_dec l1)
(munion (list_contents _ eqA_dec l2) (singletonBag a))).
apply meq_congr; auto with datatypes.
apply meq_trans with
(munion (singletonBag a)
(munion (list_contents _ eqA_dec l1) (list_contents _ eqA_dec l2))).
apply munion_rotate.
apply meq_right; apply meq_sym; trivial with datatypes.
Qed.
(** * Specification of treesort *)
Theorem treesort :
forall l:list A,
{m : list A | Sorted leA m & permutation _ eqA_dec l m}.
Proof.
intro l; unfold permutation.
elim (list_to_heap l).
intros.
elim (heap_to_list T); auto with datatypes.
intros.
exists l0; auto with datatypes.
apply meq_trans with (contents T); trivial with datatypes.
Qed.
End defs.
|
[STATEMENT]
lemma abrupt_if_True_not_None [simp]: "x \<noteq> None \<Longrightarrow> abrupt_if True x y \<noteq> None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. x \<noteq> None \<Longrightarrow> abrupt_if True x y \<noteq> None
[PROOF STEP]
by (simp add: abrupt_if_def) |
(*:maxLineLen=78:*)
theory Sessions
imports Base
begin
chapter \<open>Isabelle sessions and build management \label{ch:session}\<close>
text \<open>
An Isabelle \<^emph>\<open>session\<close> consists of a collection of related theories that may
be associated with formal documents (\chref{ch:present}). There is also a
notion of \<^emph>\<open>persistent heap\<close> image to capture the state of a session,
similar to object-code in compiled programming languages. Thus the concept
of session resembles that of a ``project'' in common IDE environments, but
the specific name emphasizes the connection to interactive theorem proving:
the session wraps-up the results of user-interaction with the prover in a
persistent form.
Application sessions are built on a given parent session, which may be built
recursively on other parents. Following this path in the hierarchy
eventually leads to some major object-logic session like \<open>HOL\<close>, which itself
is based on \<open>Pure\<close> as the common root of all sessions.
Processing sessions may take considerable time. Isabelle build management
helps to organize this efficiently. This includes support for parallel build
jobs, in addition to the multithreaded theory and proof checking that is
already provided by the prover process itself.
\<close>
section \<open>Session ROOT specifications \label{sec:session-root}\<close>
text \<open>
Session specifications reside in files called \<^verbatim>\<open>ROOT\<close> within certain
directories, such as the home locations of registered Isabelle components or
additional project directories given by the user.
The ROOT file format follows the lexical conventions of the \<^emph>\<open>outer syntax\<close>
of Isabelle/Isar, see also \<^cite>\<open>"isabelle-isar-ref"\<close>. This defines common
forms like identifiers, names, quoted strings, verbatim text, nested
comments etc. The grammar for @{syntax chapter_def}, @{syntax chapter_entry}
and @{syntax session_entry} is given as syntax diagram below. Each ROOT file
may contain multiple specifications like this. Chapters help to organize
browser info (\secref{sec:info}), but have no formal meaning. The default
chapter is ``\<open>Unsorted\<close>''. Chapter definitions, which are optional, allow to
associate additional information.
Isabelle/jEdit \<^cite>\<open>"isabelle-jedit"\<close> includes a simple editing mode
\<^verbatim>\<open>isabelle-root\<close> for session ROOT files, which is enabled by default for any
file of that name.
\<^rail>\<open>
@{syntax_def chapter_def}: @'chapter_definition' @{syntax name} \<newline>
groups? description?
;
@{syntax_def chapter_entry}: @'chapter' @{syntax name}
;
@{syntax_def session_entry}: @'session' @{syntax system_name} groups? dir? '=' \<newline>
(@{syntax system_name} '+')? description? options? \<newline>
sessions? directories? (theories*) \<newline>
(document_theories?) (document_files*) \<newline>
(export_files*) (export_classpath?)
;
groups: '(' (@{syntax name} +) ')'
;
dir: @'in' @{syntax embedded}
;
description: @'description' @{syntax text}
;
options: @'options' opts
;
opts: '[' ( (@{syntax name} '=' value | @{syntax name}) + ',' ) ']'
;
value: @{syntax name} | @{syntax real}
;
sessions: @'sessions' (@{syntax system_name}+)
;
directories: @'directories' (dir+)
;
theories: @'theories' opts? (theory_entry+)
;
theory_entry: @{syntax system_name} ('(' @'global' ')')?
;
document_theories: @'document_theories' (@{syntax name}+)
;
document_files: @'document_files' ('(' dir ')')? (@{syntax embedded}+)
;
export_files: @'export_files' ('(' dir ')')? ('[' nat ']')? \<newline>
(@{syntax embedded}+)
;
export_classpath: @'export_classpath' (@{syntax embedded}*)
\<close>
\<^descr> \isakeyword{chapter{\isacharunderscorekeyword}definition}~\<open>A (groups)\<close>
associates a collection of groups with chapter \<open>A\<close>. All sessions that belong
to this chapter will automatically become members of these groups.
\<^descr> \isakeyword{session}~\<open>A = B + body\<close> defines a new session \<open>A\<close> based on
parent session \<open>B\<close>, with its content given in \<open>body\<close> (imported sessions and
theories). Note that a parent (like \<open>HOL\<close>) is mandatory in practical
applications: only Isabelle/Pure can bootstrap itself from nothing.
All such session specifications together describe a hierarchy (graph) of
sessions, with globally unique names. The new session name \<open>A\<close> should be
sufficiently long and descriptive to stand on its own in a potentially large
library.
\<^descr> \isakeyword{session}~\<open>A (groups)\<close> indicates a collection of groups where
the new session is a member. Group names are uninterpreted and merely follow
certain conventions. For example, the Isabelle distribution tags some
important sessions by the group name called ``\<open>main\<close>''. Other projects may
invent their own conventions, but this requires some care to avoid clashes
within this unchecked name space.
\<^descr> \isakeyword{session}~\<open>A\<close>~\isakeyword{in}~\<open>dir\<close> specifies an explicit
directory for this session; by default this is the current directory of the
\<^verbatim>\<open>ROOT\<close> file.
All theory files are located relatively to the session directory. The prover
process is run within the same as its current working directory.
\<^descr> \isakeyword{description}~\<open>text\<close> is a free-form description for this
session (or chapter), e.g. for presentation purposes.
\<^descr> \isakeyword{options}~\<open>[x = a, y = b, z]\<close> defines separate options
(\secref{sec:system-options}) that are used when processing this session,
but \<^emph>\<open>without\<close> propagation to child sessions. Note that \<open>z\<close> abbreviates \<open>z =
true\<close> for Boolean options.
\<^descr> \isakeyword{sessions}~\<open>names\<close> specifies sessions that are \<^emph>\<open>imported\<close> into
the current name space of theories. This allows to refer to a theory \<open>A\<close>
from session \<open>B\<close> by the qualified name \<open>B.A\<close> --- although it is loaded again
into the current ML process, which is in contrast to a theory that is
already present in the \<^emph>\<open>parent\<close> session.
Theories that are imported from other sessions are excluded from the current
session document.
\<^descr> \isakeyword{directories}~\<open>dirs\<close> specifies additional directories for
import of theory files via \isakeyword{theories} within \<^verbatim>\<open>ROOT\<close> or
\<^theory_text>\<open>imports\<close> within a theory; \<open>dirs\<close> are relative to the main session
directory (cf.\ \isakeyword{session} \dots \isakeyword{in}~\<open>dir\<close>). These
directories need to be exclusively assigned to a unique session, without
implicit sharing of file-system locations.
\<^descr> \isakeyword{theories}~\<open>options names\<close> specifies a block of theories that
are processed within an environment that is augmented by the given options,
in addition to the global session options given before. Any number of blocks
of \isakeyword{theories} may be given. Options are only active for each
\isakeyword{theories} block separately.
A theory name that is followed by \<open>(\<close>\isakeyword{global}\<open>)\<close> is treated
literally in other session specifications or theory imports --- the normal
situation is to qualify theory names by the session name; this ensures
globally unique names in big session graphs. Global theories are usually the
entry points to major logic sessions: \<open>Pure\<close>, \<open>Main\<close>, \<open>Complex_Main\<close>,
\<open>HOLCF\<close>, \<open>IFOL\<close>, \<open>FOL\<close>, \<open>ZF\<close>, \<open>ZFC\<close> etc. Regular Isabelle applications
should not claim any global theory names.
\<^descr> \isakeyword{document_theories}~\<open>names\<close> specifies theories from other
sessions that should be included in the generated document source directory.
These theories need to be explicit imports in the current session, or
implicit imports from the underlying hierarchy of parent sessions. The
generated \<^verbatim>\<open>session.tex\<close> file is not affected: the session's {\LaTeX} setup
needs to \<^verbatim>\<open>\input{\<close>\<open>\<dots>\<close>\<^verbatim>\<open>}\<close> generated \<^verbatim>\<open>.tex\<close> files separately.
\<^descr> \isakeyword{document_files}~\<open>(\<close>\isakeyword{in}~\<open>base_dir) files\<close> lists
source files for document preparation, typically \<^verbatim>\<open>.tex\<close> and \<^verbatim>\<open>.sty\<close> for
{\LaTeX}. Only these explicitly given files are copied from the base
directory to the document output directory, before formal document
processing is started (see also \secref{sec:tool-document}). The local path
structure of the \<open>files\<close> is preserved, which allows to reconstruct the
original directory hierarchy of \<open>base_dir\<close>. The default \<open>base_dir\<close> is
\<^verbatim>\<open>document\<close> within the session root directory.
\<^descr> \isakeyword{export_files}~\<open>(\<close>\isakeyword{in}~\<open>target_dir) [number]
patterns\<close> specifies theory exports that may get written to the file-system,
e.g. via @{tool_ref build} with option \<^verbatim>\<open>-e\<close> (\secref{sec:tool-build}). The
\<open>target_dir\<close> specification is relative to the session root directory; its
default is \<^verbatim>\<open>export\<close>. Exports are selected via \<open>patterns\<close> as in @{tool_ref
export} (\secref{sec:tool-export}). The number given in brackets (default:
0) specifies the prefix of elements that should be removed from each name:
it allows to reduce the resulting directory hierarchy at the danger of
overwriting files due to loss of uniqueness.
\<^descr> \isakeyword{export_classpath}~\<open>patterns\<close> specifies export artifacts that
should be included into the local Java/Scala classpath of this session
context. This is only relevant for tools that allow dynamic loading of
service classes (\secref{sec:scala-build}), while most other Isabelle/Scala
tools require global configuration during system startup. An empty list of
\<open>patterns\<close> defaults to \<^verbatim>\<open>"*:classpath/*.jar"\<close>, which fits to the naming
convention of JAR modules produced by the Isabelle/Isar command
\<^theory_text>\<open>scala_build_generated_files\<close> \<^cite>\<open>"isabelle-isar-ref"\<close>.
\<close>
subsubsection \<open>Examples\<close>
text \<open>
See \<^file>\<open>~~/src/HOL/ROOT\<close> for a diversity of practically relevant situations,
although it uses relatively complex quasi-hierarchic naming conventions like
\<^verbatim>\<open>HOL-SPARK\<close>, \<^verbatim>\<open>HOL-SPARK-Examples\<close>. An alternative is to use unqualified
names that are relatively long and descriptive, as in the Archive of Formal
Proofs (\<^url>\<open>https://isa-afp.org\<close>), for example.
\<close>
section \<open>System build options \label{sec:system-options}\<close>
text \<open>
See \<^file>\<open>~~/etc/options\<close> for the main defaults provided by the Isabelle
distribution. Isabelle/jEdit \<^cite>\<open>"isabelle-jedit"\<close> includes a simple
editing mode \<^verbatim>\<open>isabelle-options\<close> for this file-format.
The following options are particularly relevant to build Isabelle sessions,
in particular with document preparation (\chref{ch:present}).
\<^item> @{system_option_def "browser_info"} controls output of HTML browser
info, see also \secref{sec:info}.
\<^item> @{system_option_def "document"} controls document output for a
particular session or theory; \<^verbatim>\<open>document=pdf\<close> or \<^verbatim>\<open>document=true\<close> means
enabled, \<^verbatim>\<open>document=""\<close> or \<^verbatim>\<open>document=false\<close> means disabled (especially
for particular theories).
\<^item> @{system_option_def "document_output"} specifies an alternative
directory for generated output of the document preparation system; the
default is within the @{setting "ISABELLE_BROWSER_INFO"} hierarchy as
explained in \secref{sec:info}. See also @{tool mkroot}, which generates a
default configuration with output readily available to the author of the
document.
\<^item> @{system_option_def "document_echo"} informs about document file names
during session presentation.
\<^item> @{system_option_def "document_variants"} specifies document variants as
a colon-separated list of \<open>name=tags\<close> entries. The default name is
\<^verbatim>\<open>document\<close>, without additional tags.
Tags are specified as a comma separated list of modifier/name pairs and
tell {\LaTeX} how to interpret certain Isabelle command regions:
``\<^verbatim>\<open>+\<close>\<open>foo\<close>'' (or just ``\<open>foo\<close>'') means to keep, ``\<^verbatim>\<open>-\<close>\<open>foo\<close>'' to drop,
and ``\<^verbatim>\<open>/\<close>\<open>foo\<close>'' to fold text tagged as \<open>foo\<close>. The builtin default is
equivalent to the tag specification
``\<^verbatim>\<open>+document,+theory,+proof,+ML,+visible,-invisible,+important,+unimportant\<close>'';
see also the {\LaTeX} macros \<^verbatim>\<open>\isakeeptag\<close>, \<^verbatim>\<open>\isadroptag\<close>, and
\<^verbatim>\<open>\isafoldtag\<close>, in \<^file>\<open>~~/lib/texinputs/isabelle.sty\<close>.
In contrast, \<^verbatim>\<open>document_variants=document:outline=/proof,/ML\<close> indicates
two documents: the one called \<^verbatim>\<open>document\<close> with default tags, and the other
called \<^verbatim>\<open>outline\<close> where proofs and ML sections are folded.
Document variant names are just a matter of conventions. It is also
possible to use different document variant names (without tags) for
different document root entries, see also \secref{sec:tool-document}.
\<^item> @{system_option_def "document_tags"} specifies alternative command tags
as a comma-separated list of items: either ``\<open>command\<close>\<^verbatim>\<open>%\<close>\<open>tag\<close>'' for a
specific command, or ``\<^verbatim>\<open>%\<close>\<open>tag\<close>'' as default for all other commands. This
is occasionally useful to control the global visibility of commands via
session options (e.g.\ in \<^verbatim>\<open>ROOT\<close>).
\<^item> @{system_option_def "document_comment_latex"} enables regular {\LaTeX}
\<^verbatim>\<open>comment.sty\<close>, instead of the historic version for plain {\TeX}
(default). The latter is much faster, but in conflict with {\LaTeX}
classes like Dagstuhl
LIPIcs\<^footnote>\<open>\<^url>\<open>https://github.com/dagstuhl-publishing/styles\<close>\<close>.
\<^item> @{system_option_def "document_bibliography"} explicitly enables the use
of \<^verbatim>\<open>bibtex\<close>; the default is to check the presence of \<^verbatim>\<open>root.bib\<close>, but it
could have a different name.
\<^item> @{system_option_def "document_heading_prefix"} specifies a prefix for
the {\LaTeX} macro names generated from Isar commands like \<^theory_text>\<open>chapter\<close>,
\<^theory_text>\<open>section\<close> etc. The default is \<^verbatim>\<open>isamarkup\<close>, e.g. \<^theory_text>\<open>section\<close> becomes
\<^verbatim>\<open>\isamarkupsection\<close>.
\<^item> @{system_option_def "threads"} determines the number of worker threads
for parallel checking of theories and proofs. The default \<open>0\<close> means that a
sensible maximum value is determined by the underlying hardware. For
machines with many cores or with hyperthreading, this sometimes requires
manual adjustment (on the command-line or within personal settings or
preferences, not within a session \<^verbatim>\<open>ROOT\<close>).
\<^item> @{system_option_def "condition"} specifies a comma-separated list of
process environment variables (or Isabelle settings) that are required for
the subsequent theories to be processed. Conditions are considered
``true'' if the corresponding environment value is defined and non-empty.
\<^item> @{system_option_def "timeout"} and @{system_option_def "timeout_scale"}
specify a real wall-clock timeout for the session as a whole: the two
values are multiplied and taken as the number of seconds. Typically,
@{system_option "timeout"} is given for individual sessions, and
@{system_option "timeout_scale"} as global adjustment to overall hardware
performance.
The timer is controlled outside the ML process by the JVM that runs
Isabelle/Scala. Thus it is relatively reliable in canceling processes that
get out of control, even if there is a deadlock without CPU time usage.
\<^item> @{system_option_def "profiling"} specifies a mode for global ML
profiling. Possible values are the empty string (disabled), \<^verbatim>\<open>time\<close> for
\<^ML>\<open>profile_time\<close> and \<^verbatim>\<open>allocations\<close> for \<^ML>\<open>profile_allocations\<close>.
Results appear near the bottom of the session log file.
\<^item> @{system_option_def system_log} specifies an optional log file for
low-level messages produced by \<^ML>\<open>Output.system_message\<close> in
Isabelle/ML; the standard value ``\<^verbatim>\<open>-\<close>'' refers to console progress of the
build job.
\<^item> @{system_option_def "system_heaps"} determines the directories for
session heap images: \<^path>\<open>$ISABELLE_HEAPS\<close> is the user directory and
\<^path>\<open>$ISABELLE_HEAPS_SYSTEM\<close> the system directory (usually within the
Isabelle application). For \<^verbatim>\<open>system_heaps=false\<close>, heaps are stored in the
user directory and may be loaded from both directories. For
\<^verbatim>\<open>system_heaps=true\<close>, store and load happens only in the system directory.
The @{tool_def options} tool prints Isabelle system options. Its
command-line usage is:
@{verbatim [display]
\<open>Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...]
Options are:
-b include $ISABELLE_BUILD_OPTIONS
-g OPTION get value of OPTION
-l list options
-t TAGS restrict list to given tags (comma-separated)
-x FILE export options to FILE in YXML format
Report Isabelle system options, augmented by MORE_OPTIONS given as
arguments NAME=VAL or NAME.\<close>}
The command line arguments provide additional system options of the form
\<open>name\<close>\<^verbatim>\<open>=\<close>\<open>value\<close> or \<open>name\<close> for Boolean options.
Option \<^verbatim>\<open>-b\<close> augments the implicit environment of system options by the ones
of @{setting ISABELLE_BUILD_OPTIONS}, cf.\ \secref{sec:tool-build}.
Option \<^verbatim>\<open>-g\<close> prints the value of the given option. Option \<^verbatim>\<open>-l\<close> lists all
options with their declaration and current value. Option \<^verbatim>\<open>-t\<close> restricts the
listing to given tags (as comma-separated list), e.g. \<^verbatim>\<open>-t build,document\<close>.
Option \<^verbatim>\<open>-x\<close> specifies a file to export the result in YXML format, instead
of printing it in human-readable form.
\<close>
section \<open>Invoking the build process \label{sec:tool-build}\<close>
text \<open>
The @{tool_def build} tool invokes the build process for Isabelle sessions.
It manages dependencies between sessions, related sources of theories and
auxiliary files, and target heap images. Accordingly, it runs instances of
the prover process with optional document preparation. Its command-line
usage is:\<^footnote>\<open>Isabelle/Scala provides the same functionality via
\<^scala_method>\<open>isabelle.Build.build\<close>.\<close>
@{verbatim [display]
\<open>Usage: isabelle build [OPTIONS] [SESSIONS ...]
Options are:
-B NAME include session NAME and all descendants
-D DIR include session directory and select its sessions
-N cyclic shuffling of NUMA CPU nodes (performance tuning)
-P DIR enable HTML/PDF presentation in directory (":" for default)
-R refer to requirements of selected sessions
-S soft build: only observe changes of sources, not heap images
-X NAME exclude sessions from group NAME and all descendants
-a select all sessions
-b build heap images
-c clean build
-d DIR include session directory
-e export files from session specification into file-system
-f fresh build
-g NAME select session group NAME
-j INT maximum number of parallel jobs (default 1)
-k KEYWORD check theory sources for conflicts with proposed keywords
-l list session source files
-n no build -- take existing session build databases
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-v verbose
-x NAME exclude session NAME and all descendants
Build and manage Isabelle sessions: ML heaps, session databases, documents.
Notable system options: see "isabelle options -l -t build"
Notable system settings:
ISABELLE_TOOL_JAVA_OPTIONS="..."
ISABELLE_BUILD_OPTIONS="..."
ML_PLATFORM="..."
ML_HOME="..."
ML_SYSTEM="..."
ML_OPTIONS="..."\<close>}
\<^medskip>
Isabelle sessions are defined via session ROOT files as described in
(\secref{sec:session-root}). The totality of sessions is determined by
collecting such specifications from all Isabelle component directories
(\secref{sec:components}), augmented by more directories given via options
\<^verbatim>\<open>-d\<close>~\<open>DIR\<close> on the command line. Each such directory may contain a session
\<^verbatim>\<open>ROOT\<close> file with several session specifications.
Any session root directory may refer recursively to further directories of
the same kind, by listing them in a catalog file \<^verbatim>\<open>ROOTS\<close> line-by-line. This
helps to organize large collections of session specifications, or to make
\<^verbatim>\<open>-d\<close> command line options persistent (e.g.\ in
\<^verbatim>\<open>$ISABELLE_HOME_USER/ROOTS\<close>).
\<^medskip>
The subset of sessions to be managed is determined via individual \<open>SESSIONS\<close>
given as command-line arguments, or session groups that are given via one or
more options \<^verbatim>\<open>-g\<close>~\<open>NAME\<close>. Option \<^verbatim>\<open>-a\<close> selects all sessions. The build tool
takes session dependencies into account: the set of selected sessions is
completed by including all ancestors.
\<^medskip>
One or more options \<^verbatim>\<open>-B\<close>~\<open>NAME\<close> specify base sessions to be included (all
descendants wrt.\ the session parent or import graph).
\<^medskip>
One or more options \<^verbatim>\<open>-x\<close>~\<open>NAME\<close> specify sessions to be excluded (all
descendants wrt.\ the session parent or import graph). Option \<^verbatim>\<open>-X\<close> is
analogous to this, but excluded sessions are specified by session group
membership.
\<^medskip>
Option \<^verbatim>\<open>-R\<close> reverses the selection in the sense that it refers to its
requirements: all ancestor sessions excluding the original selection. This
allows to prepare the stage for some build process with different options,
before running the main build itself (without option \<^verbatim>\<open>-R\<close>).
\<^medskip>
Option \<^verbatim>\<open>-D\<close> is similar to \<^verbatim>\<open>-d\<close>, but selects all sessions that are defined
in the given directories.
\<^medskip>
Option \<^verbatim>\<open>-S\<close> indicates a ``soft build'': the selection is restricted to
those sessions that have changed sources (according to actually imported
theories). The status of heap images is ignored.
\<^medskip>
The build process depends on additional options
(\secref{sec:system-options}) that are passed to the prover eventually. The
settings variable @{setting_ref ISABELLE_BUILD_OPTIONS} allows to provide
additional defaults, e.g.\ \<^verbatim>\<open>ISABELLE_BUILD_OPTIONS="document=pdf
threads=4"\<close>. Moreover, the environment of system build options may be
augmented on the command line via \<^verbatim>\<open>-o\<close>~\<open>name\<close>\<^verbatim>\<open>=\<close>\<open>value\<close> or \<^verbatim>\<open>-o\<close>~\<open>name\<close>,
which abbreviates \<^verbatim>\<open>-o\<close>~\<open>name\<close>\<^verbatim>\<open>=true\<close> for Boolean or string options.
Multiple occurrences of \<^verbatim>\<open>-o\<close> on the command-line are applied in the given
order.
\<^medskip>
Option \<^verbatim>\<open>-P\<close> enables PDF/HTML presentation in the given directory, where
``\<^verbatim>\<open>-P:\<close>'' refers to the default @{setting_ref ISABELLE_BROWSER_INFO} (or
@{setting_ref ISABELLE_BROWSER_INFO_SYSTEM}). This applies only to
explicitly selected sessions; note that option \<^verbatim>\<open>-R\<close> allows to select all
requirements separately.
\<^medskip>
Option \<^verbatim>\<open>-b\<close> ensures that heap images are produced for all selected
sessions. By default, images are only saved for inner nodes of the hierarchy
of sessions, as required for other sessions to continue later on.
\<^medskip>
Option \<^verbatim>\<open>-c\<close> cleans the selected sessions (all descendants wrt.\ the session
parent or import graph) before performing the specified build operation.
\<^medskip>
Option \<^verbatim>\<open>-e\<close> executes the \isakeyword{export_files} directives from the ROOT
specification of all explicitly selected sessions: the status of the session
build database needs to be OK, but the session could have been built
earlier. Using \isakeyword{export_files}, a session may serve as abstract
interface for add-on build artefacts, but these are only materialized on
explicit request: without option \<^verbatim>\<open>-e\<close> there is no effect on the physical
file-system yet.
\<^medskip>
Option \<^verbatim>\<open>-f\<close> forces a fresh build of all selected sessions and their
requirements.
\<^medskip> Option \<^verbatim>\<open>-n\<close> omits the actual build process after the preparatory stage
(including optional cleanup). The overall return code always the status of
the set of selected sessions. Add-on builds (like presentation) are run for
successful sessions, i.e.\ already finished ones.
\<^medskip>
Option \<^verbatim>\<open>-j\<close> specifies the maximum number of parallel build jobs (prover
processes). Each prover process is subject to a separate limit of parallel
worker threads, cf.\ system option @{system_option_ref threads}.
\<^medskip>
Option \<^verbatim>\<open>-N\<close> enables cyclic shuffling of NUMA CPU nodes. This may help
performance tuning on Linux servers with separate CPU/memory modules.
\<^medskip>
Option \<^verbatim>\<open>-v\<close> increases the general level of verbosity.
\<^medskip>
Option \<^verbatim>\<open>-l\<close> lists the source files that contribute to a session.
\<^medskip>
Option \<^verbatim>\<open>-k\<close> specifies a newly proposed keyword for outer syntax. It is
possible to use option \<^verbatim>\<open>-k\<close> repeatedly to check multiple keywords. The
theory sources are checked for conflicts wrt.\ this hypothetical change of
syntax, e.g.\ to reveal occurrences of identifiers that need to be quoted.
\<close>
subsubsection \<open>Examples\<close>
text \<open>
Build a specific logic image:
@{verbatim [display] \<open> isabelle build -b HOLCF\<close>}
\<^smallskip>
Build the main group of logic images:
@{verbatim [display] \<open> isabelle build -b -g main\<close>}
\<^smallskip>
Build all descendants (and requirements) of \<^verbatim>\<open>FOL\<close> and \<^verbatim>\<open>ZF\<close>:
@{verbatim [display] \<open> isabelle build -B FOL -B ZF\<close>}
\<^smallskip>
Build all sessions where sources have changed (ignoring heaps):
@{verbatim [display] \<open> isabelle build -a -S\<close>}
\<^smallskip>
Provide a general overview of the status of all Isabelle sessions, without
building anything:
@{verbatim [display] \<open> isabelle build -a -n -v\<close>}
\<^smallskip>
Build all sessions with HTML browser info and PDF document preparation:
@{verbatim [display] \<open> isabelle build -a -o browser_info -o document\<close>}
\<^smallskip>
Build all sessions with a maximum of 8 parallel prover processes and 4
worker threads each (on a machine with many cores):
@{verbatim [display] \<open> isabelle build -a -j8 -o threads=4\<close>}
\<^smallskip>
Build some session images with cleanup of their descendants, while retaining
their ancestry:
@{verbatim [display] \<open> isabelle build -b -c HOL-Library HOL-Algebra\<close>}
\<^smallskip>
HTML/PDF presentation for sessions that happen to be properly built already,
without rebuilding anything except the missing browser info:
@{verbatim [display] \<open> isabelle build -a -n -o browser_info\<close>}
\<^smallskip>
Clean all sessions without building anything:
@{verbatim [display] \<open> isabelle build -a -n -c\<close>}
\<^smallskip>
Build all sessions from some other directory hierarchy, according to the
settings variable \<^verbatim>\<open>AFP\<close> that happens to be defined inside the Isabelle
environment:
@{verbatim [display] \<open> isabelle build -D '$AFP'\<close>}
\<^smallskip>
Inform about the status of all sessions required for AFP, without building
anything yet:
@{verbatim [display] \<open> isabelle build -D '$AFP' -R -v -n\<close>}
\<close>
section \<open>Print messages from session build database \label{sec:tool-log}\<close>
text \<open>
The @{tool_def "build_log"} tool prints prover messages from the build
database of the given session. Its command-line usage is:
@{verbatim [display]
\<open>Usage: isabelle build_log [OPTIONS] [SESSIONS ...]
Options are:
-H REGEX filter messages by matching against head
-M REGEX filter messages by matching against body
-T NAME restrict to given theories (multiple options possible)
-U output Unicode symbols
-m MARGIN margin for pretty printing (default: 76.0)
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-v print all messages, including information etc.
Print messages from the session build database of the given sessions,
without any checks against current sources nor session structure: results
from old sessions or failed builds can be printed as well.
Multiple options -H and -M are conjunctive: all given patterns need to
match. Patterns match any substring, but ^ or $ may be used to match the
start or end explicitly.\<close>}
The specified session databases are taken as is, with formal checking
against current sources: There is \<^emph>\<open>no\<close> implicit build process involved, so
it is possible to retrieve error messages from a failed session as well. The
order of messages follows the source positions of source files; thus the
result is mostly deterministic, independent of the somewhat erratic
evaluation of parallel processing.
\<^medskip> Option \<^verbatim>\<open>-o\<close> allows to change system options, as in @{tool build}
(\secref{sec:tool-build}). This may affect the storage space for the build
database, notably via @{system_option system_heaps}, or @{system_option
build_database_server} and its relatives.
\<^medskip> Option \<^verbatim>\<open>-T\<close> restricts output to given theories: multiple entries are
possible by repeating this option on the command-line. The default is to
refer to \<^emph>\<open>all\<close> theories used in the original session build process.
\<^medskip> Options \<^verbatim>\<open>-m\<close> and \<^verbatim>\<open>-U\<close> modify pretty printing and output of Isabelle
symbols. The default is for an old-fashioned ASCII terminal at 80 characters
per line (76 + 4 characters to prefix warnings or errors).
\<^medskip> Option \<^verbatim>\<open>-v\<close> prints all messages from the session database that are
normally inlined into the source text, including information messages etc.
\<^medskip> Options \<^verbatim>\<open>-H\<close> and \<^verbatim>\<open>-M\<close> filter messages according to their header or body
content, respectively. The header follows a very basic format that makes it
easy to match message kinds (e.g. \<^verbatim>\<open>Warning\<close> or \<^verbatim>\<open>Error\<close>) and file names
(e.g. \<^verbatim>\<open>src/HOL/Nat.thy\<close>). The body is usually pretty-printed, but for
matching it is treated like one long line: blocks are ignored and breaks are
turned into plain spaces (according to their formal width).
The syntax for patters follows regular expressions of the Java
platform.\<^footnote>\<open>\<^url>\<open>https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html\<close>\<close>
\<close>
subsubsection \<open>Examples\<close>
text \<open>
Print messages from theory \<^verbatim>\<open>HOL.Nat\<close> of session \<^verbatim>\<open>HOL\<close>, using Unicode
rendering of Isabelle symbols and a margin of 100 characters:
@{verbatim [display] \<open> isabelle build_log -T HOL.Nat -U -m 100 HOL\<close>}
Print warnings about ambiguous input (inner syntax) of session
\<^verbatim>\<open>HOL-Library\<close>, which is built beforehand:
@{verbatim [display] \<open> isabelle build HOL-Library
isabelle build_log -H "Warning" -M "Ambiguous input" HOL-Library\<close>}
Print all errors from all sessions, e.g. from a partial build of
Isabelle/AFP:
@{verbatim [display] \<open> isabelle build_log -H "Error" $(isabelle sessions -a -d AFP/thys)\<close>}
\<close>
section \<open>Retrieve theory exports \label{sec:tool-export}\<close>
text \<open>
The @{tool_def "export"} tool retrieves theory exports from the session
database. Its command-line usage is: @{verbatim [display]
\<open>Usage: isabelle export [OPTIONS] SESSION
Options are:
-O DIR output directory for exported files (default: "export")
-d DIR include session directory
-l list exports
-n no build of session
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-p NUM prune path of exported files by NUM elements
-x PATTERN extract files matching pattern (e.g. "*:**" for all)
List or export theory exports for SESSION: named blobs produced by
isabelle build. Option -l or -x is required; option -x may be repeated.
The PATTERN language resembles glob patterns in the shell, with ? and *
(both excluding ":" and "/"), ** (excluding ":"), and [abc] or [^abc],
and variants {pattern1,pattern2,pattern3}.\<close>}
\<^medskip>
The specified session is updated via @{tool build}
(\secref{sec:tool-build}), with the same options \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-o\<close>. The option
\<^verbatim>\<open>-n\<close> suppresses the implicit build process: it means that a potentially
outdated session database is used!
\<^medskip>
Option \<^verbatim>\<open>-l\<close> lists all stored exports, with compound names
\<open>theory\<close>\<^verbatim>\<open>:\<close>\<open>name\<close>.
\<^medskip>
Option \<^verbatim>\<open>-x\<close> extracts stored exports whose compound name matches the given
pattern. Note that wild cards ``\<^verbatim>\<open>?\<close>'' and ``\<^verbatim>\<open>*\<close>'' do not match the
separators ``\<^verbatim>\<open>:\<close>'' and ``\<^verbatim>\<open>/\<close>''; the wild card \<^verbatim>\<open>**\<close> matches over directory
name hierarchies separated by ``\<^verbatim>\<open>/\<close>''. Thus the pattern ``\<^verbatim>\<open>*:**\<close>'' matches
\<^emph>\<open>all\<close> theory exports. Multiple options \<^verbatim>\<open>-x\<close> refer to the union of all
specified patterns.
Option \<^verbatim>\<open>-O\<close> specifies an alternative output directory for option \<^verbatim>\<open>-x\<close>: the
default is \<^verbatim>\<open>export\<close> within the current directory. Each theory creates its
own sub-directory hierarchy, using the session-qualified theory name.
Option \<^verbatim>\<open>-p\<close> specifies the number of elements that should be pruned from
each name: it allows to reduce the resulting directory hierarchy at the
danger of overwriting files due to loss of uniqueness.
\<close>
section \<open>Dump PIDE session database \label{sec:tool-dump}\<close>
text \<open>
The @{tool_def "dump"} tool dumps information from the cumulative PIDE
session database (which is processed on the spot). Its command-line usage
is: @{verbatim [display]
\<open>Usage: isabelle dump [OPTIONS] [SESSIONS ...]
Options are:
-A NAMES dump named aspects (default: ...)
-B NAME include session NAME and all descendants
-D DIR include session directory and select its sessions
-O DIR output directory for dumped files (default: "dump")
-R refer to requirements of selected sessions
-X NAME exclude sessions from group NAME and all descendants
-a select all sessions
-b NAME base logic image (default "Pure")
-d DIR include session directory
-g NAME select session group NAME
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-v verbose
-x NAME exclude session NAME and all descendants
Dump cumulative PIDE session database, with the following aspects:
...\<close>}
\<^medskip> Options \<^verbatim>\<open>-B\<close>, \<^verbatim>\<open>-D\<close>, \<^verbatim>\<open>-R\<close>, \<^verbatim>\<open>-X\<close>, \<^verbatim>\<open>-a\<close>, \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-g\<close>, \<^verbatim>\<open>-x\<close> and the
remaining command-line arguments specify sessions as in @{tool build}
(\secref{sec:tool-build}): the cumulative PIDE database of all their loaded
theories is dumped to the output directory of option \<^verbatim>\<open>-O\<close> (default: \<^verbatim>\<open>dump\<close>
in the current directory).
\<^medskip> Option \<^verbatim>\<open>-b\<close> specifies an optional base logic image, for improved
scalability of the PIDE session. Its theories are only processed if it is
included in the overall session selection.
\<^medskip> Option \<^verbatim>\<open>-o\<close> overrides Isabelle system options as for @{tool build}
(\secref{sec:tool-build}).
\<^medskip> Option \<^verbatim>\<open>-v\<close> increases the general level of verbosity.
\<^medskip> Option \<^verbatim>\<open>-A\<close> specifies named aspects of the dump, as a comma-separated
list. The default is to dump all known aspects, as given in the command-line
usage of the tool. The underlying Isabelle/Scala operation
\<^scala_method>\<open>isabelle.Dump.dump\<close> takes aspects as user-defined
operations on the final PIDE state and document version. This allows to
imitate Prover IDE rendering under program control.
\<close>
subsubsection \<open>Examples\<close>
text \<open>
Dump all Isabelle/ZF sessions (which are rather small):
@{verbatim [display] \<open> isabelle dump -v -B ZF\<close>}
\<^smallskip>
Dump the quite substantial \<^verbatim>\<open>HOL-Analysis\<close> session, with full bootstrap
from Isabelle/Pure:
@{verbatim [display] \<open> isabelle dump -v HOL-Analysis\<close>}
\<^smallskip>
Dump all sessions connected to HOL-Analysis, using main Isabelle/HOL as
basis:
@{verbatim [display] \<open> isabelle dump -v -b HOL -B HOL-Analysis\<close>}
This results in uniform PIDE markup for everything, except for the
Isabelle/Pure bootstrap process itself. Producing that on the spot requires
several GB of heap space, both for the Isabelle/Scala and Isabelle/ML
process (in 64bit mode). Here are some relevant settings (\secref{sec:boot})
for such ambitious applications:
@{verbatim [display]
\<open> ISABELLE_TOOL_JAVA_OPTIONS="-Xms4g -Xmx32g -Xss16m"
ML_OPTIONS="--minheap 4G --maxheap 32G"
\<close>}
\<close>
section \<open>Update theory sources based on PIDE markup \label{sec:tool-update}\<close>
text \<open>
The @{tool_def "update"} tool updates theory sources based on markup that is
produced by the regular @{tool build} process \secref{sec:tool-build}). Its
command-line usage is: @{verbatim [display]
\<open>Usage: isabelle update [OPTIONS] [SESSIONS ...]
Options are:
-B NAME include session NAME and all descendants
-D DIR include session directory and select its sessions
-R refer to requirements of selected sessions
-X NAME exclude sessions from group NAME and all descendants
-a select all sessions
-b build heap images
-c clean build
-d DIR include session directory
-f fresh build
-g NAME select session group NAME
-j INT maximum number of parallel jobs (default 1)
-l NAME additional base logic
-n no build -- take existing session build databases
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-u OPT override "update" option for selected sessions
-v verbose
-x NAME exclude session NAME and all descendants
Update theory sources based on PIDE markup produced by "isabelle build".\<close>}
\<^medskip> Most options are the same as for @{tool build} (\secref{sec:tool-build}).
\<^medskip> Option \<^verbatim>\<open>-l\<close> specifies one or more base logics: these sessions and their
ancestors are \<^emph>\<open>excluded\<close> from the update.
\<^medskip> Option \<^verbatim>\<open>-u\<close> refers to specific \<^verbatim>\<open>update\<close> options, by relying on naming
convention: ``\<^verbatim>\<open>-u\<close>~\<open>OPT\<close>'' is a shortcut for ``\<^verbatim>\<open>-o\<close>~\<^verbatim>\<open>update_\<close>\<open>OPT\<close>''.
\<^medskip> The following \<^verbatim>\<open>update\<close> options are supported:
\<^item> @{system_option_ref update_inner_syntax_cartouches} to update inner
syntax (types, terms, etc.)~to use cartouches, instead of double-quoted
strings or atomic identifiers. For example, ``\<^theory_text>\<open>lemma \<doublequote>x =
x\<doublequote>\<close>'' is replaced by ``\<^theory_text>\<open>lemma \<open>x = x\<close>\<close>'', and ``\<^theory_text>\<open>assume
A\<close>'' is replaced by ``\<^theory_text>\<open>assume \<open>A\<close>\<close>''.
\<^item> @{system_option update_mixfix_cartouches} to update mixfix templates to
use cartouches instead of double-quoted strings. For example, ``\<^theory_text>\<open>(infixl
\<doublequote>+\<doublequote> 65)\<close>'' is replaced by ``\<^theory_text>\<open>(infixl \<open>+\<close>
65)\<close>''.
\<^item> @{system_option_ref update_control_cartouches} to update antiquotations
to use the compact form with control symbol and cartouche argument. For
example, ``\<open>@{term \<doublequote>x + y\<doublequote>}\<close>'' is replaced by
``\<open>\<^term>\<open>x + y\<close>\<close>'' (the control symbol is literally \<^verbatim>\<open>\<^term>\<close>.)
\<^item> @{system_option_ref update_path_cartouches} to update file-system paths
to use cartouches: this depends on language markup provided by semantic
processing of parsed input.
\<^item> @{system_option_ref update_cite} to update {\LaTeX} \<^verbatim>\<open>\cite\<close> commands
and old-style \<^verbatim>\<open>@{cite "name"}\<close> document antiquotations.
It is also possible to produce custom updates in Isabelle/ML, by reporting
\<^ML>\<open>Markup.update\<close> with the precise source position and a replacement
text. This operation should be made conditional on specific system options,
similar to the ones above. Searching the above option names in ML sources of
\<^dir>\<open>$ISABELLE_HOME/src/Pure\<close> provides some examples.
Updates can be in conflict by producing nested or overlapping edits: this
may require to run @{tool update} multiple times.
\<close>
subsubsection \<open>Examples\<close>
text \<open>
Update some cartouche notation in all theory sources required for session
\<^verbatim>\<open>HOL-Analysis\<close> (and ancestors):
@{verbatim [display] \<open> isabelle update -u mixfix_cartouches HOL-Analysis\<close>}
\<^smallskip> Update the same for all application sessions based on \<^verbatim>\<open>HOL-Analysis\<close>, but
do not change the underlying \<^verbatim>\<open>HOL\<close> (and \<^verbatim>\<open>Pure\<close>) session:
@{verbatim [display] \<open> isabelle update -u mixfix_cartouches -l HOL -B HOL-Analysis\<close>}
\<^smallskip> Update all sessions that happen to be properly built beforehand:
@{verbatim [display] \<open> isabelle update -u mixfix_cartouches -n -a\<close>}
\<close>
section \<open>Explore sessions structure\<close>
text \<open>
The @{tool_def "sessions"} tool explores the sessions structure. Its
command-line usage is:
@{verbatim [display]
\<open>Usage: isabelle sessions [OPTIONS] [SESSIONS ...]
Options are:
-B NAME include session NAME and all descendants
-D DIR include session directory and select its sessions
-R refer to requirements of selected sessions
-X NAME exclude sessions from group NAME and all descendants
-a select all sessions
-b follow session build dependencies (default: source imports)
-d DIR include session directory
-g NAME select session group NAME
-x NAME exclude session NAME and all descendants
Explore the structure of Isabelle sessions and print result names in
topological order (on stdout).\<close>}
Arguments and options for session selection resemble @{tool build}
(\secref{sec:tool-build}).
\<close>
subsubsection \<open>Examples\<close>
text \<open>
All sessions of the Isabelle distribution:
@{verbatim [display] \<open> isabelle sessions -a\<close>}
\<^medskip>
Sessions that are imported by \<^verbatim>\<open>ZF\<close>:
@{verbatim [display] \<open> isabelle sessions ZF\<close>}
\<^medskip>
Sessions that are required to build \<^verbatim>\<open>ZF\<close>:
@{verbatim [display] \<open> isabelle sessions -b ZF\<close>}
\<^medskip>
Sessions that are based on \<^verbatim>\<open>ZF\<close> (and imported by it):
@{verbatim [display] \<open> isabelle sessions -B ZF\<close>}
\<^medskip>
All sessions of Isabelle/AFP (based in directory \<^path>\<open>AFP\<close>):
@{verbatim [display] \<open> isabelle sessions -D AFP/thys\<close>}
\<^medskip>
Sessions required by Isabelle/AFP (based in directory \<^path>\<open>AFP\<close>):
@{verbatim [display] \<open> isabelle sessions -R -D AFP/thys\<close>}
\<close>
section \<open>Synchronize source repositories and session images for Isabelle and AFP\<close>
text \<open>
The @{tool_def sync} tool synchronizes a local Isabelle and AFP source
repository, possibly with prebuilt \<^verbatim>\<open>.jar\<close> files and session images. Its
command-line usage is: @{verbatim [display]
\<open>Usage: isabelle sync [OPTIONS] TARGET
Options are:
-A ROOT include AFP with given root directory (":" for $AFP_BASE)
-H purge heaps directory on target
-I NAME include session heap image and build database
(based on accidental local state)
-J preserve *.jar files
-P protect spaces in target file names: more robust, less portable
-S PATH SSH control path for connection multiplexing
-T thorough treatment of file content and directory times
-a REV explicit AFP revision (default: state of working directory)
-n no changes: dry-run
-p PORT SSH port
-r REV explicit revision (default: state of working directory)
-v verbose
Synchronize Isabelle + AFP repositories, based on "isabelle hg_sync".\<close>}
The approach is to apply @{tool hg_sync} (see \secref{sec:tool-hg-sync}) on
the underlying Isabelle repository, and an optional AFP repository.
Consequently, the Isabelle installation needs to be a Mercurial repository
clone: a regular download of the Isabelle distribution is not sufficient!
On the target side, AFP is placed into @{setting ISABELLE_HOME} as immediate
sub-directory with the literal name \<^verbatim>\<open>AFP\<close>; thus it can be easily included
elsewhere, e.g. @{tool build}~\<^verbatim>\<open>-d\<close>~\<^verbatim>\<open>'~~/AFP'\<close> on the remote side.
\<^medskip> Options \<^verbatim>\<open>-P\<close>, \<^verbatim>\<open>-S\<close>, \<^verbatim>\<open>-T\<close>, \<^verbatim>\<open>-n\<close>, \<^verbatim>\<open>-p\<close>, \<^verbatim>\<open>-v\<close> are the same as the
underlying @{tool hg_sync}.
\<^medskip> Options \<^verbatim>\<open>-r\<close> and \<^verbatim>\<open>-a\<close> are the same as option \<^verbatim>\<open>-r\<close> for @{tool hg_sync},
but for the Isabelle and AFP repositories, respectively. The AFP version is
only used if a corresponding repository is given via option \<^verbatim>\<open>-A\<close>, either
with explicit root directory, or as \<^verbatim>\<open>-A:\<close> to refer to \<^verbatim>\<open>$AFP_BASE\<close> (this
assumes AFP as component of the local Isabelle installation). If no AFP
repository is given, an existing \<^verbatim>\<open>AFP\<close> directory on the target remains
unchanged.
\<^medskip> Option \<^verbatim>\<open>-J\<close> uploads existing \<^verbatim>\<open>.jar\<close> files from the working directory,
which are usually Isabelle/Scala/Java modules under control of @{tool
scala_build} via \<^verbatim>\<open>etc/build.props\<close> (see also \secref{sec:scala-build}).
Thus the dependency management is accurate: bad uploads will be rebuilt
eventually (or ignored). This might fail for very old Isabelle versions,
when going into the past via option \<^verbatim>\<open>-r\<close>: here it is better to omit option
\<^verbatim>\<open>-J\<close> and thus purge \<^verbatim>\<open>.jar\<close> files on the target (because they do not belong
to the repository).
\<^medskip> Option \<^verbatim>\<open>-I\<close> uploads a collection of session images. The set of \<^verbatim>\<open>-I\<close>
options specifies the end-points in the session build graph, including all
required ancestors. The result collection is uploaded using the underlying
\<^verbatim>\<open>rsync\<close> policies, so unchanged images are not sent again. Session images
are assembled within the target \<^verbatim>\<open>heaps\<close> directory: this scheme fits
together with @{tool build}~\<^verbatim>\<open>-o system_heaps\<close>. Images are taken as-is from
the local Isabelle installation, regardless of option \<^verbatim>\<open>-r\<close>. Upload of bad
images could waste time and space, but running e.g. @{tool build} on the
target will check dependencies accurately and rebuild outdated images on
demand.
\<^medskip> Option \<^verbatim>\<open>-H\<close> tells the underlying \<^verbatim>\<open>rsync\<close> process to purge the \<^verbatim>\<open>heaps\<close>
directory on the target, before uploading new images via option \<^verbatim>\<open>-I\<close>. The
default is to work monotonically: old material that is not overwritten
remains unchanged. Over time, this may lead to unused garbage, due to
changes in session names or the Poly/ML version. Option \<^verbatim>\<open>-H\<close> helps to avoid
wasting file-system space.
\<close>
subsubsection \<open>Examples\<close>
text \<open>
For quick testing of Isabelle + AFP on a remote machine, upload changed
sources, jars, and local sessions images for \<^verbatim>\<open>HOL\<close>:
@{verbatim [display] \<open> isabelle sync -A: -I HOL -J testmachine:test/isabelle_afp\<close>}
Assuming that the local \<^verbatim>\<open>HOL\<close> hierarchy has been up-to-date, and the local
and remote ML platforms coincide, a remote @{tool build} will proceed
without building \<^verbatim>\<open>HOL\<close> again.
\<^medskip> Here is a variation for extra-clean testing of Isabelle + AFP: no option
\<^verbatim>\<open>-J\<close>, but option \<^verbatim>\<open>-T\<close> to disable the default ``quick check'' of \<^verbatim>\<open>rsync\<close>
(which only inspects file sizes and date stamps); existing heaps are
deleted:
@{verbatim [display] \<open> isabelle sync -A: -T -H testmachine:test/isabelle_afp\<close>}
\<close>
end
|
(*---------------------------------------------------------------------------
Various helpers for halving, double and powers of 2
---------------------------------------------------------------------------*)
Require Import Ssreflect.ssreflect Ssreflect.ssrfun Ssreflect.ssrbool Ssreflect.eqtype Ssreflect.ssrnat Ssreflect.seq Ssreflect.tuple Ssreflect.zmodp Ssreflect.fintype Ssreflect.div.
Set Implicit Arguments.
Unset Strict Implicit.
Import Prenex Implicits.
Lemma half_ltn_double m n : m < n.*2 -> m./2 < n.
Proof. move => H.
rewrite -ltn_double. rewrite -(odd_double_half m) in H.
rewrite -(ltn_add2l (odd m)).
by apply ltn_addl.
Qed.
Lemma half_double_subn1 a : ((a.*2).-1)./2 = a.-1.
Proof. case a. done. move => a'. simpl; apply uphalf_double. Qed.
Lemma uphalf_double_subn1 a : uphalf ((a.*2).-1) = a.
Proof. case a. done. move => a'. simpl; by rewrite half_double. Qed.
Lemma half_subn1 : forall a b, (b - a.+1)./2 = (uphalf (b - a)).-1.
Proof. induction a.
+ case => //. move => b. by rewrite subn1.
+ move => b. specialize (IHa (b.-1)).
rewrite -subn1 in IHa. by rewrite -!subnDA !add1n in IHa.
Qed.
(* Strictly speaking we don't need the precondition *)
Lemma half_sub a : forall b, a <= b.*2 -> (b.*2 - a)./2 = b - uphalf a.
Proof.
induction a => b H.
+ by rewrite !subn0 doubleK.
+ rewrite half_subn1. rewrite uphalf_half. rewrite IHa.
rewrite odd_sub. rewrite odd_double/=. rewrite -subn1.
rewrite uphalf_half.
case ODD: (odd a).
by rewrite add1n subn1.
by rewrite !add0n/= -subnDA addn1.
apply (ltnW H). apply (ltnW H).
Qed.
Lemma odd_oddsubn1 : forall n, n > 0 -> odd n.-1 = ~~odd n.
Proof. induction n => //. destruct n => //. simpl. by case (odd n). Qed.
Lemma odd_power2 n : odd (2^(n.+1)) = false.
Proof. by rewrite expnS mul2n odd_double. Qed.
Lemma odd_power2subn1 n : odd ((2^(n.+1)).-1) = true.
Proof. induction n => //.
rewrite expnS mul2n odd_oddsubn1.
by rewrite odd_double.
rewrite -mul2n -expnS. apply expn_gt0.
Qed.
Lemma leq_subn a b : 0 < b -> a < b -> a <= b.-1.
Proof. by case b. Qed.
Lemma pow2_gt1 n : 1 < 2^n.+1.
Proof. rewrite expnS.
suff: 2*1 <= 2*2^n => //.
rewrite leq_mul2l/=.
apply expn_gt0.
Qed.
Lemma nat_lt0_succ m : (0 < m) = true -> exists m', m = m'+1.
Proof. destruct m => //. move => _. exists m. by rewrite addn1.
Qed.
Lemma pow2_sub_ltn n x : (2^n)-(x.+1) < 2^n.
Proof. have H := expn_gt0 2 n. simpl in H.
destruct (nat_lt0_succ H) as [m' HH]. rewrite HH.
rewrite addn1 subSS. by rewrite ltnS leq_subr.
Qed.
Lemma modn_sub : forall N x y, 0 < N -> x < N -> y < N -> N <= x+y ->
(x + y) %% N + N = x+y.
Proof.
move => N x y B H1 H2 H3.
assert (H4:= divn_eq (x+y) N).
rewrite {2}H4.
rewrite addnC.
assert (LT:(x + y) %/ N < 2).
rewrite ltn_divLR. rewrite mul2n -addnn.
rewrite -(ltn_add2r y) in H1.
apply (ltn_trans H1).
by rewrite ltn_add2l.
done.
assert (GT:0 < (x + y) %/ N).
by rewrite divn_gt0. rewrite ltnS in LT.
assert (1 <= (x+y) %/ N <= 1). by rewrite GT LT.
rewrite -eqn_leq in H. rewrite -(eqP H).
by rewrite mul1n.
Qed.
(* Good ol' induction over natural numbers: *)
Fixpoint nat_ind (P : nat -> Type)
(bc : P 0)
(ih : forall n, P n -> P n.+1)
(n: nat) : P n :=
match n with
| 0 => bc
| n.+1 => ih n (nat_ind bc ih n)
end.
|
/*
Copyright (C) 2020 David Cornu
for the Convolutional Interactive Artificial
Neural Networks by/for Astrophysicists (CIANNA) Code
(https://github.com/Deyht/CIANNA)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef DEFS_H
#define DEFS_H
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <tgmath.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#ifdef comp_CUDA
#ifdef CUDA
#include <cuda_runtime.h>
#include <cublas_v2.h>
#if defined(GEN_VOLTA) || defined(GEN_AMPERE)
#include <cuda_fp16.h>
#endif
#if defined(GEN_AMPERE)
#include <cuda_bf16.h>
#endif
#include <curand.h>
#include <curand_kernel.h>
#endif
#endif
#ifdef BLAS
#include <cblas.h>
#endif
#ifdef OPEN_MP
#include <omp.h>
#endif
static const double two_pi = 2.0*3.14159265358979323846;
#endif //DEFS_H
|
# ## 2.4 グラフのプロット
## #src
#-
using CSV
using DataFrames
using Measures
using Plots
## #src
#-
data = CSV.read("../data/house-prices-advanced-regression-techniques/train.csv", DataFrame)
## #src
#-
scatter(data[!, :GrLivArea], data[!, :SalePrice], label="", margin = 12mm)
xlabel!("GrLivArea")
ylabel!("SalePrice")
## #src
#-
scatter(data[!, :MSSubClass], data[!, :SalePrice], label="", margin = 12mm)
xlabel!("MSSubClass")
ylabel!("SalePrice")
|
Formal statement is: lemma closure_halfspace_gt [simp]: "a \<noteq> 0 \<Longrightarrow> closure {x. a \<bullet> x > b} = {x. a \<bullet> x \<ge> b}" Informal statement is: If $a \neq 0$, then the closure of the half-space $\{x \in \mathbb{R}^n \mid a \cdot x > b\}$ is the half-space $\{x \in \mathbb{R}^n \mid a \cdot x \geq b\}$. |
Require Import
Coq.Strings.String
Coq.Vectors.Vector.
Require Import
Fiat.Common.SumType
Fiat.Common.BoundedLookup
Fiat.Common.ilist
Fiat.Computation
Fiat.QueryStructure.Specification.Representation.Notations
Fiat.QueryStructure.Specification.Representation.Heading
Fiat.QueryStructure.Specification.Representation.Tuple
Fiat.Narcissus.BinLib.Core
Fiat.Narcissus.Common.Specs
Fiat.Narcissus.Common.WordFacts
Fiat.Narcissus.Common.ComposeCheckSum
Fiat.Narcissus.Common.ComposeIf
Fiat.Narcissus.Common.ComposeOpt
Fiat.Narcissus.Automation.SolverOpt
Fiat.Narcissus.Formats.Bool
Fiat.Narcissus.Formats.Option
Fiat.Narcissus.Formats.FixListOpt
Fiat.Narcissus.Stores.EmptyStore
Fiat.Narcissus.Formats.NatOpt
Fiat.Narcissus.Formats.Vector
Fiat.Narcissus.Formats.EnumOpt
Fiat.Narcissus.Formats.SumTypeOpt
Fiat.Narcissus.Formats.IPChecksum
Fiat.Narcissus.Formats.WordOpt.
Require Import Bedrock.Word.
Import Vectors.VectorDef.VectorNotations.
Open Scope string_scope.
Open Scope Tuple_scope.
(* Start Example Derivation. *)
Definition ICMP_Unreachable :=
@Tuple <"Payload" :: list char >. (* IP Header + first 64 bits of original datagram. *)
Definition ICMP_TimeExceeded :=
@Tuple <"Payload" :: list char >. (* IP Header + first 64 bits of original datagram. *)
Definition ICMP_ParameterProblem :=
@Tuple <"Pointer" :: char,
"Payload" :: list char >. (* IP Header + first 64 bits of original datagram. *)
Definition ICMP_SourceQuench :=
@Tuple <"Payload" :: list char >. (* IP Header + first 64 bits of original datagram. *)
Definition ICMP_Redirect :=
@Tuple <"RouterIP" :: word 32, (* IP Address of the router to use *)
"Payload" :: list char >. (* IP Header + first 64 bits of original datagram. *)
Definition ICMP_Echo :=
@Tuple <"ID" :: word 16, (* Identifier for sender *)
"SeqNum" :: word 16, (* Identifier for request *)
"Payload" :: list char>. (* Optional data to be echoed. *)
Definition ICMP_Timestamp :=
@Tuple <"ID" :: word 16, (* Identifier for sender *)
"SeqNum" :: word 16, (* Identifier for request *)
"Originate" :: word 32, (* Time request sent *)
"Received" :: word 32, (* Time request received *)
"Transmit" :: word 32>. (* Time reply sent *)
Definition ICMP_AddressMask :=
@Tuple <"ID" :: word 16, (* Identifier for sender *)
"SeqNum" :: word 16, (* Identifier for request *)
"SubnetMask" :: word 32>. (* The subnet mask of interest. *)
Definition ICMP_RouterAdvertisement :=
@Tuple <"TTL" :: word 16, (* Time to Live for the provided router information. *)
"RoutersPlusPreferences" :: list (word 32 * word 32)>. (* Pairs of a router's IP address *)
(* and its preference level. *)
Definition ICMP_Message_Types :=
[ ICMP_Echo; (* Echo Reply *)
ICMP_Unreachable; (* Destiniation unreachable *)
ICMP_SourceQuench; (* Source Quence *)
ICMP_Redirect; (* Redirect *)
ICMP_Echo; (* Echo Request *)
ICMP_RouterAdvertisement; (* Router Advertisement *)
(unit : Type) ; (* Router Solicitation *)
ICMP_TimeExceeded; (* Time Exceeded *)
ICMP_ParameterProblem; (* Parameter Problem *)
ICMP_Timestamp; (* Timestamp Request *)
ICMP_Timestamp; (* Timestamp Reply *)
ICMP_AddressMask; (* Address Mask Request *)
ICMP_AddressMask]. (* Address Mask Reply *)
Definition ICMP_Message_Codes :=
Eval simpl in
[natToWord 8 0;
natToWord 8 3;
natToWord 8 4;
natToWord 8 5;
natToWord 8 8;
natToWord 8 9;
natToWord 8 10;
natToWord 8 11;
natToWord 8 12;
natToWord 8 13;
natToWord 8 14;
natToWord 8 17;
natToWord 8 18].
Definition ICMP_Message :=
@Tuple <"Code" :: char, "Message" :: SumType ICMP_Message_Types>.
Definition monoid : Monoid ByteString := ByteStringMonoid.
Definition format_ICMP_Echo_Spec
(icmp : ICMP_Echo) :=
format_word icmp!"ID"
ThenC format_word icmp!"SeqNum"
ThenC format_list format_word icmp!"Payload"
DoneC.
Definition format_ICMP_Unreachable_Spec
(icmp : ICMP_Unreachable) :=
format_word (wzero 32)
ThenC format_list format_word icmp!"Payload"
DoneC.
Definition format_ICMP_SourceQuench_Spec
(icmp : ICMP_SourceQuench) :=
format_word (wzero 32)
ThenC format_list format_word icmp!"Payload"
DoneC.
Definition format_ICMP_Redirect_Spec
(icmp : ICMP_Redirect) :=
format_word icmp!"RouterIP"
ThenC format_list format_word icmp!"Payload"
DoneC.
Definition format_ICMP_RouterAdvertisement_Spec
(icmp : ICMP_RouterAdvertisement) :=
format_nat 8 (|icmp!"RoutersPlusPreferences"|)
ThenC format_nat 8 2
ThenC format_word icmp!"TTL"
ThenC format_list (fun p => format_word (fst p) ThenC format_word (snd p)) icmp!"RoutersPlusPreferences"
DoneC.
Definition format_ICMP_RouterSolicitation_Spec
(icmp : unit) :=
format_word (wzero 32)
DoneC.
Definition format_ICMP_TimeExceeded_Spec
(icmp : ICMP_TimeExceeded) :=
format_word (wzero 32)
ThenC format_list format_word icmp!"Payload"
DoneC.
Definition format_ICMP_ParameterProblem_Spec
(icmp : ICMP_ParameterProblem) :=
format_word icmp!"Pointer"
ThenC format_word (wzero 24)
ThenC format_list format_word icmp!"Payload"
DoneC.
Definition format_ICMP_Timestamp_Spec
(icmp : ICMP_Timestamp) :=
format_word icmp!"ID"
ThenC format_word icmp!"SeqNum"
ThenC format_word icmp!"Originate"
ThenC format_word icmp!"Received"
ThenC format_word icmp!"Transmit"
DoneC.
Definition format_ICMP_AddressMask_Spec
(icmp : ICMP_AddressMask) :=
format_word icmp!"ID"
ThenC format_word icmp!"SeqNum"
ThenC format_word icmp!"SubnetMask".
Definition format_ICMP_Message_Spec
(icmp : ICMP_Message) :=
format_enum ICMP_Message_Codes (SumType_index ICMP_Message_Types icmp!"Message")
ThenC format_word (icmp!"Code")
ThenChecksum IPChecksum_Valid OfSize 16
ThenCarryOn
format_SumType ICMP_Message_Types
(icons format_ICMP_Echo_Spec
(icons format_ICMP_Unreachable_Spec
(icons format_ICMP_SourceQuench_Spec
(icons format_ICMP_Redirect_Spec
(icons format_ICMP_Echo_Spec
(icons format_ICMP_RouterAdvertisement_Spec
(icons format_ICMP_RouterSolicitation_Spec
(icons format_ICMP_TimeExceeded_Spec
(icons format_ICMP_ParameterProblem_Spec
(icons format_ICMP_Timestamp_Spec
(icons format_ICMP_Timestamp_Spec
(icons format_ICMP_AddressMask_Spec
(icons format_ICMP_AddressMask_Spec inil)))))))))))))
icmp!"Message".
|
/*
Copyright (c) 2005-2019, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the University of Oxford nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ABSTRACTCELLPOPULATIONCOUNTWRITER_HPP_
#define ABSTRACTCELLPOPULATIONCOUNTWRITER_HPP_
#include "AbstractCellBasedWriter.hpp"
#include "ChasteSerialization.hpp"
#include <boost/serialization/base_object.hpp>
// Forward declaration prevents circular include chain
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM> class AbstractCellPopulation;
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM> class MeshBasedCellPopulation;
template<unsigned SPACE_DIM> class CaBasedCellPopulation;
template<unsigned SPACE_DIM> class NodeBasedCellPopulation;
template<unsigned SPACE_DIM> class PottsBasedCellPopulation;
template<unsigned SPACE_DIM> class VertexBasedCellPopulation;
/**
* Abstract class for a writer that takes information from an AbstractCellPopulation and writes it to file.
*
* The key difference between this class and AbstractCellPopulationWriter is that writers inheriting
* from this class are NOT compatible with a RoundRobin loop, because they write information that
* needs to be collected from all processes, such as global counters for mutation states. These writers
* concentrate the information from all processes and then write it at each timestep for which output
* is required.
*/
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class AbstractCellPopulationCountWriter : public AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM>
{
private:
/** Needed for serialization. */
friend class boost::serialization::access;
/**
* Serialize the object and its member variables.
*
* @param archive the archive
* @param version the current version of this class
*/
template<class Archive>
void serialize(Archive & archive, const unsigned int version)
{
archive & boost::serialization::base_object<AbstractCellBasedWriter<ELEMENT_DIM, SPACE_DIM> >(*this);
}
public:
/**
* Default constructor.
* @param rFileName the name of the file to write to.
*/
AbstractCellPopulationCountWriter(const std::string& rFileName);
/**
* Write the header to file.
*
* @param pCellPopulation a pointer to the population to be written.
*/
virtual void WriteHeader(AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation);
/**
* Visit the population and write the data.
*
* As this method is pure virtual, it must be overridden
* in subclasses.
*
* @param pCellPopulation a pointer to the MeshBasedCellPopulation to visit.
*/
virtual void Visit(MeshBasedCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)=0;
/**
* Visit the population and write the data.
*
* As this method is pure virtual, it must be overridden
* in subclasses.
*
* @param pCellPopulation a pointer to the CaBasedCellPopulation to visit.
*/
virtual void Visit(CaBasedCellPopulation<SPACE_DIM>* pCellPopulation)=0;
/**
* Visit the population and write the data.
*
* As this method is pure virtual, it must be overridden
* in subclasses.
*
* @param pCellPopulation a pointer to the NodeBasedCellPopulation to visit.
*/
virtual void Visit(NodeBasedCellPopulation<SPACE_DIM>* pCellPopulation)=0;
/**
* Visit the population and write the data.
*
* As this method is pure virtual, it must be overridden
* in subclasses.
*
* @param pCellPopulation a pointer to the PottsBasedCellPopulation to visit.
*/
virtual void Visit(PottsBasedCellPopulation<SPACE_DIM>* pCellPopulation)=0;
/**
* Visit the population and write the data.
*
* As this method is pure virtual, it must be overridden
* in subclasses.
*
* @param pCellPopulation a pointer to the VertexBasedCellPopulation to visit.
*/
virtual void Visit(VertexBasedCellPopulation<SPACE_DIM>* pCellPopulation)=0;
};
#endif /*ABSTRACTCELLPOPULATIONCOUNTWRITER_HPP_*/
|
(* Title: HOL/GCD.thy
Author: Christophe Tabacznyj
Author: Lawrence C. Paulson
Author: Amine Chaieb
Author: Thomas M. Rasmussen
Author: Jeremy Avigad
Author: Tobias Nipkow
This file deals with the functions gcd and lcm. Definitions and
lemmas are proved uniformly for the natural numbers and integers.
This file combines and revises a number of prior developments.
The original theories "GCD" and "Primes" were by Christophe Tabacznyj
and Lawrence C. Paulson, based on @{cite davenport92}. They introduced
gcd, lcm, and prime for the natural numbers.
The original theory "IntPrimes" was by Thomas M. Rasmussen, and
extended gcd, lcm, primes to the integers. Amine Chaieb provided
another extension of the notions to the integers, and added a number
of results to "Primes" and "GCD". IntPrimes also defined and developed
the congruence relations on the integers. The notion was extended to
the natural numbers by Chaieb.
Jeremy Avigad combined all of these, made everything uniform for the
natural numbers and the integers, and added a number of new theorems.
Tobias Nipkow cleaned up a lot.
*)
section \<open>Greatest common divisor and least common multiple\<close>
theory GCD
imports Groups_List
begin
subsection \<open>Abstract bounded quasi semilattices as common foundation\<close>
locale bounded_quasi_semilattice = abel_semigroup +
fixes top :: 'a ("\<^bold>\<top>") and bot :: 'a ("\<^bold>\<bottom>")
and normalize :: "'a \<Rightarrow> 'a"
assumes idem_normalize [simp]: "a \<^bold>* a = normalize a"
and normalize_left_idem [simp]: "normalize a \<^bold>* b = a \<^bold>* b"
and normalize_idem [simp]: "normalize (a \<^bold>* b) = a \<^bold>* b"
and normalize_top [simp]: "normalize \<^bold>\<top> = \<^bold>\<top>"
and normalize_bottom [simp]: "normalize \<^bold>\<bottom> = \<^bold>\<bottom>"
and top_left_normalize [simp]: "\<^bold>\<top> \<^bold>* a = normalize a"
and bottom_left_bottom [simp]: "\<^bold>\<bottom> \<^bold>* a = \<^bold>\<bottom>"
begin
lemma left_idem [simp]:
"a \<^bold>* (a \<^bold>* b) = a \<^bold>* b"
using assoc [of a a b, symmetric] by simp
lemma right_idem [simp]:
"(a \<^bold>* b) \<^bold>* b = a \<^bold>* b"
using left_idem [of b a] by (simp add: ac_simps)
lemma comp_fun_idem: "comp_fun_idem f"
by standard (simp_all add: fun_eq_iff ac_simps)
interpretation comp_fun_idem f
by (fact comp_fun_idem)
lemma top_right_normalize [simp]:
"a \<^bold>* \<^bold>\<top> = normalize a"
using top_left_normalize [of a] by (simp add: ac_simps)
lemma bottom_right_bottom [simp]:
"a \<^bold>* \<^bold>\<bottom> = \<^bold>\<bottom>"
using bottom_left_bottom [of a] by (simp add: ac_simps)
lemma normalize_right_idem [simp]:
"a \<^bold>* normalize b = a \<^bold>* b"
using normalize_left_idem [of b a] by (simp add: ac_simps)
end
locale bounded_quasi_semilattice_set = bounded_quasi_semilattice
begin
interpretation comp_fun_idem f
by (fact comp_fun_idem)
definition F :: "'a set \<Rightarrow> 'a"
where
eq_fold: "F A = (if finite A then Finite_Set.fold f \<^bold>\<top> A else \<^bold>\<bottom>)"
lemma infinite [simp]:
"infinite A \<Longrightarrow> F A = \<^bold>\<bottom>"
by (simp add: eq_fold)
lemma set_eq_fold [code]:
"F (set xs) = fold f xs \<^bold>\<top>"
by (simp add: eq_fold fold_set_fold)
lemma empty [simp]:
"F {} = \<^bold>\<top>"
by (simp add: eq_fold)
lemma insert [simp]:
"F (insert a A) = a \<^bold>* F A"
by (cases "finite A") (simp_all add: eq_fold)
lemma normalize [simp]:
"normalize (F A) = F A"
by (induct A rule: infinite_finite_induct) simp_all
lemma in_idem:
assumes "a \<in> A"
shows "a \<^bold>* F A = F A"
using assms by (induct A rule: infinite_finite_induct)
(auto simp: left_commute [of a])
lemma union:
"F (A \<union> B) = F A \<^bold>* F B"
by (induct A rule: infinite_finite_induct)
(simp_all add: ac_simps)
lemma remove:
assumes "a \<in> A"
shows "F A = a \<^bold>* F (A - {a})"
proof -
from assms obtain B where "A = insert a B" and "a \<notin> B"
by (blast dest: mk_disjoint_insert)
with assms show ?thesis by simp
qed
lemma insert_remove:
"F (insert a A) = a \<^bold>* F (A - {a})"
by (cases "a \<in> A") (simp_all add: insert_absorb remove)
end
subsection \<open>Abstract GCD and LCM\<close>
class gcd = zero + one + dvd +
fixes gcd :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"
and lcm :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"
class Gcd = gcd +
fixes Gcd :: "'a set \<Rightarrow> 'a"
and Lcm :: "'a set \<Rightarrow> 'a"
syntax
"_GCD1" :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b" ("(3GCD _./ _)" [0, 10] 10)
"_GCD" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b" ("(3GCD _\<in>_./ _)" [0, 0, 10] 10)
"_LCM1" :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b" ("(3LCM _./ _)" [0, 10] 10)
"_LCM" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b" ("(3LCM _\<in>_./ _)" [0, 0, 10] 10)
translations
"GCD x y. f" \<rightleftharpoons> "GCD x. GCD y. f"
"GCD x. f" \<rightleftharpoons> "CONST Gcd (CONST range (\<lambda>x. f))"
"GCD x\<in>A. f" \<rightleftharpoons> "CONST Gcd ((\<lambda>x. f) ` A)"
"LCM x y. f" \<rightleftharpoons> "LCM x. LCM y. f"
"LCM x. f" \<rightleftharpoons> "CONST Lcm (CONST range (\<lambda>x. f))"
"LCM x\<in>A. f" \<rightleftharpoons> "CONST Lcm ((\<lambda>x. f) ` A)"
class semiring_gcd = normalization_semidom + gcd +
assumes gcd_dvd1 [iff]: "gcd a b dvd a"
and gcd_dvd2 [iff]: "gcd a b dvd b"
and gcd_greatest: "c dvd a \<Longrightarrow> c dvd b \<Longrightarrow> c dvd gcd a b"
and normalize_gcd [simp]: "normalize (gcd a b) = gcd a b"
and lcm_gcd: "lcm a b = normalize (a * b div gcd a b)"
begin
lemma gcd_greatest_iff [simp]: "a dvd gcd b c \<longleftrightarrow> a dvd b \<and> a dvd c"
by (blast intro!: gcd_greatest intro: dvd_trans)
lemma gcd_dvdI1: "a dvd c \<Longrightarrow> gcd a b dvd c"
by (rule dvd_trans) (rule gcd_dvd1)
lemma gcd_dvdI2: "b dvd c \<Longrightarrow> gcd a b dvd c"
by (rule dvd_trans) (rule gcd_dvd2)
lemma dvd_gcdD1: "a dvd gcd b c \<Longrightarrow> a dvd b"
using gcd_dvd1 [of b c] by (blast intro: dvd_trans)
lemma dvd_gcdD2: "a dvd gcd b c \<Longrightarrow> a dvd c"
using gcd_dvd2 [of b c] by (blast intro: dvd_trans)
lemma gcd_0_left [simp]: "gcd 0 a = normalize a"
by (rule associated_eqI) simp_all
lemma gcd_0_right [simp]: "gcd a 0 = normalize a"
by (rule associated_eqI) simp_all
lemma gcd_eq_0_iff [simp]: "gcd a b = 0 \<longleftrightarrow> a = 0 \<and> b = 0"
(is "?P \<longleftrightarrow> ?Q")
proof
assume ?P
then have "0 dvd gcd a b"
by simp
then have "0 dvd a" and "0 dvd b"
by (blast intro: dvd_trans)+
then show ?Q
by simp
next
assume ?Q
then show ?P
by simp
qed
lemma unit_factor_gcd: "unit_factor (gcd a b) = (if a = 0 \<and> b = 0 then 0 else 1)"
proof (cases "gcd a b = 0")
case True
then show ?thesis by simp
next
case False
have "unit_factor (gcd a b) * normalize (gcd a b) = gcd a b"
by (rule unit_factor_mult_normalize)
then have "unit_factor (gcd a b) * gcd a b = gcd a b"
by simp
then have "unit_factor (gcd a b) * gcd a b div gcd a b = gcd a b div gcd a b"
by simp
with False show ?thesis
by simp
qed
lemma is_unit_gcd_iff [simp]:
"is_unit (gcd a b) \<longleftrightarrow> gcd a b = 1"
by (cases "a = 0 \<and> b = 0") (auto simp: unit_factor_gcd dest: is_unit_unit_factor)
sublocale gcd: abel_semigroup gcd
proof
fix a b c
show "gcd a b = gcd b a"
by (rule associated_eqI) simp_all
from gcd_dvd1 have "gcd (gcd a b) c dvd a"
by (rule dvd_trans) simp
moreover from gcd_dvd1 have "gcd (gcd a b) c dvd b"
by (rule dvd_trans) simp
ultimately have P1: "gcd (gcd a b) c dvd gcd a (gcd b c)"
by (auto intro!: gcd_greatest)
from gcd_dvd2 have "gcd a (gcd b c) dvd b"
by (rule dvd_trans) simp
moreover from gcd_dvd2 have "gcd a (gcd b c) dvd c"
by (rule dvd_trans) simp
ultimately have P2: "gcd a (gcd b c) dvd gcd (gcd a b) c"
by (auto intro!: gcd_greatest)
from P1 P2 show "gcd (gcd a b) c = gcd a (gcd b c)"
by (rule associated_eqI) simp_all
qed
sublocale gcd: bounded_quasi_semilattice gcd 0 1 normalize
proof
show "gcd a a = normalize a" for a
proof -
have "a dvd gcd a a"
by (rule gcd_greatest) simp_all
then show ?thesis
by (auto intro: associated_eqI)
qed
show "gcd (normalize a) b = gcd a b" for a b
using gcd_dvd1 [of "normalize a" b]
by (auto intro: associated_eqI)
show "gcd 1 a = 1" for a
by (rule associated_eqI) simp_all
qed simp_all
lemma gcd_self: "gcd a a = normalize a"
by (fact gcd.idem_normalize)
lemma gcd_left_idem: "gcd a (gcd a b) = gcd a b"
by (fact gcd.left_idem)
lemma gcd_right_idem: "gcd (gcd a b) b = gcd a b"
by (fact gcd.right_idem)
lemma gcdI:
assumes "c dvd a" and "c dvd b"
and greatest: "\<And>d. d dvd a \<Longrightarrow> d dvd b \<Longrightarrow> d dvd c"
and "normalize c = c"
shows "c = gcd a b"
by (rule associated_eqI) (auto simp: assms intro: gcd_greatest)
lemma gcd_unique:
"d dvd a \<and> d dvd b \<and> normalize d = d \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
by rule (auto intro: gcdI simp: gcd_greatest)
lemma gcd_dvd_prod: "gcd a b dvd k * b"
using mult_dvd_mono [of 1] by auto
lemma gcd_proj2_if_dvd: "b dvd a \<Longrightarrow> gcd a b = normalize b"
by (rule gcdI [symmetric]) simp_all
lemma gcd_proj1_if_dvd: "a dvd b \<Longrightarrow> gcd a b = normalize a"
by (rule gcdI [symmetric]) simp_all
lemma gcd_proj1_iff: "gcd m n = normalize m \<longleftrightarrow> m dvd n"
proof
assume *: "gcd m n = normalize m"
show "m dvd n"
proof (cases "m = 0")
case True
with * show ?thesis by simp
next
case [simp]: False
from * have **: "m = gcd m n * unit_factor m"
by (simp add: unit_eq_div2)
show ?thesis
by (subst **) (simp add: mult_unit_dvd_iff)
qed
next
assume "m dvd n"
then show "gcd m n = normalize m"
by (rule gcd_proj1_if_dvd)
qed
lemma gcd_proj2_iff: "gcd m n = normalize n \<longleftrightarrow> n dvd m"
using gcd_proj1_iff [of n m] by (simp add: ac_simps)
lemma gcd_mult_left: "gcd (c * a) (c * b) = normalize (c * gcd a b)"
proof (cases "c = 0")
case True
then show ?thesis by simp
next
case False
then have *: "c * gcd a b dvd gcd (c * a) (c * b)"
by (auto intro: gcd_greatest)
moreover from False * have "gcd (c * a) (c * b) dvd c * gcd a b"
by (metis div_dvd_iff_mult dvd_mult_left gcd_dvd1 gcd_dvd2 gcd_greatest mult_commute)
ultimately have "normalize (gcd (c * a) (c * b)) = normalize (c * gcd a b)"
by (auto intro: associated_eqI)
then show ?thesis
by (simp add: normalize_mult)
qed
lemma gcd_mult_right: "gcd (a * c) (b * c) = normalize (gcd b a * c)"
using gcd_mult_left [of c a b] by (simp add: ac_simps)
lemma dvd_lcm1 [iff]: "a dvd lcm a b"
by (metis div_mult_swap dvd_mult2 dvd_normalize_iff dvd_refl gcd_dvd2 lcm_gcd)
lemma dvd_lcm2 [iff]: "b dvd lcm a b"
by (metis dvd_div_mult dvd_mult dvd_normalize_iff dvd_refl gcd_dvd1 lcm_gcd)
lemma dvd_lcmI1: "a dvd b \<Longrightarrow> a dvd lcm b c"
by (rule dvd_trans) (assumption, blast)
lemma dvd_lcmI2: "a dvd c \<Longrightarrow> a dvd lcm b c"
by (rule dvd_trans) (assumption, blast)
lemma lcm_dvdD1: "lcm a b dvd c \<Longrightarrow> a dvd c"
using dvd_lcm1 [of a b] by (blast intro: dvd_trans)
lemma lcm_dvdD2: "lcm a b dvd c \<Longrightarrow> b dvd c"
using dvd_lcm2 [of a b] by (blast intro: dvd_trans)
lemma lcm_least:
assumes "a dvd c" and "b dvd c"
shows "lcm a b dvd c"
proof (cases "c = 0")
case True
then show ?thesis by simp
next
case False
then have *: "is_unit (unit_factor c)"
by simp
show ?thesis
proof (cases "gcd a b = 0")
case True
with assms show ?thesis by simp
next
case False
have "a * b dvd normalize (c * gcd a b)"
using assms by (subst gcd_mult_left [symmetric]) (auto intro!: gcd_greatest simp: mult_ac)
with False have "(a * b div gcd a b) dvd c"
by (subst div_dvd_iff_mult) auto
thus ?thesis by (simp add: lcm_gcd)
qed
qed
lemma lcm_least_iff [simp]: "lcm a b dvd c \<longleftrightarrow> a dvd c \<and> b dvd c"
by (blast intro!: lcm_least intro: dvd_trans)
lemma normalize_lcm [simp]: "normalize (lcm a b) = lcm a b"
by (simp add: lcm_gcd dvd_normalize_div)
lemma lcm_0_left [simp]: "lcm 0 a = 0"
by (simp add: lcm_gcd)
lemma lcm_0_right [simp]: "lcm a 0 = 0"
by (simp add: lcm_gcd)
lemma lcm_eq_0_iff: "lcm a b = 0 \<longleftrightarrow> a = 0 \<or> b = 0"
(is "?P \<longleftrightarrow> ?Q")
proof
assume ?P
then have "0 dvd lcm a b"
by simp
also have "lcm a b dvd (a * b)"
by simp
finally show ?Q
by auto
next
assume ?Q
then show ?P
by auto
qed
lemma zero_eq_lcm_iff: "0 = lcm a b \<longleftrightarrow> a = 0 \<or> b = 0"
using lcm_eq_0_iff[of a b] by auto
lemma lcm_eq_1_iff [simp]: "lcm a b = 1 \<longleftrightarrow> is_unit a \<and> is_unit b"
by (auto intro: associated_eqI)
lemma unit_factor_lcm: "unit_factor (lcm a b) = (if a = 0 \<or> b = 0 then 0 else 1)"
using lcm_eq_0_iff[of a b] by (cases "lcm a b = 0") (auto simp: lcm_gcd)
sublocale lcm: abel_semigroup lcm
proof
fix a b c
show "lcm a b = lcm b a"
by (simp add: lcm_gcd ac_simps normalize_mult dvd_normalize_div)
have "lcm (lcm a b) c dvd lcm a (lcm b c)"
and "lcm a (lcm b c) dvd lcm (lcm a b) c"
by (auto intro: lcm_least
dvd_trans [of b "lcm b c" "lcm a (lcm b c)"]
dvd_trans [of c "lcm b c" "lcm a (lcm b c)"]
dvd_trans [of a "lcm a b" "lcm (lcm a b) c"]
dvd_trans [of b "lcm a b" "lcm (lcm a b) c"])
then show "lcm (lcm a b) c = lcm a (lcm b c)"
by (rule associated_eqI) simp_all
qed
sublocale lcm: bounded_quasi_semilattice lcm 1 0 normalize
proof
show "lcm a a = normalize a" for a
proof -
have "lcm a a dvd a"
by (rule lcm_least) simp_all
then show ?thesis
by (auto intro: associated_eqI)
qed
show "lcm (normalize a) b = lcm a b" for a b
using dvd_lcm1 [of "normalize a" b] unfolding normalize_dvd_iff
by (auto intro: associated_eqI)
show "lcm 1 a = normalize a" for a
by (rule associated_eqI) simp_all
qed simp_all
lemma lcm_self: "lcm a a = normalize a"
by (fact lcm.idem_normalize)
lemma lcm_left_idem: "lcm a (lcm a b) = lcm a b"
by (fact lcm.left_idem)
lemma lcm_right_idem: "lcm (lcm a b) b = lcm a b"
by (fact lcm.right_idem)
lemma gcd_lcm:
assumes "a \<noteq> 0" and "b \<noteq> 0"
shows "gcd a b = normalize (a * b div lcm a b)"
proof -
from assms have [simp]: "a * b div gcd a b \<noteq> 0"
by (subst dvd_div_eq_0_iff) auto
let ?u = "unit_factor (a * b div gcd a b)"
have "gcd a b * normalize (a * b div gcd a b) =
gcd a b * ((a * b div gcd a b) * (1 div ?u))"
by simp
also have "\<dots> = a * b div ?u"
by (subst mult.assoc [symmetric]) auto
also have "\<dots> dvd a * b"
by (subst div_unit_dvd_iff) auto
finally have "gcd a b dvd ((a * b) div lcm a b)"
by (intro dvd_mult_imp_div) (auto simp: lcm_gcd)
moreover have "a * b div lcm a b dvd a" and "a * b div lcm a b dvd b"
using assms by (subst div_dvd_iff_mult; simp add: lcm_eq_0_iff mult.commute[of b "lcm a b"])+
ultimately have "normalize (gcd a b) = normalize (a * b div lcm a b)"
apply -
apply (rule associated_eqI)
using assms
apply (auto simp: div_dvd_iff_mult zero_eq_lcm_iff)
done
thus ?thesis by simp
qed
lemma lcm_1_left: "lcm 1 a = normalize a"
by (fact lcm.top_left_normalize)
lemma lcm_1_right: "lcm a 1 = normalize a"
by (fact lcm.top_right_normalize)
lemma lcm_mult_left: "lcm (c * a) (c * b) = normalize (c * lcm a b)"
proof (cases "c = 0")
case True
then show ?thesis by simp
next
case False
then have *: "lcm (c * a) (c * b) dvd c * lcm a b"
by (auto intro: lcm_least)
moreover have "lcm a b dvd lcm (c * a) (c * b) div c"
by (intro lcm_least) (auto intro!: dvd_mult_imp_div simp: mult_ac)
hence "c * lcm a b dvd lcm (c * a) (c * b)"
using False by (subst (asm) dvd_div_iff_mult) (auto simp: mult_ac intro: dvd_lcmI1)
ultimately have "normalize (lcm (c * a) (c * b)) = normalize (c * lcm a b)"
by (auto intro: associated_eqI)
then show ?thesis
by (simp add: normalize_mult)
qed
lemma lcm_mult_right: "lcm (a * c) (b * c) = normalize (lcm b a * c)"
using lcm_mult_left [of c a b] by (simp add: ac_simps)
lemma lcm_mult_unit1: "is_unit a \<Longrightarrow> lcm (b * a) c = lcm b c"
by (rule associated_eqI) (simp_all add: mult_unit_dvd_iff dvd_lcmI1)
lemma lcm_mult_unit2: "is_unit a \<Longrightarrow> lcm b (c * a) = lcm b c"
using lcm_mult_unit1 [of a c b] by (simp add: ac_simps)
lemma lcm_div_unit1:
"is_unit a \<Longrightarrow> lcm (b div a) c = lcm b c"
by (erule is_unitE [of _ b]) (simp add: lcm_mult_unit1)
lemma lcm_div_unit2: "is_unit a \<Longrightarrow> lcm b (c div a) = lcm b c"
by (erule is_unitE [of _ c]) (simp add: lcm_mult_unit2)
lemma normalize_lcm_left: "lcm (normalize a) b = lcm a b"
by (fact lcm.normalize_left_idem)
lemma normalize_lcm_right: "lcm a (normalize b) = lcm a b"
by (fact lcm.normalize_right_idem)
lemma comp_fun_idem_gcd: "comp_fun_idem gcd"
by standard (simp_all add: fun_eq_iff ac_simps)
lemma comp_fun_idem_lcm: "comp_fun_idem lcm"
by standard (simp_all add: fun_eq_iff ac_simps)
lemma gcd_dvd_antisym: "gcd a b dvd gcd c d \<Longrightarrow> gcd c d dvd gcd a b \<Longrightarrow> gcd a b = gcd c d"
proof (rule gcdI)
assume *: "gcd a b dvd gcd c d"
and **: "gcd c d dvd gcd a b"
have "gcd c d dvd c"
by simp
with * show "gcd a b dvd c"
by (rule dvd_trans)
have "gcd c d dvd d"
by simp
with * show "gcd a b dvd d"
by (rule dvd_trans)
show "normalize (gcd a b) = gcd a b"
by simp
fix l assume "l dvd c" and "l dvd d"
then have "l dvd gcd c d"
by (rule gcd_greatest)
from this and ** show "l dvd gcd a b"
by (rule dvd_trans)
qed
declare unit_factor_lcm [simp]
lemma lcmI:
assumes "a dvd c" and "b dvd c" and "\<And>d. a dvd d \<Longrightarrow> b dvd d \<Longrightarrow> c dvd d"
and "normalize c = c"
shows "c = lcm a b"
by (rule associated_eqI) (auto simp: assms intro: lcm_least)
lemma gcd_dvd_lcm [simp]: "gcd a b dvd lcm a b"
using gcd_dvd2 by (rule dvd_lcmI2)
lemmas lcm_0 = lcm_0_right
lemma lcm_unique:
"a dvd d \<and> b dvd d \<and> normalize d = d \<and> (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e) \<longleftrightarrow> d = lcm a b"
by rule (auto intro: lcmI simp: lcm_least lcm_eq_0_iff)
lemma lcm_proj1_if_dvd:
assumes "b dvd a" shows "lcm a b = normalize a"
proof -
have "normalize (lcm a b) = normalize a"
by (rule associatedI) (use assms in auto)
thus ?thesis by simp
qed
lemma lcm_proj2_if_dvd: "a dvd b \<Longrightarrow> lcm a b = normalize b"
using lcm_proj1_if_dvd [of a b] by (simp add: ac_simps)
lemma lcm_proj1_iff: "lcm m n = normalize m \<longleftrightarrow> n dvd m"
proof
assume *: "lcm m n = normalize m"
show "n dvd m"
proof (cases "m = 0")
case True
then show ?thesis by simp
next
case [simp]: False
from * have **: "m = lcm m n * unit_factor m"
by (simp add: unit_eq_div2)
show ?thesis by (subst **) simp
qed
next
assume "n dvd m"
then show "lcm m n = normalize m"
by (rule lcm_proj1_if_dvd)
qed
lemma lcm_proj2_iff: "lcm m n = normalize n \<longleftrightarrow> m dvd n"
using lcm_proj1_iff [of n m] by (simp add: ac_simps)
lemma gcd_mono: "a dvd c \<Longrightarrow> b dvd d \<Longrightarrow> gcd a b dvd gcd c d"
by (simp add: gcd_dvdI1 gcd_dvdI2)
lemma lcm_mono: "a dvd c \<Longrightarrow> b dvd d \<Longrightarrow> lcm a b dvd lcm c d"
by (simp add: dvd_lcmI1 dvd_lcmI2)
lemma dvd_productE:
assumes "p dvd a * b"
obtains x y where "p = x * y" "x dvd a" "y dvd b"
proof (cases "a = 0")
case True
thus ?thesis by (intro that[of p 1]) simp_all
next
case False
define x y where "x = gcd a p" and "y = p div x"
have "p = x * y" by (simp add: x_def y_def)
moreover have "x dvd a" by (simp add: x_def)
moreover from assms have "p dvd gcd (b * a) (b * p)"
by (intro gcd_greatest) (simp_all add: mult.commute)
hence "p dvd b * gcd a p" by (subst (asm) gcd_mult_left) auto
with False have "y dvd b"
by (simp add: x_def y_def div_dvd_iff_mult assms)
ultimately show ?thesis by (rule that)
qed
lemma gcd_mult_unit1:
assumes "is_unit a" shows "gcd (b * a) c = gcd b c"
proof -
have "gcd (b * a) c dvd b"
using assms dvd_mult_unit_iff by blast
then show ?thesis
by (rule gcdI) simp_all
qed
lemma gcd_mult_unit2: "is_unit a \<Longrightarrow> gcd b (c * a) = gcd b c"
using gcd.commute gcd_mult_unit1 by auto
lemma gcd_div_unit1: "is_unit a \<Longrightarrow> gcd (b div a) c = gcd b c"
by (erule is_unitE [of _ b]) (simp add: gcd_mult_unit1)
lemma gcd_div_unit2: "is_unit a \<Longrightarrow> gcd b (c div a) = gcd b c"
by (erule is_unitE [of _ c]) (simp add: gcd_mult_unit2)
lemma normalize_gcd_left: "gcd (normalize a) b = gcd a b"
by (fact gcd.normalize_left_idem)
lemma normalize_gcd_right: "gcd a (normalize b) = gcd a b"
by (fact gcd.normalize_right_idem)
lemma gcd_add1 [simp]: "gcd (m + n) n = gcd m n"
by (rule gcdI [symmetric]) (simp_all add: dvd_add_left_iff)
lemma gcd_add2 [simp]: "gcd m (m + n) = gcd m n"
using gcd_add1 [of n m] by (simp add: ac_simps)
lemma gcd_add_mult: "gcd m (k * m + n) = gcd m n"
by (rule gcdI [symmetric]) (simp_all add: dvd_add_right_iff)
end
class ring_gcd = comm_ring_1 + semiring_gcd
begin
lemma gcd_neg1 [simp]: "gcd (-a) b = gcd a b"
by (rule sym, rule gcdI) (simp_all add: gcd_greatest)
lemma gcd_neg2 [simp]: "gcd a (-b) = gcd a b"
by (rule sym, rule gcdI) (simp_all add: gcd_greatest)
lemma gcd_neg_numeral_1 [simp]: "gcd (- numeral n) a = gcd (numeral n) a"
by (fact gcd_neg1)
lemma gcd_neg_numeral_2 [simp]: "gcd a (- numeral n) = gcd a (numeral n)"
by (fact gcd_neg2)
lemma gcd_diff1: "gcd (m - n) n = gcd m n"
by (subst diff_conv_add_uminus, subst gcd_neg2[symmetric], subst gcd_add1, simp)
lemma gcd_diff2: "gcd (n - m) n = gcd m n"
by (subst gcd_neg1[symmetric]) (simp only: minus_diff_eq gcd_diff1)
lemma lcm_neg1 [simp]: "lcm (-a) b = lcm a b"
by (rule sym, rule lcmI) (simp_all add: lcm_least lcm_eq_0_iff)
lemma lcm_neg2 [simp]: "lcm a (-b) = lcm a b"
by (rule sym, rule lcmI) (simp_all add: lcm_least lcm_eq_0_iff)
lemma lcm_neg_numeral_1 [simp]: "lcm (- numeral n) a = lcm (numeral n) a"
by (fact lcm_neg1)
lemma lcm_neg_numeral_2 [simp]: "lcm a (- numeral n) = lcm a (numeral n)"
by (fact lcm_neg2)
end
class semiring_Gcd = semiring_gcd + Gcd +
assumes Gcd_dvd: "a \<in> A \<Longrightarrow> Gcd A dvd a"
and Gcd_greatest: "(\<And>b. b \<in> A \<Longrightarrow> a dvd b) \<Longrightarrow> a dvd Gcd A"
and normalize_Gcd [simp]: "normalize (Gcd A) = Gcd A"
assumes dvd_Lcm: "a \<in> A \<Longrightarrow> a dvd Lcm A"
and Lcm_least: "(\<And>b. b \<in> A \<Longrightarrow> b dvd a) \<Longrightarrow> Lcm A dvd a"
and normalize_Lcm [simp]: "normalize (Lcm A) = Lcm A"
begin
lemma Lcm_Gcd: "Lcm A = Gcd {b. \<forall>a\<in>A. a dvd b}"
by (rule associated_eqI) (auto intro: Gcd_dvd dvd_Lcm Gcd_greatest Lcm_least)
lemma Gcd_Lcm: "Gcd A = Lcm {b. \<forall>a\<in>A. b dvd a}"
by (rule associated_eqI) (auto intro: Gcd_dvd dvd_Lcm Gcd_greatest Lcm_least)
lemma Gcd_empty [simp]: "Gcd {} = 0"
by (rule dvd_0_left, rule Gcd_greatest) simp
lemma Lcm_empty [simp]: "Lcm {} = 1"
by (auto intro: associated_eqI Lcm_least)
lemma Gcd_insert [simp]: "Gcd (insert a A) = gcd a (Gcd A)"
proof -
have "Gcd (insert a A) dvd gcd a (Gcd A)"
by (auto intro: Gcd_dvd Gcd_greatest)
moreover have "gcd a (Gcd A) dvd Gcd (insert a A)"
proof (rule Gcd_greatest)
fix b
assume "b \<in> insert a A"
then show "gcd a (Gcd A) dvd b"
proof
assume "b = a"
then show ?thesis
by simp
next
assume "b \<in> A"
then have "Gcd A dvd b"
by (rule Gcd_dvd)
moreover have "gcd a (Gcd A) dvd Gcd A"
by simp
ultimately show ?thesis
by (blast intro: dvd_trans)
qed
qed
ultimately show ?thesis
by (auto intro: associated_eqI)
qed
lemma Lcm_insert [simp]: "Lcm (insert a A) = lcm a (Lcm A)"
proof (rule sym)
have "lcm a (Lcm A) dvd Lcm (insert a A)"
by (auto intro: dvd_Lcm Lcm_least)
moreover have "Lcm (insert a A) dvd lcm a (Lcm A)"
proof (rule Lcm_least)
fix b
assume "b \<in> insert a A"
then show "b dvd lcm a (Lcm A)"
proof
assume "b = a"
then show ?thesis by simp
next
assume "b \<in> A"
then have "b dvd Lcm A"
by (rule dvd_Lcm)
moreover have "Lcm A dvd lcm a (Lcm A)"
by simp
ultimately show ?thesis
by (blast intro: dvd_trans)
qed
qed
ultimately show "lcm a (Lcm A) = Lcm (insert a A)"
by (rule associated_eqI) (simp_all add: lcm_eq_0_iff)
qed
lemma LcmI:
assumes "\<And>a. a \<in> A \<Longrightarrow> a dvd b"
and "\<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> b dvd c"
and "normalize b = b"
shows "b = Lcm A"
by (rule associated_eqI) (auto simp: assms dvd_Lcm intro: Lcm_least)
lemma Lcm_subset: "A \<subseteq> B \<Longrightarrow> Lcm A dvd Lcm B"
by (blast intro: Lcm_least dvd_Lcm)
lemma Lcm_Un: "Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)"
proof -
have "\<And>d. \<lbrakk>Lcm A dvd d; Lcm B dvd d\<rbrakk> \<Longrightarrow> Lcm (A \<union> B) dvd d"
by (meson UnE Lcm_least dvd_Lcm dvd_trans)
then show ?thesis
by (meson Lcm_subset lcm_unique normalize_Lcm sup.cobounded1 sup.cobounded2)
qed
lemma Gcd_0_iff [simp]: "Gcd A = 0 \<longleftrightarrow> A \<subseteq> {0}"
(is "?P \<longleftrightarrow> ?Q")
proof
assume ?P
show ?Q
proof
fix a
assume "a \<in> A"
then have "Gcd A dvd a"
by (rule Gcd_dvd)
with \<open>?P\<close> have "a = 0"
by simp
then show "a \<in> {0}"
by simp
qed
next
assume ?Q
have "0 dvd Gcd A"
proof (rule Gcd_greatest)
fix a
assume "a \<in> A"
with \<open>?Q\<close> have "a = 0"
by auto
then show "0 dvd a"
by simp
qed
then show ?P
by simp
qed
lemma Lcm_1_iff [simp]: "Lcm A = 1 \<longleftrightarrow> (\<forall>a\<in>A. is_unit a)"
(is "?P \<longleftrightarrow> ?Q")
proof
assume ?P
show ?Q
proof
fix a
assume "a \<in> A"
then have "a dvd Lcm A"
by (rule dvd_Lcm)
with \<open>?P\<close> show "is_unit a"
by simp
qed
next
assume ?Q
then have "is_unit (Lcm A)"
by (blast intro: Lcm_least)
then have "normalize (Lcm A) = 1"
by (rule is_unit_normalize)
then show ?P
by simp
qed
lemma unit_factor_Lcm: "unit_factor (Lcm A) = (if Lcm A = 0 then 0 else 1)"
proof (cases "Lcm A = 0")
case True
then show ?thesis
by simp
next
case False
with unit_factor_normalize have "unit_factor (normalize (Lcm A)) = 1"
by blast
with False show ?thesis
by simp
qed
lemma unit_factor_Gcd: "unit_factor (Gcd A) = (if Gcd A = 0 then 0 else 1)"
by (simp add: Gcd_Lcm unit_factor_Lcm)
lemma GcdI:
assumes "\<And>a. a \<in> A \<Longrightarrow> b dvd a"
and "\<And>c. (\<And>a. a \<in> A \<Longrightarrow> c dvd a) \<Longrightarrow> c dvd b"
and "normalize b = b"
shows "b = Gcd A"
by (rule associated_eqI) (auto simp: assms Gcd_dvd intro: Gcd_greatest)
lemma Gcd_eq_1_I:
assumes "is_unit a" and "a \<in> A"
shows "Gcd A = 1"
proof -
from assms have "is_unit (Gcd A)"
by (blast intro: Gcd_dvd dvd_unit_imp_unit)
then have "normalize (Gcd A) = 1"
by (rule is_unit_normalize)
then show ?thesis
by simp
qed
lemma Lcm_eq_0_I:
assumes "0 \<in> A"
shows "Lcm A = 0"
proof -
from assms have "0 dvd Lcm A"
by (rule dvd_Lcm)
then show ?thesis
by simp
qed
lemma Gcd_UNIV [simp]: "Gcd UNIV = 1"
using dvd_refl by (rule Gcd_eq_1_I) simp
lemma Lcm_UNIV [simp]: "Lcm UNIV = 0"
by (rule Lcm_eq_0_I) simp
lemma Lcm_0_iff:
assumes "finite A"
shows "Lcm A = 0 \<longleftrightarrow> 0 \<in> A"
proof (cases "A = {}")
case True
then show ?thesis by simp
next
case False
with assms show ?thesis
by (induct A rule: finite_ne_induct) (auto simp: lcm_eq_0_iff)
qed
lemma Gcd_image_normalize [simp]: "Gcd (normalize ` A) = Gcd A"
proof -
have "Gcd (normalize ` A) dvd a" if "a \<in> A" for a
proof -
from that obtain B where "A = insert a B"
by blast
moreover have "gcd (normalize a) (Gcd (normalize ` B)) dvd normalize a"
by (rule gcd_dvd1)
ultimately show "Gcd (normalize ` A) dvd a"
by simp
qed
then have "Gcd (normalize ` A) dvd Gcd A" and "Gcd A dvd Gcd (normalize ` A)"
by (auto intro!: Gcd_greatest intro: Gcd_dvd)
then show ?thesis
by (auto intro: associated_eqI)
qed
lemma Gcd_eqI:
assumes "normalize a = a"
assumes "\<And>b. b \<in> A \<Longrightarrow> a dvd b"
and "\<And>c. (\<And>b. b \<in> A \<Longrightarrow> c dvd b) \<Longrightarrow> c dvd a"
shows "Gcd A = a"
using assms by (blast intro: associated_eqI Gcd_greatest Gcd_dvd normalize_Gcd)
lemma dvd_GcdD: "x dvd Gcd A \<Longrightarrow> y \<in> A \<Longrightarrow> x dvd y"
using Gcd_dvd dvd_trans by blast
lemma dvd_Gcd_iff: "x dvd Gcd A \<longleftrightarrow> (\<forall>y\<in>A. x dvd y)"
by (blast dest: dvd_GcdD intro: Gcd_greatest)
lemma Gcd_mult: "Gcd ((*) c ` A) = normalize (c * Gcd A)"
proof (cases "c = 0")
case True
then show ?thesis by auto
next
case [simp]: False
have "Gcd ((*) c ` A) div c dvd Gcd A"
by (intro Gcd_greatest, subst div_dvd_iff_mult)
(auto intro!: Gcd_greatest Gcd_dvd simp: mult.commute[of _ c])
then have "Gcd ((*) c ` A) dvd c * Gcd A"
by (subst (asm) div_dvd_iff_mult) (auto intro: Gcd_greatest simp: mult_ac)
moreover have "c * Gcd A dvd Gcd ((*) c ` A)"
by (intro Gcd_greatest) (auto intro: mult_dvd_mono Gcd_dvd)
ultimately have "normalize (Gcd ((*) c ` A)) = normalize (c * Gcd A)"
by (rule associatedI)
then show ?thesis by simp
qed
lemma Lcm_eqI:
assumes "normalize a = a"
and "\<And>b. b \<in> A \<Longrightarrow> b dvd a"
and "\<And>c. (\<And>b. b \<in> A \<Longrightarrow> b dvd c) \<Longrightarrow> a dvd c"
shows "Lcm A = a"
using assms by (blast intro: associated_eqI Lcm_least dvd_Lcm normalize_Lcm)
lemma Lcm_dvdD: "Lcm A dvd x \<Longrightarrow> y \<in> A \<Longrightarrow> y dvd x"
using dvd_Lcm dvd_trans by blast
lemma Lcm_dvd_iff: "Lcm A dvd x \<longleftrightarrow> (\<forall>y\<in>A. y dvd x)"
by (blast dest: Lcm_dvdD intro: Lcm_least)
lemma Lcm_mult:
assumes "A \<noteq> {}"
shows "Lcm ((*) c ` A) = normalize (c * Lcm A)"
proof (cases "c = 0")
case True
with assms have "(*) c ` A = {0}"
by auto
with True show ?thesis by auto
next
case [simp]: False
from assms obtain x where x: "x \<in> A"
by blast
have "c dvd c * x"
by simp
also from x have "c * x dvd Lcm ((*) c ` A)"
by (intro dvd_Lcm) auto
finally have dvd: "c dvd Lcm ((*) c ` A)" .
moreover have "Lcm A dvd Lcm ((*) c ` A) div c"
by (intro Lcm_least dvd_mult_imp_div)
(auto intro!: Lcm_least dvd_Lcm simp: mult.commute[of _ c])
ultimately have "c * Lcm A dvd Lcm ((*) c ` A)"
by auto
moreover have "Lcm ((*) c ` A) dvd c * Lcm A"
by (intro Lcm_least) (auto intro: mult_dvd_mono dvd_Lcm)
ultimately have "normalize (c * Lcm A) = normalize (Lcm ((*) c ` A))"
by (rule associatedI)
then show ?thesis by simp
qed
lemma Lcm_no_units: "Lcm A = Lcm (A - {a. is_unit a})"
proof -
have "(A - {a. is_unit a}) \<union> {a\<in>A. is_unit a} = A"
by blast
then have "Lcm A = lcm (Lcm (A - {a. is_unit a})) (Lcm {a\<in>A. is_unit a})"
by (simp add: Lcm_Un [symmetric])
also have "Lcm {a\<in>A. is_unit a} = 1"
by simp
finally show ?thesis
by simp
qed
lemma Lcm_0_iff': "Lcm A = 0 \<longleftrightarrow> (\<nexists>l. l \<noteq> 0 \<and> (\<forall>a\<in>A. a dvd l))"
by (metis Lcm_least dvd_0_left dvd_Lcm)
lemma Lcm_no_multiple: "(\<forall>m. m \<noteq> 0 \<longrightarrow> (\<exists>a\<in>A. \<not> a dvd m)) \<Longrightarrow> Lcm A = 0"
by (auto simp: Lcm_0_iff')
lemma Lcm_singleton [simp]: "Lcm {a} = normalize a"
by simp
lemma Lcm_2 [simp]: "Lcm {a, b} = lcm a b"
by simp
lemma Gcd_1: "1 \<in> A \<Longrightarrow> Gcd A = 1"
by (auto intro!: Gcd_eq_1_I)
lemma Gcd_singleton [simp]: "Gcd {a} = normalize a"
by simp
lemma Gcd_2 [simp]: "Gcd {a, b} = gcd a b"
by simp
lemma Gcd_mono:
assumes "\<And>x. x \<in> A \<Longrightarrow> f x dvd g x"
shows "(GCD x\<in>A. f x) dvd (GCD x\<in>A. g x)"
proof (intro Gcd_greatest, safe)
fix x assume "x \<in> A"
hence "(GCD x\<in>A. f x) dvd f x"
by (intro Gcd_dvd) auto
also have "f x dvd g x"
using \<open>x \<in> A\<close> assms by blast
finally show "(GCD x\<in>A. f x) dvd \<dots>" .
qed
lemma Lcm_mono:
assumes "\<And>x. x \<in> A \<Longrightarrow> f x dvd g x"
shows "(LCM x\<in>A. f x) dvd (LCM x\<in>A. g x)"
proof (intro Lcm_least, safe)
fix x assume "x \<in> A"
hence "f x dvd g x" by (rule assms)
also have "g x dvd (LCM x\<in>A. g x)"
using \<open>x \<in> A\<close> by (intro dvd_Lcm) auto
finally show "f x dvd \<dots>" .
qed
end
subsection \<open>An aside: GCD and LCM on finite sets for incomplete gcd rings\<close>
context semiring_gcd
begin
sublocale Gcd_fin: bounded_quasi_semilattice_set gcd 0 1 normalize
defines
Gcd_fin ("Gcd\<^sub>f\<^sub>i\<^sub>n") = "Gcd_fin.F :: 'a set \<Rightarrow> 'a" ..
abbreviation gcd_list :: "'a list \<Rightarrow> 'a"
where "gcd_list xs \<equiv> Gcd\<^sub>f\<^sub>i\<^sub>n (set xs)"
sublocale Lcm_fin: bounded_quasi_semilattice_set lcm 1 0 normalize
defines
Lcm_fin ("Lcm\<^sub>f\<^sub>i\<^sub>n") = Lcm_fin.F ..
abbreviation lcm_list :: "'a list \<Rightarrow> 'a"
where "lcm_list xs \<equiv> Lcm\<^sub>f\<^sub>i\<^sub>n (set xs)"
lemma Gcd_fin_dvd:
"a \<in> A \<Longrightarrow> Gcd\<^sub>f\<^sub>i\<^sub>n A dvd a"
by (induct A rule: infinite_finite_induct)
(auto intro: dvd_trans)
lemma dvd_Lcm_fin:
"a \<in> A \<Longrightarrow> a dvd Lcm\<^sub>f\<^sub>i\<^sub>n A"
by (induct A rule: infinite_finite_induct)
(auto intro: dvd_trans)
lemma Gcd_fin_greatest:
"a dvd Gcd\<^sub>f\<^sub>i\<^sub>n A" if "finite A" and "\<And>b. b \<in> A \<Longrightarrow> a dvd b"
using that by (induct A) simp_all
lemma Lcm_fin_least:
"Lcm\<^sub>f\<^sub>i\<^sub>n A dvd a" if "finite A" and "\<And>b. b \<in> A \<Longrightarrow> b dvd a"
using that by (induct A) simp_all
lemma gcd_list_greatest:
"a dvd gcd_list bs" if "\<And>b. b \<in> set bs \<Longrightarrow> a dvd b"
by (rule Gcd_fin_greatest) (simp_all add: that)
lemma lcm_list_least:
"lcm_list bs dvd a" if "\<And>b. b \<in> set bs \<Longrightarrow> b dvd a"
by (rule Lcm_fin_least) (simp_all add: that)
lemma dvd_Gcd_fin_iff:
"b dvd Gcd\<^sub>f\<^sub>i\<^sub>n A \<longleftrightarrow> (\<forall>a\<in>A. b dvd a)" if "finite A"
using that by (auto intro: Gcd_fin_greatest Gcd_fin_dvd dvd_trans [of b "Gcd\<^sub>f\<^sub>i\<^sub>n A"])
lemma dvd_gcd_list_iff:
"b dvd gcd_list xs \<longleftrightarrow> (\<forall>a\<in>set xs. b dvd a)"
by (simp add: dvd_Gcd_fin_iff)
lemma Lcm_fin_dvd_iff:
"Lcm\<^sub>f\<^sub>i\<^sub>n A dvd b \<longleftrightarrow> (\<forall>a\<in>A. a dvd b)" if "finite A"
using that by (auto intro: Lcm_fin_least dvd_Lcm_fin dvd_trans [of _ "Lcm\<^sub>f\<^sub>i\<^sub>n A" b])
lemma lcm_list_dvd_iff:
"lcm_list xs dvd b \<longleftrightarrow> (\<forall>a\<in>set xs. a dvd b)"
by (simp add: Lcm_fin_dvd_iff)
lemma Gcd_fin_mult:
"Gcd\<^sub>f\<^sub>i\<^sub>n (image (times b) A) = normalize (b * Gcd\<^sub>f\<^sub>i\<^sub>n A)" if "finite A"
using that by induction (auto simp: gcd_mult_left)
lemma Lcm_fin_mult:
"Lcm\<^sub>f\<^sub>i\<^sub>n (image (times b) A) = normalize (b * Lcm\<^sub>f\<^sub>i\<^sub>n A)" if "A \<noteq> {}"
proof (cases "b = 0")
case True
moreover from that have "times 0 ` A = {0}"
by auto
ultimately show ?thesis
by simp
next
case False
show ?thesis proof (cases "finite A")
case False
moreover have "inj_on (times b) A"
using \<open>b \<noteq> 0\<close> by (rule inj_on_mult)
ultimately have "infinite (times b ` A)"
by (simp add: finite_image_iff)
with False show ?thesis
by simp
next
case True
then show ?thesis using that
by (induct A rule: finite_ne_induct) (auto simp: lcm_mult_left)
qed
qed
lemma unit_factor_Gcd_fin:
"unit_factor (Gcd\<^sub>f\<^sub>i\<^sub>n A) = of_bool (Gcd\<^sub>f\<^sub>i\<^sub>n A \<noteq> 0)"
by (rule normalize_idem_imp_unit_factor_eq) simp
lemma unit_factor_Lcm_fin:
"unit_factor (Lcm\<^sub>f\<^sub>i\<^sub>n A) = of_bool (Lcm\<^sub>f\<^sub>i\<^sub>n A \<noteq> 0)"
by (rule normalize_idem_imp_unit_factor_eq) simp
lemma is_unit_Gcd_fin_iff [simp]:
"is_unit (Gcd\<^sub>f\<^sub>i\<^sub>n A) \<longleftrightarrow> Gcd\<^sub>f\<^sub>i\<^sub>n A = 1"
by (rule normalize_idem_imp_is_unit_iff) simp
lemma is_unit_Lcm_fin_iff [simp]:
"is_unit (Lcm\<^sub>f\<^sub>i\<^sub>n A) \<longleftrightarrow> Lcm\<^sub>f\<^sub>i\<^sub>n A = 1"
by (rule normalize_idem_imp_is_unit_iff) simp
lemma Gcd_fin_0_iff:
"Gcd\<^sub>f\<^sub>i\<^sub>n A = 0 \<longleftrightarrow> A \<subseteq> {0} \<and> finite A"
by (induct A rule: infinite_finite_induct) simp_all
lemma Lcm_fin_0_iff:
"Lcm\<^sub>f\<^sub>i\<^sub>n A = 0 \<longleftrightarrow> 0 \<in> A" if "finite A"
using that by (induct A) (auto simp: lcm_eq_0_iff)
lemma Lcm_fin_1_iff:
"Lcm\<^sub>f\<^sub>i\<^sub>n A = 1 \<longleftrightarrow> (\<forall>a\<in>A. is_unit a) \<and> finite A"
by (induct A rule: infinite_finite_induct) simp_all
end
context semiring_Gcd
begin
lemma Gcd_fin_eq_Gcd [simp]:
"Gcd\<^sub>f\<^sub>i\<^sub>n A = Gcd A" if "finite A" for A :: "'a set"
using that by induct simp_all
lemma Gcd_set_eq_fold [code_unfold]:
"Gcd (set xs) = fold gcd xs 0"
by (simp add: Gcd_fin.set_eq_fold [symmetric])
lemma Lcm_fin_eq_Lcm [simp]:
"Lcm\<^sub>f\<^sub>i\<^sub>n A = Lcm A" if "finite A" for A :: "'a set"
using that by induct simp_all
lemma Lcm_set_eq_fold [code_unfold]:
"Lcm (set xs) = fold lcm xs 1"
by (simp add: Lcm_fin.set_eq_fold [symmetric])
end
subsection \<open>Coprimality\<close>
context semiring_gcd
begin
lemma coprime_imp_gcd_eq_1 [simp]:
"gcd a b = 1" if "coprime a b"
proof -
define t r s where "t = gcd a b" and "r = a div t" and "s = b div t"
then have "a = t * r" and "b = t * s"
by simp_all
with that have "coprime (t * r) (t * s)"
by simp
then show ?thesis
by (simp add: t_def)
qed
lemma gcd_eq_1_imp_coprime [dest!]:
"coprime a b" if "gcd a b = 1"
proof (rule coprimeI)
fix c
assume "c dvd a" and "c dvd b"
then have "c dvd gcd a b"
by (rule gcd_greatest)
with that show "is_unit c"
by simp
qed
lemma coprime_iff_gcd_eq_1 [presburger, code]:
"coprime a b \<longleftrightarrow> gcd a b = 1"
by rule (simp_all add: gcd_eq_1_imp_coprime)
lemma is_unit_gcd [simp]:
"is_unit (gcd a b) \<longleftrightarrow> coprime a b"
by (simp add: coprime_iff_gcd_eq_1)
lemma coprime_add_one_left [simp]: "coprime (a + 1) a"
by (simp add: gcd_eq_1_imp_coprime ac_simps)
lemma coprime_add_one_right [simp]: "coprime a (a + 1)"
using coprime_add_one_left [of a] by (simp add: ac_simps)
lemma coprime_mult_left_iff [simp]:
"coprime (a * b) c \<longleftrightarrow> coprime a c \<and> coprime b c"
proof
assume "coprime (a * b) c"
with coprime_common_divisor [of "a * b" c]
have *: "is_unit d" if "d dvd a * b" and "d dvd c" for d
using that by blast
have "coprime a c"
by (rule coprimeI, rule *) simp_all
moreover have "coprime b c"
by (rule coprimeI, rule *) simp_all
ultimately show "coprime a c \<and> coprime b c" ..
next
assume "coprime a c \<and> coprime b c"
then have "coprime a c" "coprime b c"
by simp_all
show "coprime (a * b) c"
proof (rule coprimeI)
fix d
assume "d dvd a * b"
then obtain r s where d: "d = r * s" "r dvd a" "s dvd b"
by (rule dvd_productE)
assume "d dvd c"
with d have "r * s dvd c"
by simp
then have "r dvd c" "s dvd c"
by (auto intro: dvd_mult_left dvd_mult_right)
from \<open>coprime a c\<close> \<open>r dvd a\<close> \<open>r dvd c\<close>
have "is_unit r"
by (rule coprime_common_divisor)
moreover from \<open>coprime b c\<close> \<open>s dvd b\<close> \<open>s dvd c\<close>
have "is_unit s"
by (rule coprime_common_divisor)
ultimately show "is_unit d"
by (simp add: d is_unit_mult_iff)
qed
qed
lemma coprime_mult_right_iff [simp]:
"coprime c (a * b) \<longleftrightarrow> coprime c a \<and> coprime c b"
using coprime_mult_left_iff [of a b c] by (simp add: ac_simps)
lemma coprime_power_left_iff [simp]:
"coprime (a ^ n) b \<longleftrightarrow> coprime a b \<or> n = 0"
proof (cases "n = 0")
case True
then show ?thesis
by simp
next
case False
then have "n > 0"
by simp
then show ?thesis
by (induction n rule: nat_induct_non_zero) simp_all
qed
lemma coprime_power_right_iff [simp]:
"coprime a (b ^ n) \<longleftrightarrow> coprime a b \<or> n = 0"
using coprime_power_left_iff [of b n a] by (simp add: ac_simps)
lemma prod_coprime_left:
"coprime (\<Prod>i\<in>A. f i) a" if "\<And>i. i \<in> A \<Longrightarrow> coprime (f i) a"
using that by (induct A rule: infinite_finite_induct) simp_all
lemma prod_coprime_right:
"coprime a (\<Prod>i\<in>A. f i)" if "\<And>i. i \<in> A \<Longrightarrow> coprime a (f i)"
using that prod_coprime_left [of A f a] by (simp add: ac_simps)
lemma prod_list_coprime_left:
"coprime (prod_list xs) a" if "\<And>x. x \<in> set xs \<Longrightarrow> coprime x a"
using that by (induct xs) simp_all
lemma prod_list_coprime_right:
"coprime a (prod_list xs)" if "\<And>x. x \<in> set xs \<Longrightarrow> coprime a x"
using that prod_list_coprime_left [of xs a] by (simp add: ac_simps)
lemma coprime_dvd_mult_left_iff:
"a dvd b * c \<longleftrightarrow> a dvd b" if "coprime a c"
proof
assume "a dvd b"
then show "a dvd b * c"
by simp
next
assume "a dvd b * c"
show "a dvd b"
proof (cases "b = 0")
case True
then show ?thesis
by simp
next
case False
then have unit: "is_unit (unit_factor b)"
by simp
from \<open>coprime a c\<close>
have "gcd (b * a) (b * c) * unit_factor b = b"
by (subst gcd_mult_left) (simp add: ac_simps)
moreover from \<open>a dvd b * c\<close>
have "a dvd gcd (b * a) (b * c) * unit_factor b"
by (simp add: dvd_mult_unit_iff unit)
ultimately show ?thesis
by simp
qed
qed
lemma coprime_dvd_mult_right_iff:
"a dvd c * b \<longleftrightarrow> a dvd b" if "coprime a c"
using that coprime_dvd_mult_left_iff [of a c b] by (simp add: ac_simps)
lemma divides_mult:
"a * b dvd c" if "a dvd c" and "b dvd c" and "coprime a b"
proof -
from \<open>b dvd c\<close> obtain b' where "c = b * b'" ..
with \<open>a dvd c\<close> have "a dvd b' * b"
by (simp add: ac_simps)
with \<open>coprime a b\<close> have "a dvd b'"
by (simp add: coprime_dvd_mult_left_iff)
then obtain a' where "b' = a * a'" ..
with \<open>c = b * b'\<close> have "c = (a * b) * a'"
by (simp add: ac_simps)
then show ?thesis ..
qed
lemma div_gcd_coprime:
assumes "a \<noteq> 0 \<or> b \<noteq> 0"
shows "coprime (a div gcd a b) (b div gcd a b)"
proof -
let ?g = "gcd a b"
let ?a' = "a div ?g"
let ?b' = "b div ?g"
let ?g' = "gcd ?a' ?b'"
have dvdg: "?g dvd a" "?g dvd b"
by simp_all
have dvdg': "?g' dvd ?a'" "?g' dvd ?b'"
by simp_all
from dvdg dvdg' obtain ka kb ka' kb' where
kab: "a = ?g * ka" "b = ?g * kb" "?a' = ?g' * ka'" "?b' = ?g' * kb'"
unfolding dvd_def by blast
from this [symmetric] have "?g * ?a' = (?g * ?g') * ka'" "?g * ?b' = (?g * ?g') * kb'"
by (simp_all add: mult.assoc mult.left_commute [of "gcd a b"])
then have dvdgg':"?g * ?g' dvd a" "?g* ?g' dvd b"
by (auto simp: dvd_mult_div_cancel [OF dvdg(1)] dvd_mult_div_cancel [OF dvdg(2)] dvd_def)
have "?g \<noteq> 0"
using assms by simp
moreover from gcd_greatest [OF dvdgg'] have "?g * ?g' dvd ?g" .
ultimately show ?thesis
using dvd_times_left_cancel_iff [of "gcd a b" _ 1]
by simp (simp only: coprime_iff_gcd_eq_1)
qed
lemma gcd_coprime:
assumes c: "gcd a b \<noteq> 0"
and a: "a = a' * gcd a b"
and b: "b = b' * gcd a b"
shows "coprime a' b'"
proof -
from c have "a \<noteq> 0 \<or> b \<noteq> 0"
by simp
with div_gcd_coprime have "coprime (a div gcd a b) (b div gcd a b)" .
also from assms have "a div gcd a b = a'"
using dvd_div_eq_mult gcd_dvd1 by blast
also from assms have "b div gcd a b = b'"
using dvd_div_eq_mult gcd_dvd1 by blast
finally show ?thesis .
qed
lemma gcd_coprime_exists:
assumes "gcd a b \<noteq> 0"
shows "\<exists>a' b'. a = a' * gcd a b \<and> b = b' * gcd a b \<and> coprime a' b'"
proof -
have "coprime (a div gcd a b) (b div gcd a b)"
using assms div_gcd_coprime by auto
then show ?thesis
by force
qed
lemma pow_divides_pow_iff [simp]:
"a ^ n dvd b ^ n \<longleftrightarrow> a dvd b" if "n > 0"
proof (cases "gcd a b = 0")
case True
then show ?thesis
by simp
next
case False
show ?thesis
proof
let ?d = "gcd a b"
from \<open>n > 0\<close> obtain m where m: "n = Suc m"
by (cases n) simp_all
from False have zn: "?d ^ n \<noteq> 0"
by (rule power_not_zero)
from gcd_coprime_exists [OF False]
obtain a' b' where ab': "a = a' * ?d" "b = b' * ?d" "coprime a' b'"
by blast
assume "a ^ n dvd b ^ n"
then have "(a' * ?d) ^ n dvd (b' * ?d) ^ n"
by (simp add: ab'(1,2)[symmetric])
then have "?d^n * a'^n dvd ?d^n * b'^n"
by (simp only: power_mult_distrib ac_simps)
with zn have "a' ^ n dvd b' ^ n"
by simp
then have "a' dvd b' ^ n"
using dvd_trans[of a' "a'^n" "b'^n"] by (simp add: m)
then have "a' dvd b' ^ m * b'"
by (simp add: m ac_simps)
moreover have "coprime a' (b' ^ n)"
using \<open>coprime a' b'\<close> by simp
then have "a' dvd b'"
using \<open>a' dvd b' ^ n\<close> coprime_dvd_mult_left_iff dvd_mult by blast
then have "a' * ?d dvd b' * ?d"
by (rule mult_dvd_mono) simp
with ab'(1,2) show "a dvd b"
by simp
next
assume "a dvd b"
with \<open>n > 0\<close> show "a ^ n dvd b ^ n"
by (induction rule: nat_induct_non_zero)
(simp_all add: mult_dvd_mono)
qed
qed
lemma coprime_crossproduct:
fixes a b c d :: 'a
assumes "coprime a d" and "coprime b c"
shows "normalize a * normalize c = normalize b * normalize d \<longleftrightarrow>
normalize a = normalize b \<and> normalize c = normalize d"
(is "?lhs \<longleftrightarrow> ?rhs")
proof
assume ?rhs
then show ?lhs by simp
next
assume ?lhs
from \<open>?lhs\<close> have "normalize a dvd normalize b * normalize d"
by (auto intro: dvdI dest: sym)
with \<open>coprime a d\<close> have "a dvd b"
by (simp add: coprime_dvd_mult_left_iff normalize_mult [symmetric])
from \<open>?lhs\<close> have "normalize b dvd normalize a * normalize c"
by (auto intro: dvdI dest: sym)
with \<open>coprime b c\<close> have "b dvd a"
by (simp add: coprime_dvd_mult_left_iff normalize_mult [symmetric])
from \<open>?lhs\<close> have "normalize c dvd normalize d * normalize b"
by (auto intro: dvdI dest: sym simp add: mult.commute)
with \<open>coprime b c\<close> have "c dvd d"
by (simp add: coprime_dvd_mult_left_iff coprime_commute normalize_mult [symmetric])
from \<open>?lhs\<close> have "normalize d dvd normalize c * normalize a"
by (auto intro: dvdI dest: sym simp add: mult.commute)
with \<open>coprime a d\<close> have "d dvd c"
by (simp add: coprime_dvd_mult_left_iff coprime_commute normalize_mult [symmetric])
from \<open>a dvd b\<close> \<open>b dvd a\<close> have "normalize a = normalize b"
by (rule associatedI)
moreover from \<open>c dvd d\<close> \<open>d dvd c\<close> have "normalize c = normalize d"
by (rule associatedI)
ultimately show ?rhs ..
qed
lemma gcd_mult_left_left_cancel:
"gcd (c * a) b = gcd a b" if "coprime b c"
proof -
have "coprime (gcd b (a * c)) c"
by (rule coprimeI) (auto intro: that coprime_common_divisor)
then have "gcd b (a * c) dvd a"
using coprime_dvd_mult_left_iff [of "gcd b (a * c)" c a]
by simp
then show ?thesis
by (auto intro: associated_eqI simp add: ac_simps)
qed
lemma gcd_mult_left_right_cancel:
"gcd (a * c) b = gcd a b" if "coprime b c"
using that gcd_mult_left_left_cancel [of b c a]
by (simp add: ac_simps)
lemma gcd_mult_right_left_cancel:
"gcd a (c * b) = gcd a b" if "coprime a c"
using that gcd_mult_left_left_cancel [of a c b]
by (simp add: ac_simps)
lemma gcd_mult_right_right_cancel:
"gcd a (b * c) = gcd a b" if "coprime a c"
using that gcd_mult_right_left_cancel [of a c b]
by (simp add: ac_simps)
lemma gcd_exp_weak:
"gcd (a ^ n) (b ^ n) = normalize (gcd a b ^ n)"
proof (cases "a = 0 \<and> b = 0 \<or> n = 0")
case True
then show ?thesis
by (cases n) simp_all
next
case False
then have "coprime (a div gcd a b) (b div gcd a b)" and "n > 0"
by (auto intro: div_gcd_coprime)
then have "coprime ((a div gcd a b) ^ n) ((b div gcd a b) ^ n)"
by simp
then have "1 = gcd ((a div gcd a b) ^ n) ((b div gcd a b) ^ n)"
by simp
then have "normalize (gcd a b ^ n) = normalize (gcd a b ^ n * \<dots>)"
by simp
also have "\<dots> = gcd (gcd a b ^ n * (a div gcd a b) ^ n) (gcd a b ^ n * (b div gcd a b) ^ n)"
by (rule gcd_mult_left [symmetric])
also have "(gcd a b) ^ n * (a div gcd a b) ^ n = a ^ n"
by (simp add: ac_simps div_power dvd_power_same)
also have "(gcd a b) ^ n * (b div gcd a b) ^ n = b ^ n"
by (simp add: ac_simps div_power dvd_power_same)
finally show ?thesis by simp
qed
lemma division_decomp:
assumes "a dvd b * c"
shows "\<exists>b' c'. a = b' * c' \<and> b' dvd b \<and> c' dvd c"
proof (cases "gcd a b = 0")
case True
then have "a = 0 \<and> b = 0"
by simp
then have "a = 0 * c \<and> 0 dvd b \<and> c dvd c"
by simp
then show ?thesis by blast
next
case False
let ?d = "gcd a b"
from gcd_coprime_exists [OF False]
obtain a' b' where ab': "a = a' * ?d" "b = b' * ?d" "coprime a' b'"
by blast
from ab'(1) have "a' dvd a" ..
with assms have "a' dvd b * c"
using dvd_trans [of a' a "b * c"] by simp
from assms ab'(1,2) have "a' * ?d dvd (b' * ?d) * c"
by simp
then have "?d * a' dvd ?d * (b' * c)"
by (simp add: mult_ac)
with \<open>?d \<noteq> 0\<close> have "a' dvd b' * c"
by simp
then have "a' dvd c"
using \<open>coprime a' b'\<close> by (simp add: coprime_dvd_mult_right_iff)
with ab'(1) have "a = ?d * a' \<and> ?d dvd b \<and> a' dvd c"
by (simp add: ac_simps)
then show ?thesis by blast
qed
lemma lcm_coprime: "coprime a b \<Longrightarrow> lcm a b = normalize (a * b)"
by (subst lcm_gcd) simp
end
context ring_gcd
begin
lemma coprime_minus_left_iff [simp]:
"coprime (- a) b \<longleftrightarrow> coprime a b"
by (rule; rule coprimeI) (auto intro: coprime_common_divisor)
lemma coprime_minus_right_iff [simp]:
"coprime a (- b) \<longleftrightarrow> coprime a b"
using coprime_minus_left_iff [of b a] by (simp add: ac_simps)
lemma coprime_diff_one_left [simp]: "coprime (a - 1) a"
using coprime_add_one_right [of "a - 1"] by simp
lemma coprime_doff_one_right [simp]: "coprime a (a - 1)"
using coprime_diff_one_left [of a] by (simp add: ac_simps)
end
context semiring_Gcd
begin
lemma Lcm_coprime:
assumes "finite A"
and "A \<noteq> {}"
and "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> coprime a b"
shows "Lcm A = normalize (\<Prod>A)"
using assms
proof (induct rule: finite_ne_induct)
case singleton
then show ?case by simp
next
case (insert a A)
have "Lcm (insert a A) = lcm a (Lcm A)"
by simp
also from insert have "Lcm A = normalize (\<Prod>A)"
by blast
also have "lcm a \<dots> = lcm a (\<Prod>A)"
by (cases "\<Prod>A = 0") (simp_all add: lcm_div_unit2)
also from insert have "coprime a (\<Prod>A)"
by (subst coprime_commute, intro prod_coprime_left) auto
with insert have "lcm a (\<Prod>A) = normalize (\<Prod>(insert a A))"
by (simp add: lcm_coprime)
finally show ?case .
qed
lemma Lcm_coprime':
"card A \<noteq> 0 \<Longrightarrow>
(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> coprime a b) \<Longrightarrow>
Lcm A = normalize (\<Prod>A)"
by (rule Lcm_coprime) (simp_all add: card_eq_0_iff)
end
subsection \<open>GCD and LCM for multiplicative normalisation functions\<close>
class semiring_gcd_mult_normalize = semiring_gcd + normalization_semidom_multiplicative
begin
lemma mult_gcd_left: "c * gcd a b = unit_factor c * gcd (c * a) (c * b)"
by (simp add: gcd_mult_left normalize_mult mult.assoc [symmetric])
lemma mult_gcd_right: "gcd a b * c = gcd (a * c) (b * c) * unit_factor c"
using mult_gcd_left [of c a b] by (simp add: ac_simps)
lemma gcd_mult_distrib': "normalize c * gcd a b = gcd (c * a) (c * b)"
by (subst gcd_mult_left) (simp_all add: normalize_mult)
lemma gcd_mult_distrib: "k * gcd a b = gcd (k * a) (k * b) * unit_factor k"
proof-
have "normalize k * gcd a b = gcd (k * a) (k * b)"
by (simp add: gcd_mult_distrib')
then have "normalize k * gcd a b * unit_factor k = gcd (k * a) (k * b) * unit_factor k"
by simp
then have "normalize k * unit_factor k * gcd a b = gcd (k * a) (k * b) * unit_factor k"
by (simp only: ac_simps)
then show ?thesis
by simp
qed
lemma gcd_mult_lcm [simp]: "gcd a b * lcm a b = normalize a * normalize b"
by (simp add: lcm_gcd normalize_mult dvd_normalize_div)
lemma lcm_mult_gcd [simp]: "lcm a b * gcd a b = normalize a * normalize b"
using gcd_mult_lcm [of a b] by (simp add: ac_simps)
lemma mult_lcm_left: "c * lcm a b = unit_factor c * lcm (c * a) (c * b)"
by (simp add: lcm_mult_left mult.assoc [symmetric] normalize_mult)
lemma mult_lcm_right: "lcm a b * c = lcm (a * c) (b * c) * unit_factor c"
using mult_lcm_left [of c a b] by (simp add: ac_simps)
lemma lcm_gcd_prod: "lcm a b * gcd a b = normalize (a * b)"
by (simp add: lcm_gcd dvd_normalize_div normalize_mult)
lemma lcm_mult_distrib': "normalize c * lcm a b = lcm (c * a) (c * b)"
by (subst lcm_mult_left) (simp add: normalize_mult)
lemma lcm_mult_distrib: "k * lcm a b = lcm (k * a) (k * b) * unit_factor k"
proof-
have "normalize k * lcm a b = lcm (k * a) (k * b)"
by (simp add: lcm_mult_distrib')
then have "normalize k * lcm a b * unit_factor k = lcm (k * a) (k * b) * unit_factor k"
by simp
then have "normalize k * unit_factor k * lcm a b = lcm (k * a) (k * b) * unit_factor k"
by (simp only: ac_simps)
then show ?thesis
by simp
qed
lemma coprime_crossproduct':
fixes a b c d
assumes "b \<noteq> 0"
assumes unit_factors: "unit_factor b = unit_factor d"
assumes coprime: "coprime a b" "coprime c d"
shows "a * d = b * c \<longleftrightarrow> a = c \<and> b = d"
proof safe
assume eq: "a * d = b * c"
hence "normalize a * normalize d = normalize c * normalize b"
by (simp only: normalize_mult [symmetric] mult_ac)
with coprime have "normalize b = normalize d"
by (subst (asm) coprime_crossproduct) simp_all
from this and unit_factors show "b = d"
by (rule normalize_unit_factor_eqI)
from eq have "a * d = c * d" by (simp only: \<open>b = d\<close> mult_ac)
with \<open>b \<noteq> 0\<close> \<open>b = d\<close> show "a = c" by simp
qed (simp_all add: mult_ac)
lemma gcd_exp [simp]:
"gcd (a ^ n) (b ^ n) = gcd a b ^ n"
using gcd_exp_weak[of a n b] by (simp add: normalize_power)
end
subsection \<open>GCD and LCM on \<^typ>\<open>nat\<close> and \<^typ>\<open>int\<close>\<close>
instantiation nat :: gcd
begin
fun gcd_nat :: "nat \<Rightarrow> nat \<Rightarrow> nat"
where "gcd_nat x y = (if y = 0 then x else gcd y (x mod y))"
definition lcm_nat :: "nat \<Rightarrow> nat \<Rightarrow> nat"
where "lcm_nat x y = x * y div (gcd x y)"
instance ..
end
instantiation int :: gcd
begin
definition gcd_int :: "int \<Rightarrow> int \<Rightarrow> int"
where "gcd_int x y = int (gcd (nat \<bar>x\<bar>) (nat \<bar>y\<bar>))"
definition lcm_int :: "int \<Rightarrow> int \<Rightarrow> int"
where "lcm_int x y = int (lcm (nat \<bar>x\<bar>) (nat \<bar>y\<bar>))"
instance ..
end
lemma gcd_int_int_eq [simp]:
"gcd (int m) (int n) = int (gcd m n)"
by (simp add: gcd_int_def)
lemma gcd_nat_abs_left_eq [simp]:
"gcd (nat \<bar>k\<bar>) n = nat (gcd k (int n))"
by (simp add: gcd_int_def)
lemma gcd_nat_abs_right_eq [simp]:
"gcd n (nat \<bar>k\<bar>) = nat (gcd (int n) k)"
by (simp add: gcd_int_def)
lemma abs_gcd_int [simp]:
"\<bar>gcd x y\<bar> = gcd x y"
for x y :: int
by (simp only: gcd_int_def)
lemma gcd_abs1_int [simp]:
"gcd \<bar>x\<bar> y = gcd x y"
for x y :: int
by (simp only: gcd_int_def) simp
lemma gcd_abs2_int [simp]:
"gcd x \<bar>y\<bar> = gcd x y"
for x y :: int
by (simp only: gcd_int_def) simp
lemma lcm_int_int_eq [simp]:
"lcm (int m) (int n) = int (lcm m n)"
by (simp add: lcm_int_def)
lemma lcm_nat_abs_left_eq [simp]:
"lcm (nat \<bar>k\<bar>) n = nat (lcm k (int n))"
by (simp add: lcm_int_def)
lemma lcm_nat_abs_right_eq [simp]:
"lcm n (nat \<bar>k\<bar>) = nat (lcm (int n) k)"
by (simp add: lcm_int_def)
lemma lcm_abs1_int [simp]:
"lcm \<bar>x\<bar> y = lcm x y"
for x y :: int
by (simp only: lcm_int_def) simp
lemma lcm_abs2_int [simp]:
"lcm x \<bar>y\<bar> = lcm x y"
for x y :: int
by (simp only: lcm_int_def) simp
lemma abs_lcm_int [simp]: "\<bar>lcm i j\<bar> = lcm i j"
for i j :: int
by (simp only: lcm_int_def)
lemma gcd_nat_induct [case_names base step]:
fixes m n :: nat
assumes "\<And>m. P m 0"
and "\<And>m n. 0 < n \<Longrightarrow> P n (m mod n) \<Longrightarrow> P m n"
shows "P m n"
proof (induction m n rule: gcd_nat.induct)
case (1 x y)
then show ?case
using assms neq0_conv by blast
qed
lemma gcd_neg1_int [simp]: "gcd (- x) y = gcd x y"
for x y :: int
by (simp only: gcd_int_def) simp
lemma gcd_neg2_int [simp]: "gcd x (- y) = gcd x y"
for x y :: int
by (simp only: gcd_int_def) simp
lemma gcd_cases_int:
fixes x y :: int
assumes "x \<ge> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> P (gcd x y)"
and "x \<ge> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> P (gcd x (- y))"
and "x \<le> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> P (gcd (- x) y)"
and "x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> P (gcd (- x) (- y))"
shows "P (gcd x y)"
using assms by auto arith
lemma gcd_ge_0_int [simp]: "gcd (x::int) y >= 0"
for x y :: int
by (simp add: gcd_int_def)
lemma lcm_neg1_int: "lcm (- x) y = lcm x y"
for x y :: int
by (simp only: lcm_int_def) simp
lemma lcm_neg2_int: "lcm x (- y) = lcm x y"
for x y :: int
by (simp only: lcm_int_def) simp
lemma lcm_cases_int:
fixes x y :: int
assumes "x \<ge> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> P (lcm x y)"
and "x \<ge> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> P (lcm x (- y))"
and "x \<le> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> P (lcm (- x) y)"
and "x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> P (lcm (- x) (- y))"
shows "P (lcm x y)"
using assms by (auto simp: lcm_neg1_int lcm_neg2_int) arith
lemma lcm_ge_0_int [simp]: "lcm x y \<ge> 0"
for x y :: int
by (simp only: lcm_int_def)
lemma gcd_0_nat: "gcd x 0 = x"
for x :: nat
by simp
lemma gcd_0_int [simp]: "gcd x 0 = \<bar>x\<bar>"
for x :: int
by (auto simp: gcd_int_def)
lemma gcd_0_left_nat: "gcd 0 x = x"
for x :: nat
by simp
lemma gcd_0_left_int [simp]: "gcd 0 x = \<bar>x\<bar>"
for x :: int
by (auto simp: gcd_int_def)
lemma gcd_red_nat: "gcd x y = gcd y (x mod y)"
for x y :: nat
by (cases "y = 0") auto
text \<open>Weaker, but useful for the simplifier.\<close>
lemma gcd_non_0_nat: "y \<noteq> 0 \<Longrightarrow> gcd x y = gcd y (x mod y)"
for x y :: nat
by simp
lemma gcd_1_nat [simp]: "gcd m 1 = 1"
for m :: nat
by simp
lemma gcd_Suc_0 [simp]: "gcd m (Suc 0) = Suc 0"
for m :: nat
by simp
lemma gcd_1_int [simp]: "gcd m 1 = 1"
for m :: int
by (simp add: gcd_int_def)
lemma gcd_idem_nat: "gcd x x = x"
for x :: nat
by simp
lemma gcd_idem_int: "gcd x x = \<bar>x\<bar>"
for x :: int
by (auto simp: gcd_int_def)
declare gcd_nat.simps [simp del]
text \<open>
\<^medskip> \<^term>\<open>gcd m n\<close> divides \<open>m\<close> and \<open>n\<close>.
The conjunctions don't seem provable separately.
\<close>
instance nat :: semiring_gcd
proof
fix m n :: nat
show "gcd m n dvd m" and "gcd m n dvd n"
proof (induct m n rule: gcd_nat_induct)
case (step m n)
then have "gcd n (m mod n) dvd m"
by (metis dvd_mod_imp_dvd)
with step show "gcd m n dvd m"
by (simp add: gcd_non_0_nat)
qed (simp_all add: gcd_0_nat gcd_non_0_nat)
next
fix m n k :: nat
assume "k dvd m" and "k dvd n"
then show "k dvd gcd m n"
by (induct m n rule: gcd_nat_induct) (simp_all add: gcd_non_0_nat dvd_mod gcd_0_nat)
qed (simp_all add: lcm_nat_def)
instance int :: ring_gcd
proof
fix k l r :: int
show [simp]: "gcd k l dvd k" "gcd k l dvd l"
using gcd_dvd1 [of "nat \<bar>k\<bar>" "nat \<bar>l\<bar>"]
gcd_dvd2 [of "nat \<bar>k\<bar>" "nat \<bar>l\<bar>"]
by simp_all
show "lcm k l = normalize (k * l div gcd k l)"
using lcm_gcd [of "nat \<bar>k\<bar>" "nat \<bar>l\<bar>"]
by (simp add: nat_eq_iff of_nat_div abs_mult abs_div)
assume "r dvd k" "r dvd l"
then show "r dvd gcd k l"
using gcd_greatest [of "nat \<bar>r\<bar>" "nat \<bar>k\<bar>" "nat \<bar>l\<bar>"]
by simp
qed simp
lemma gcd_le1_nat [simp]: "a \<noteq> 0 \<Longrightarrow> gcd a b \<le> a"
for a b :: nat
by (rule dvd_imp_le) auto
lemma gcd_le2_nat [simp]: "b \<noteq> 0 \<Longrightarrow> gcd a b \<le> b"
for a b :: nat
by (rule dvd_imp_le) auto
lemma gcd_le1_int [simp]: "a > 0 \<Longrightarrow> gcd a b \<le> a"
for a b :: int
by (rule zdvd_imp_le) auto
lemma gcd_le2_int [simp]: "b > 0 \<Longrightarrow> gcd a b \<le> b"
for a b :: int
by (rule zdvd_imp_le) auto
lemma gcd_pos_nat [simp]: "gcd m n > 0 \<longleftrightarrow> m \<noteq> 0 \<or> n \<noteq> 0"
for m n :: nat
using gcd_eq_0_iff [of m n] by arith
lemma gcd_pos_int [simp]: "gcd m n > 0 \<longleftrightarrow> m \<noteq> 0 \<or> n \<noteq> 0"
for m n :: int
using gcd_eq_0_iff [of m n] gcd_ge_0_int [of m n] by arith
lemma gcd_unique_nat: "d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
for d a :: nat
using gcd_unique by fastforce
lemma gcd_unique_int:
"d \<ge> 0 \<and> d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
for d a :: int
using zdvd_antisym_nonneg by auto
interpretation gcd_nat:
semilattice_neutr_order gcd "0::nat" Rings.dvd "\<lambda>m n. m dvd n \<and> m \<noteq> n"
by standard (auto simp: gcd_unique_nat [symmetric] intro: dvd_antisym dvd_trans)
lemma gcd_proj1_if_dvd_int [simp]: "x dvd y \<Longrightarrow> gcd x y = \<bar>x\<bar>"
for x y :: int
by (metis abs_dvd_iff gcd_0_left_int gcd_unique_int)
lemma gcd_proj2_if_dvd_int [simp]: "y dvd x \<Longrightarrow> gcd x y = \<bar>y\<bar>"
for x y :: int
by (metis gcd_proj1_if_dvd_int gcd.commute)
text \<open>\<^medskip> Multiplication laws.\<close>
lemma gcd_mult_distrib_nat: "k * gcd m n = gcd (k * m) (k * n)"
for k m n :: nat
\<comment> \<open>@{cite \<open>page 27\<close> davenport92}\<close>
by (simp add: gcd_mult_left)
lemma gcd_mult_distrib_int: "\<bar>k\<bar> * gcd m n = gcd (k * m) (k * n)"
for k m n :: int
by (simp add: gcd_mult_left abs_mult)
text \<open>\medskip Addition laws.\<close>
(* TODO: add the other variations? *)
lemma gcd_diff1_nat: "m \<ge> n \<Longrightarrow> gcd (m - n) n = gcd m n"
for m n :: nat
by (subst gcd_add1 [symmetric]) auto
lemma gcd_diff2_nat: "n \<ge> m \<Longrightarrow> gcd (n - m) n = gcd m n"
for m n :: nat
by (metis gcd.commute gcd_add2 gcd_diff1_nat le_add_diff_inverse2)
lemma gcd_non_0_int:
fixes x y :: int
assumes "y > 0" shows "gcd x y = gcd y (x mod y)"
proof (cases "x mod y = 0")
case False
then have neg: "x mod y = y - (- x) mod y"
by (simp add: zmod_zminus1_eq_if)
have xy: "0 \<le> x mod y"
by (simp add: assms)
show ?thesis
proof (cases "x < 0")
case True
have "nat (- x mod y) \<le> nat y"
by (simp add: assms dual_order.order_iff_strict)
moreover have "gcd (nat (- x)) (nat y) = gcd (nat (- x mod y)) (nat y)"
using True assms gcd_non_0_nat nat_mod_distrib by auto
ultimately have "gcd (nat (- x)) (nat y) = gcd (nat y) (nat (x mod y))"
using assms
by (simp add: neg nat_diff_distrib') (metis gcd.commute gcd_diff2_nat)
with assms \<open>0 \<le> x mod y\<close> show ?thesis
by (simp add: True dual_order.order_iff_strict gcd_int_def)
next
case False
with assms xy have "gcd (nat x) (nat y) = gcd (nat y) (nat x mod nat y)"
using gcd_red_nat by blast
with False assms show ?thesis
by (simp add: gcd_int_def nat_mod_distrib)
qed
qed (use assms in auto)
lemma gcd_red_int: "gcd x y = gcd y (x mod y)"
for x y :: int
proof (cases y "0::int" rule: linorder_cases)
case less
with gcd_non_0_int [of "- y" "- x"] show ?thesis
by auto
next
case greater
with gcd_non_0_int [of y x] show ?thesis
by auto
qed auto
(* TODO: differences, and all variations of addition rules
as simplification rules for nat and int *)
(* TODO: add the three variations of these, and for ints? *)
lemma finite_divisors_nat [simp]: (* FIXME move *)
fixes m :: nat
assumes "m > 0"
shows "finite {d. d dvd m}"
proof-
from assms have "{d. d dvd m} \<subseteq> {d. d \<le> m}"
by (auto dest: dvd_imp_le)
then show ?thesis
using finite_Collect_le_nat by (rule finite_subset)
qed
lemma finite_divisors_int [simp]:
fixes i :: int
assumes "i \<noteq> 0"
shows "finite {d. d dvd i}"
proof -
have "{d. \<bar>d\<bar> \<le> \<bar>i\<bar>} = {- \<bar>i\<bar>..\<bar>i\<bar>}"
by (auto simp: abs_if)
then have "finite {d. \<bar>d\<bar> \<le> \<bar>i\<bar>}"
by simp
from finite_subset [OF _ this] show ?thesis
using assms by (simp add: dvd_imp_le_int subset_iff)
qed
lemma Max_divisors_self_nat [simp]: "n \<noteq> 0 \<Longrightarrow> Max {d::nat. d dvd n} = n"
by (fastforce intro: antisym Max_le_iff[THEN iffD2] simp: dvd_imp_le)
lemma Max_divisors_self_int [simp]:
assumes "n \<noteq> 0" shows "Max {d::int. d dvd n} = \<bar>n\<bar>"
proof (rule antisym)
show "Max {d. d dvd n} \<le> \<bar>n\<bar>"
using assms by (auto intro: abs_le_D1 dvd_imp_le_int intro!: Max_le_iff [THEN iffD2])
qed (simp add: assms)
lemma gcd_is_Max_divisors_nat:
fixes m n :: nat
assumes "n > 0" shows "gcd m n = Max {d. d dvd m \<and> d dvd n}"
proof (rule Max_eqI[THEN sym], simp_all)
show "finite {d. d dvd m \<and> d dvd n}"
by (simp add: \<open>n > 0\<close>)
show "\<And>y. y dvd m \<and> y dvd n \<Longrightarrow> y \<le> gcd m n"
by (simp add: \<open>n > 0\<close> dvd_imp_le)
qed
lemma gcd_is_Max_divisors_int:
fixes m n :: int
assumes "n \<noteq> 0" shows "gcd m n = Max {d. d dvd m \<and> d dvd n}"
proof (rule Max_eqI[THEN sym], simp_all)
show "finite {d. d dvd m \<and> d dvd n}"
by (simp add: \<open>n \<noteq> 0\<close>)
show "\<And>y. y dvd m \<and> y dvd n \<Longrightarrow> y \<le> gcd m n"
by (simp add: \<open>n \<noteq> 0\<close> zdvd_imp_le)
qed
lemma gcd_code_int [code]: "gcd k l = \<bar>if l = 0 then k else gcd l (\<bar>k\<bar> mod \<bar>l\<bar>)\<bar>"
for k l :: int
using gcd_red_int [of "\<bar>k\<bar>" "\<bar>l\<bar>"] by simp
lemma coprime_Suc_left_nat [simp]:
"coprime (Suc n) n"
using coprime_add_one_left [of n] by simp
lemma coprime_Suc_right_nat [simp]:
"coprime n (Suc n)"
using coprime_Suc_left_nat [of n] by (simp add: ac_simps)
lemma coprime_diff_one_left_nat [simp]:
"coprime (n - 1) n" if "n > 0" for n :: nat
using that coprime_Suc_right_nat [of "n - 1"] by simp
lemma coprime_diff_one_right_nat [simp]:
"coprime n (n - 1)" if "n > 0" for n :: nat
using that coprime_diff_one_left_nat [of n] by (simp add: ac_simps)
lemma coprime_crossproduct_nat:
fixes a b c d :: nat
assumes "coprime a d" and "coprime b c"
shows "a * c = b * d \<longleftrightarrow> a = b \<and> c = d"
using assms coprime_crossproduct [of a d b c] by simp
lemma coprime_crossproduct_int:
fixes a b c d :: int
assumes "coprime a d" and "coprime b c"
shows "\<bar>a\<bar> * \<bar>c\<bar> = \<bar>b\<bar> * \<bar>d\<bar> \<longleftrightarrow> \<bar>a\<bar> = \<bar>b\<bar> \<and> \<bar>c\<bar> = \<bar>d\<bar>"
using assms coprime_crossproduct [of a d b c] by simp
subsection \<open>Bezout's theorem\<close>
text \<open>
Function \<open>bezw\<close> returns a pair of witnesses to Bezout's theorem --
see the theorems that follow the definition.
\<close>
fun bezw :: "nat \<Rightarrow> nat \<Rightarrow> int * int"
where "bezw x y =
(if y = 0 then (1, 0)
else
(snd (bezw y (x mod y)),
fst (bezw y (x mod y)) - snd (bezw y (x mod y)) * int(x div y)))"
lemma bezw_0 [simp]: "bezw x 0 = (1, 0)"
by simp
lemma bezw_non_0:
"y > 0 \<Longrightarrow> bezw x y =
(snd (bezw y (x mod y)), fst (bezw y (x mod y)) - snd (bezw y (x mod y)) * int(x div y))"
by simp
declare bezw.simps [simp del]
lemma bezw_aux: "int (gcd x y) = fst (bezw x y) * int x + snd (bezw x y) * int y"
proof (induct x y rule: gcd_nat_induct)
case (step m n)
then have "fst (bezw m n) * int m + snd (bezw m n) * int n - int (gcd m n)
= int m * snd (bezw n (m mod n)) -
(int (m mod n) * snd (bezw n (m mod n)) + int n * (int (m div n) * snd (bezw n (m mod n))))"
by (simp add: bezw_non_0 gcd_non_0_nat field_simps)
also have "\<dots> = int m * snd (bezw n (m mod n)) - (int (m mod n) + int (n * (m div n))) * snd (bezw n (m mod n))"
by (simp add: distrib_right)
also have "\<dots> = 0"
by (metis cancel_comm_monoid_add_class.diff_cancel mod_mult_div_eq of_nat_add)
finally show ?case
by simp
qed auto
lemma bezout_int: "\<exists>u v. u * x + v * y = gcd x y"
for x y :: int
proof -
have aux: "x \<ge> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> \<exists>u v. u * x + v * y = gcd x y" for x y :: int
apply (rule_tac x = "fst (bezw (nat x) (nat y))" in exI)
apply (rule_tac x = "snd (bezw (nat x) (nat y))" in exI)
by (simp add: bezw_aux gcd_int_def)
consider "x \<ge> 0" "y \<ge> 0" | "x \<ge> 0" "y \<le> 0" | "x \<le> 0" "y \<ge> 0" | "x \<le> 0" "y \<le> 0"
using linear by blast
then show ?thesis
proof cases
case 1
then show ?thesis by (rule aux)
next
case 2
then show ?thesis
using aux [of x "-y"]
by (metis gcd_neg2_int mult.commute mult_minus_right neg_0_le_iff_le)
next
case 3
then show ?thesis
using aux [of "-x" y]
by (metis gcd.commute gcd_neg2_int mult.commute mult_minus_right neg_0_le_iff_le)
next
case 4
then show ?thesis
using aux [of "-x" "-y"]
by (metis diff_0 diff_ge_0_iff_ge gcd_neg1_int gcd_neg2_int mult.commute mult_minus_right)
qed
qed
text \<open>Versions of Bezout for \<open>nat\<close>, by Amine Chaieb.\<close>
lemma Euclid_induct [case_names swap zero add]:
fixes P :: "nat \<Rightarrow> nat \<Rightarrow> bool"
assumes c: "\<And>a b. P a b \<longleftrightarrow> P b a"
and z: "\<And>a. P a 0"
and add: "\<And>a b. P a b \<longrightarrow> P a (a + b)"
shows "P a b"
proof (induct "a + b" arbitrary: a b rule: less_induct)
case less
consider (eq) "a = b" | (lt) "a < b" "a + b - a < a + b" | "b = 0" | "b + a - b < a + b"
by arith
show ?case
proof (cases a b rule: linorder_cases)
case equal
with add [rule_format, OF z [rule_format, of a]] show ?thesis by simp
next
case lt: less
then consider "a = 0" | "a + b - a < a + b" by arith
then show ?thesis
proof cases
case 1
with z c show ?thesis by blast
next
case 2
also have *: "a + b - a = a + (b - a)" using lt by arith
finally have "a + (b - a) < a + b" .
then have "P a (a + (b - a))" by (rule add [rule_format, OF less])
then show ?thesis by (simp add: *[symmetric])
qed
next
case gt: greater
then consider "b = 0" | "b + a - b < a + b" by arith
then show ?thesis
proof cases
case 1
with z c show ?thesis by blast
next
case 2
also have *: "b + a - b = b + (a - b)" using gt by arith
finally have "b + (a - b) < a + b" .
then have "P b (b + (a - b))" by (rule add [rule_format, OF less])
then have "P b a" by (simp add: *[symmetric])
with c show ?thesis by blast
qed
qed
qed
lemma bezout_lemma_nat:
fixes d::nat
shows "\<lbrakk>d dvd a; d dvd b; a * x = b * y + d \<or> b * x = a * y + d\<rbrakk>
\<Longrightarrow> \<exists>x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d)"
apply auto
apply (metis add_mult_distrib2 left_add_mult_distrib)
apply (rule_tac x=x in exI)
by (metis add_mult_distrib2 mult.commute add.assoc)
lemma bezout_add_nat:
"\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)"
proof (induct a b rule: Euclid_induct)
case (swap a b)
then show ?case
by blast
next
case (zero a)
then show ?case
by fastforce
next
case (add a b)
then show ?case
by (meson bezout_lemma_nat)
qed
lemma bezout1_nat: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and> (a * x - b * y = d \<or> b * x - a * y = d)"
using bezout_add_nat[of a b] by (metis add_diff_cancel_left')
lemma bezout_add_strong_nat:
fixes a b :: nat
assumes a: "a \<noteq> 0"
shows "\<exists>d x y. d dvd a \<and> d dvd b \<and> a * x = b * y + d"
proof -
consider d x y where "d dvd a" "d dvd b" "a * x = b * y + d"
| d x y where "d dvd a" "d dvd b" "b * x = a * y + d"
using bezout_add_nat [of a b] by blast
then show ?thesis
proof cases
case 1
then show ?thesis by blast
next
case H: 2
show ?thesis
proof (cases "b = 0")
case True
with H show ?thesis by simp
next
case False
then have bp: "b > 0" by simp
with dvd_imp_le [OF H(2)] consider "d = b" | "d < b"
by atomize_elim auto
then show ?thesis
proof cases
case 1
with a H show ?thesis
by (metis Suc_pred add.commute mult.commute mult_Suc_right neq0_conv)
next
case 2
show ?thesis
proof (cases "x = 0")
case True
with a H show ?thesis by simp
next
case x0: False
then have xp: "x > 0" by simp
from \<open>d < b\<close> have "d \<le> b - 1" by simp
then have "d * b \<le> b * (b - 1)" by simp
with xp mult_mono[of "1" "x" "d * b" "b * (b - 1)"]
have dble: "d * b \<le> x * b * (b - 1)" using bp by simp
from H(3) have "d + (b - 1) * (b * x) = d + (b - 1) * (a * y + d)"
by simp
then have "d + (b - 1) * a * y + (b - 1) * d = d + (b - 1) * b * x"
by (simp only: mult.assoc distrib_left)
then have "a * ((b - 1) * y) + d * (b - 1 + 1) = d + x * b * (b - 1)"
by algebra
then have "a * ((b - 1) * y) = d + x * b * (b - 1) - d * b"
using bp by simp
then have "a * ((b - 1) * y) = d + (x * b * (b - 1) - d * b)"
by (simp only: diff_add_assoc[OF dble, of d, symmetric])
then have "a * ((b - 1) * y) = b * (x * (b - 1) - d) + d"
by (simp only: diff_mult_distrib2 ac_simps)
with H(1,2) show ?thesis
by blast
qed
qed
qed
qed
qed
lemma bezout_nat:
fixes a :: nat
assumes a: "a \<noteq> 0"
shows "\<exists>x y. a * x = b * y + gcd a b"
proof -
obtain d x y where d: "d dvd a" "d dvd b" and eq: "a * x = b * y + d"
using bezout_add_strong_nat [OF a, of b] by blast
from d have "d dvd gcd a b"
by simp
then obtain k where k: "gcd a b = d * k"
unfolding dvd_def by blast
from eq have "a * x * k = (b * y + d) * k"
by auto
then have "a * (x * k) = b * (y * k) + gcd a b"
by (algebra add: k)
then show ?thesis
by blast
qed
subsection \<open>LCM properties on \<^typ>\<open>nat\<close> and \<^typ>\<open>int\<close>\<close>
lemma lcm_altdef_int [code]: "lcm a b = \<bar>a\<bar> * \<bar>b\<bar> div gcd a b"
for a b :: int
by (simp add: abs_mult lcm_gcd abs_div)
lemma prod_gcd_lcm_nat: "m * n = gcd m n * lcm m n"
for m n :: nat
by (simp add: lcm_gcd)
lemma prod_gcd_lcm_int: "\<bar>m\<bar> * \<bar>n\<bar> = gcd m n * lcm m n"
for m n :: int
by (simp add: lcm_gcd abs_div abs_mult)
lemma lcm_pos_nat: "m > 0 \<Longrightarrow> n > 0 \<Longrightarrow> lcm m n > 0"
for m n :: nat
using lcm_eq_0_iff [of m n] by auto
lemma lcm_pos_int: "m \<noteq> 0 \<Longrightarrow> n \<noteq> 0 \<Longrightarrow> lcm m n > 0"
for m n :: int
by (simp add: less_le lcm_eq_0_iff)
lemma dvd_pos_nat: "n > 0 \<Longrightarrow> m dvd n \<Longrightarrow> m > 0" (* FIXME move *)
for m n :: nat
by auto
lemma lcm_unique_nat:
"a dvd d \<and> b dvd d \<and> (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e) \<longleftrightarrow> d = lcm a b"
for a b d :: nat
by (auto intro: dvd_antisym lcm_least)
lemma lcm_unique_int:
"d \<ge> 0 \<and> a dvd d \<and> b dvd d \<and> (\<forall>e. a dvd e \<and> b dvd e \<longrightarrow> d dvd e) \<longleftrightarrow> d = lcm a b"
for a b d :: int
using lcm_least zdvd_antisym_nonneg by auto
lemma lcm_proj2_if_dvd_nat [simp]: "x dvd y \<Longrightarrow> lcm x y = y"
for x y :: nat
by (simp add: lcm_proj2_if_dvd)
lemma lcm_proj2_if_dvd_int [simp]: "x dvd y \<Longrightarrow> lcm x y = \<bar>y\<bar>"
for x y :: int
by (simp add: lcm_proj2_if_dvd)
lemma lcm_proj1_if_dvd_nat [simp]: "x dvd y \<Longrightarrow> lcm y x = y"
for x y :: nat
by (subst lcm.commute) (erule lcm_proj2_if_dvd_nat)
lemma lcm_proj1_if_dvd_int [simp]: "x dvd y \<Longrightarrow> lcm y x = \<bar>y\<bar>"
for x y :: int
by (subst lcm.commute) (erule lcm_proj2_if_dvd_int)
lemma lcm_proj1_iff_nat [simp]: "lcm m n = m \<longleftrightarrow> n dvd m"
for m n :: nat
by (metis lcm_proj1_if_dvd_nat lcm_unique_nat)
lemma lcm_proj2_iff_nat [simp]: "lcm m n = n \<longleftrightarrow> m dvd n"
for m n :: nat
by (metis lcm_proj2_if_dvd_nat lcm_unique_nat)
lemma lcm_proj1_iff_int [simp]: "lcm m n = \<bar>m\<bar> \<longleftrightarrow> n dvd m"
for m n :: int
by (metis dvd_abs_iff lcm_proj1_if_dvd_int lcm_unique_int)
lemma lcm_proj2_iff_int [simp]: "lcm m n = \<bar>n\<bar> \<longleftrightarrow> m dvd n"
for m n :: int
by (metis dvd_abs_iff lcm_proj2_if_dvd_int lcm_unique_int)
lemma lcm_1_iff_nat [simp]: "lcm m n = Suc 0 \<longleftrightarrow> m = Suc 0 \<and> n = Suc 0"
for m n :: nat
using lcm_eq_1_iff [of m n] by simp
lemma lcm_1_iff_int [simp]: "lcm m n = 1 \<longleftrightarrow> (m = 1 \<or> m = -1) \<and> (n = 1 \<or> n = -1)"
for m n :: int
by auto
subsection \<open>The complete divisibility lattice on \<^typ>\<open>nat\<close> and \<^typ>\<open>int\<close>\<close>
text \<open>
Lifting \<open>gcd\<close> and \<open>lcm\<close> to sets (\<open>Gcd\<close> / \<open>Lcm\<close>).
\<open>Gcd\<close> is defined via \<open>Lcm\<close> to facilitate the proof that we have a complete lattice.
\<close>
instantiation nat :: semiring_Gcd
begin
interpretation semilattice_neutr_set lcm "1::nat"
by standard simp_all
definition "Lcm M = (if finite M then F M else 0)" for M :: "nat set"
lemma Lcm_nat_empty: "Lcm {} = (1::nat)"
by (simp add: Lcm_nat_def del: One_nat_def)
lemma Lcm_nat_insert: "Lcm (insert n M) = lcm n (Lcm M)" for n :: nat
by (cases "finite M") (auto simp: Lcm_nat_def simp del: One_nat_def)
lemma Lcm_nat_infinite: "infinite M \<Longrightarrow> Lcm M = 0" for M :: "nat set"
by (simp add: Lcm_nat_def)
lemma dvd_Lcm_nat [simp]:
fixes M :: "nat set"
assumes "m \<in> M"
shows "m dvd Lcm M"
proof -
from assms have "insert m M = M"
by auto
moreover have "m dvd Lcm (insert m M)"
by (simp add: Lcm_nat_insert)
ultimately show ?thesis
by simp
qed
lemma Lcm_dvd_nat [simp]:
fixes M :: "nat set"
assumes "\<forall>m\<in>M. m dvd n"
shows "Lcm M dvd n"
proof (cases "n > 0")
case False
then show ?thesis by simp
next
case True
then have "finite {d. d dvd n}"
by (rule finite_divisors_nat)
moreover have "M \<subseteq> {d. d dvd n}"
using assms by fast
ultimately have "finite M"
by (rule rev_finite_subset)
then show ?thesis
using assms by (induct M) (simp_all add: Lcm_nat_empty Lcm_nat_insert)
qed
definition "Gcd M = Lcm {d. \<forall>m\<in>M. d dvd m}" for M :: "nat set"
instance
proof
fix N :: "nat set"
fix n :: nat
show "Gcd N dvd n" if "n \<in> N"
using that by (induct N rule: infinite_finite_induct) (auto simp: Gcd_nat_def)
show "n dvd Gcd N" if "\<And>m. m \<in> N \<Longrightarrow> n dvd m"
using that by (induct N rule: infinite_finite_induct) (auto simp: Gcd_nat_def)
show "n dvd Lcm N" if "n \<in> N"
using that by (induct N rule: infinite_finite_induct) auto
show "Lcm N dvd n" if "\<And>m. m \<in> N \<Longrightarrow> m dvd n"
using that by (induct N rule: infinite_finite_induct) auto
show "normalize (Gcd N) = Gcd N" and "normalize (Lcm N) = Lcm N"
by simp_all
qed
end
lemma Gcd_nat_eq_one: "1 \<in> N \<Longrightarrow> Gcd N = 1"
for N :: "nat set"
by (rule Gcd_eq_1_I) auto
instance nat :: semiring_gcd_mult_normalize
by intro_classes (auto simp: unit_factor_nat_def)
text \<open>Alternative characterizations of Gcd:\<close>
lemma Gcd_eq_Max:
fixes M :: "nat set"
assumes "finite (M::nat set)" and "M \<noteq> {}" and "0 \<notin> M"
shows "Gcd M = Max (\<Inter>m\<in>M. {d. d dvd m})"
proof (rule antisym)
from assms obtain m where "m \<in> M" and "m > 0"
by auto
from \<open>m > 0\<close> have "finite {d. d dvd m}"
by (blast intro: finite_divisors_nat)
with \<open>m \<in> M\<close> have fin: "finite (\<Inter>m\<in>M. {d. d dvd m})"
by blast
from fin show "Gcd M \<le> Max (\<Inter>m\<in>M. {d. d dvd m})"
by (auto intro: Max_ge Gcd_dvd)
from fin show "Max (\<Inter>m\<in>M. {d. d dvd m}) \<le> Gcd M"
proof (rule Max.boundedI, simp_all)
show "(\<Inter>m\<in>M. {d. d dvd m}) \<noteq> {}"
by auto
show "\<And>a. \<forall>x\<in>M. a dvd x \<Longrightarrow> a \<le> Gcd M"
by (meson Gcd_dvd Gcd_greatest \<open>0 < m\<close> \<open>m \<in> M\<close> dvd_imp_le dvd_pos_nat)
qed
qed
lemma Gcd_remove0_nat: "finite M \<Longrightarrow> Gcd M = Gcd (M - {0})"
for M :: "nat set"
proof (induct pred: finite)
case (insert x M)
then show ?case
by (simp add: insert_Diff_if)
qed auto
lemma Lcm_in_lcm_closed_set_nat:
fixes M :: "nat set"
assumes "finite M" "M \<noteq> {}" "\<And>m n. \<lbrakk>m \<in> M; n \<in> M\<rbrakk> \<Longrightarrow> lcm m n \<in> M"
shows "Lcm M \<in> M"
using assms
proof (induction M rule: finite_linorder_min_induct)
case (insert x M)
then have "\<And>m n. m \<in> M \<Longrightarrow> n \<in> M \<Longrightarrow> lcm m n \<in> M"
by (metis dvd_lcm1 gr0I insert_iff lcm_pos_nat nat_dvd_not_less)
with insert show ?case
by simp (metis Lcm_nat_empty One_nat_def dvd_1_left dvd_lcm2)
qed auto
lemma Lcm_eq_Max_nat:
fixes M :: "nat set"
assumes M: "finite M" "M \<noteq> {}" "0 \<notin> M" and lcm: "\<And>m n. \<lbrakk>m \<in> M; n \<in> M\<rbrakk> \<Longrightarrow> lcm m n \<in> M"
shows "Lcm M = Max M"
proof (rule antisym)
show "Lcm M \<le> Max M"
by (simp add: Lcm_in_lcm_closed_set_nat \<open>finite M\<close> \<open>M \<noteq> {}\<close> lcm)
show "Max M \<le> Lcm M"
by (meson Lcm_0_iff Max_in M dvd_Lcm dvd_imp_le le_0_eq not_le)
qed
lemma mult_inj_if_coprime_nat:
"inj_on f A \<Longrightarrow> inj_on g B \<Longrightarrow> (\<And>a b. \<lbrakk>a\<in>A; b\<in>B\<rbrakk> \<Longrightarrow> coprime (f a) (g b)) \<Longrightarrow>
inj_on (\<lambda>(a, b). f a * g b) (A \<times> B)"
for f :: "'a \<Rightarrow> nat" and g :: "'b \<Rightarrow> nat"
by (auto simp: inj_on_def coprime_crossproduct_nat simp del: One_nat_def)
subsubsection \<open>Setwise GCD and LCM for integers\<close>
instantiation int :: Gcd
begin
definition Gcd_int :: "int set \<Rightarrow> int"
where "Gcd K = int (GCD k\<in>K. (nat \<circ> abs) k)"
definition Lcm_int :: "int set \<Rightarrow> int"
where "Lcm K = int (LCM k\<in>K. (nat \<circ> abs) k)"
instance ..
end
lemma Gcd_int_eq [simp]:
"(GCD n\<in>N. int n) = int (Gcd N)"
by (simp add: Gcd_int_def image_image)
lemma Gcd_nat_abs_eq [simp]:
"(GCD k\<in>K. nat \<bar>k\<bar>) = nat (Gcd K)"
by (simp add: Gcd_int_def)
lemma abs_Gcd_eq [simp]:
"\<bar>Gcd K\<bar> = Gcd K" for K :: "int set"
by (simp only: Gcd_int_def)
lemma Gcd_int_greater_eq_0 [simp]:
"Gcd K \<ge> 0"
for K :: "int set"
using abs_ge_zero [of "Gcd K"] by simp
lemma Gcd_abs_eq [simp]:
"(GCD k\<in>K. \<bar>k\<bar>) = Gcd K"
for K :: "int set"
by (simp only: Gcd_int_def image_image) simp
lemma Lcm_int_eq [simp]:
"(LCM n\<in>N. int n) = int (Lcm N)"
by (simp add: Lcm_int_def image_image)
lemma Lcm_nat_abs_eq [simp]:
"(LCM k\<in>K. nat \<bar>k\<bar>) = nat (Lcm K)"
by (simp add: Lcm_int_def)
lemma abs_Lcm_eq [simp]:
"\<bar>Lcm K\<bar> = Lcm K" for K :: "int set"
by (simp only: Lcm_int_def)
lemma Lcm_int_greater_eq_0 [simp]:
"Lcm K \<ge> 0"
for K :: "int set"
using abs_ge_zero [of "Lcm K"] by simp
lemma Lcm_abs_eq [simp]:
"(LCM k\<in>K. \<bar>k\<bar>) = Lcm K"
for K :: "int set"
by (simp only: Lcm_int_def image_image) simp
instance int :: semiring_Gcd
proof
fix K :: "int set" and k :: int
show "Gcd K dvd k" and "k dvd Lcm K" if "k \<in> K"
using that Gcd_dvd [of "nat \<bar>k\<bar>" "(nat \<circ> abs) ` K"]
dvd_Lcm [of "nat \<bar>k\<bar>" "(nat \<circ> abs) ` K"]
by (simp_all add: comp_def)
show "k dvd Gcd K" if "\<And>l. l \<in> K \<Longrightarrow> k dvd l"
proof -
have "nat \<bar>k\<bar> dvd (GCD k\<in>K. nat \<bar>k\<bar>)"
by (rule Gcd_greatest) (use that in auto)
then show ?thesis by simp
qed
show "Lcm K dvd k" if "\<And>l. l \<in> K \<Longrightarrow> l dvd k"
proof -
have "(LCM k\<in>K. nat \<bar>k\<bar>) dvd nat \<bar>k\<bar>"
by (rule Lcm_least) (use that in auto)
then show ?thesis by simp
qed
qed (simp_all add: sgn_mult)
instance int :: semiring_gcd_mult_normalize
by intro_classes (auto simp: sgn_mult)
subsection \<open>GCD and LCM on \<^typ>\<open>integer\<close>\<close>
instantiation integer :: gcd
begin
context
includes integer.lifting
begin
lift_definition gcd_integer :: "integer \<Rightarrow> integer \<Rightarrow> integer" is gcd .
lift_definition lcm_integer :: "integer \<Rightarrow> integer \<Rightarrow> integer" is lcm .
end
instance ..
end
lifting_update integer.lifting
lifting_forget integer.lifting
context
includes integer.lifting
begin
lemma gcd_code_integer [code]: "gcd k l = \<bar>if l = (0::integer) then k else gcd l (\<bar>k\<bar> mod \<bar>l\<bar>)\<bar>"
by transfer (fact gcd_code_int)
lemma lcm_code_integer [code]: "lcm a b = \<bar>a\<bar> * \<bar>b\<bar> div gcd a b"
for a b :: integer
by transfer (fact lcm_altdef_int)
end
code_printing
constant "gcd :: integer \<Rightarrow> _" \<rightharpoonup>
(OCaml) "!(fun k l -> if Z.equal k Z.zero then/ Z.abs l else if Z.equal/ l Z.zero then Z.abs k else Z.gcd k l)"
and (Haskell) "Prelude.gcd"
and (Scala) "_.gcd'((_)')"
\<comment> \<open>There is no gcd operation in the SML standard library, so no code setup for SML\<close>
text \<open>Some code equations\<close>
lemmas Gcd_nat_set_eq_fold [code] = Gcd_set_eq_fold [where ?'a = nat]
lemmas Lcm_nat_set_eq_fold [code] = Lcm_set_eq_fold [where ?'a = nat]
lemmas Gcd_int_set_eq_fold [code] = Gcd_set_eq_fold [where ?'a = int]
lemmas Lcm_int_set_eq_fold [code] = Lcm_set_eq_fold [where ?'a = int]
text \<open>Fact aliases.\<close>
lemma lcm_0_iff_nat [simp]: "lcm m n = 0 \<longleftrightarrow> m = 0 \<or> n = 0"
for m n :: nat
by (fact lcm_eq_0_iff)
lemma lcm_0_iff_int [simp]: "lcm m n = 0 \<longleftrightarrow> m = 0 \<or> n = 0"
for m n :: int
by (fact lcm_eq_0_iff)
lemma dvd_lcm_I1_nat [simp]: "k dvd m \<Longrightarrow> k dvd lcm m n"
for k m n :: nat
by (fact dvd_lcmI1)
lemma dvd_lcm_I2_nat [simp]: "k dvd n \<Longrightarrow> k dvd lcm m n"
for k m n :: nat
by (fact dvd_lcmI2)
lemma dvd_lcm_I1_int [simp]: "i dvd m \<Longrightarrow> i dvd lcm m n"
for i m n :: int
by (fact dvd_lcmI1)
lemma dvd_lcm_I2_int [simp]: "i dvd n \<Longrightarrow> i dvd lcm m n"
for i m n :: int
by (fact dvd_lcmI2)
lemmas Gcd_dvd_nat [simp] = Gcd_dvd [where ?'a = nat]
lemmas Gcd_dvd_int [simp] = Gcd_dvd [where ?'a = int]
lemmas Gcd_greatest_nat [simp] = Gcd_greatest [where ?'a = nat]
lemmas Gcd_greatest_int [simp] = Gcd_greatest [where ?'a = int]
lemma dvd_Lcm_int [simp]: "m \<in> M \<Longrightarrow> m dvd Lcm M"
for M :: "int set"
by (fact dvd_Lcm)
lemma gcd_neg_numeral_1_int [simp]: "gcd (- numeral n :: int) x = gcd (numeral n) x"
by (fact gcd_neg1_int)
lemma gcd_neg_numeral_2_int [simp]: "gcd x (- numeral n :: int) = gcd x (numeral n)"
by (fact gcd_neg2_int)
lemma gcd_proj1_if_dvd_nat [simp]: "x dvd y \<Longrightarrow> gcd x y = x"
for x y :: nat
by (fact gcd_nat.absorb1)
lemma gcd_proj2_if_dvd_nat [simp]: "y dvd x \<Longrightarrow> gcd x y = y"
for x y :: nat
by (fact gcd_nat.absorb2)
lemmas Lcm_eq_0_I_nat [simp] = Lcm_eq_0_I [where ?'a = nat]
lemmas Lcm_0_iff_nat [simp] = Lcm_0_iff [where ?'a = nat]
lemmas Lcm_least_int [simp] = Lcm_least [where ?'a = int]
end
|
import Drahko
foo : Promise String
foo = do
let dot = "."
let x = \y => do
msgBox "appending"
pure (y ++ dot)
a <- x "Hello"
b <- x "World"
pure (a ++ " ayy lmao " ++ b)
main : Promise ()
main = do
x <- foo
msgBox x
msgBox x |
using Distributions, Plots, CSV, Pandas
# Sample x_{k+1} given x_k
# Parameters:
# - x_k: The kth X sample. One of -1, 0, or 1
# Outputs:
# - x_{k+1}: The (k+1)th X sample
function sample_x(xk)
# Define q parameter
q = 0.3
# Probability that x_{k+1} = 1
p = q*(xk == 1) + (1-q)*(xk == 0)
return rand() < p
end
# Obtains n samples of X based on HMM
# Inputs
# - n: An integer representing the number of samples to return
# Outputs
# A vector of length n where the kth element is the kth sample of X
function get_x_samples(n)
# Store x samples
samples = zeros(n)
# Randomly set x1
samples[1] = rand(0:1)
# Get samples x_2 through x_n
for i=2:n
samples[i] = sample_x(samples[i-1])
end
return samples
end
# Obtains n samples of Y based on HMM
# Inputs
# - x_samples: A vector of length n representing the samples of X
# Outputs
# A vector of length n where the kth element is the kth sample of Y
function get_y_samples(x_samples)
# Define normal standard deviation
σ = 1.5
# Store y samples
n = length(x_samples)
y_samples = zeros(n)
for i=1:n
𝒩 = Normal(x_samples[i], σ)
y_samples[i] = rand(𝒩)
end
return y_samples
end
# Obtian and plot samples
n = 1500
x_samples = get_x_samples(n)
y_samples = get_y_samples(x_samples)
plot(1:n,x_samples, seriestype=:scatter, bg = RGB(247/255, 236/255, 226/255), color = RGB(0,191/255,255/255), label = "x", alpha = 0.2)
plot!(1:n,y_samples, seriestype=:scatter, color = RGB(191/255,1,0), label =
"y", alpha = 0.2)
cd("/Users/elvis/Documents/DSI/courses/content/stochastic-approximations/images/")
# Note X and Y variables swapped here from what was presented in example
df = DataFrame(Dict(:X=>y_samples))
CSV.write("/Users/elvis/Documents/DSI/courses/content/bayesian-inference-and-graphical-models/code/hmm_observations.csv", df)
|
function outputImage = rms(this, varargin)
% Computes root mean square along specified dimension, i.e. sqrt(mean(Y.^2))
%
%
% Y = MrImage()
% Y.rms(applicationDimension)
%
% This is a method of class MrImage.
%
% IN
% applicationDimension image dimension along which operation is
% performed (e.g. 4 = time, 3 = slices)
% default: The last dimension with more than one
% value is chosen
% (i.e. 3 for 3D image, 4 for 4D image)
%
% OUT
% outputImage rms of all images along application dimension
%
% EXAMPLE
% rms
%
% See also MrImage MrImage.perform_unary_operation
% Author: Saskia Klein & Lars Kasper
% Created: 2014-12-23
% Copyright (C) 2014 Institute for Biomedical Engineering
% University of Zurich and ETH Zurich
%
% This file is part of the TAPAS UniQC Toolbox, which is released
% under the terms of the GNU General Public Licence (GPL), version 3.
% You can redistribute it and/or modify it under the terms of the GPL
% (either version 3 or, at your option, any later version).
% For further details, see the file COPYING or
% <http://www.gnu.org/licenses/>.
if nargin > 1
applicationDimension = varargin{1};
outputImage = mean(this.^2, applicationDimension).^(1/2);
else
outputImage = mean(this.^2).^(1/2);
end |
/-
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Johannes Hölzl
-/
import Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.data.equiv.list
import Mathlib.data.set.finite
import Mathlib.PostPort
universes u v u_1
namespace Mathlib
/-!
# Countable sets
-/
namespace set
/-- A set is countable if there exists an encoding of the set into the natural numbers.
An encoding is an injection with a partial inverse, which can be viewed as a
constructive analogue of countability. (For the most part, theorems about
`countable` will be classical and `encodable` will be constructive.)
-/
def countable {α : Type u} (s : set α) :=
Nonempty (encodable ↥s)
theorem countable_iff_exists_injective {α : Type u} {s : set α} : countable s ↔ ∃ (f : ↥s → ℕ), function.injective f := sorry
/-- A set `s : set α` is countable if and only if there exists a function `α → ℕ` injective
on `s`. -/
theorem countable_iff_exists_inj_on {α : Type u} {s : set α} : countable s ↔ ∃ (f : α → ℕ), inj_on f s := sorry
theorem countable_iff_exists_surjective {α : Type u} [ne : Nonempty α] {s : set α} : countable s ↔ ∃ (f : ℕ → α), s ⊆ range f := sorry
/--
A non-empty set is countable iff there exists a surjection from the
natural numbers onto the subtype induced by the set.
-/
theorem countable_iff_exists_surjective_to_subtype {α : Type u} {s : set α} (hs : set.nonempty s) : countable s ↔ ∃ (f : ℕ → ↥s), function.surjective f := sorry
/-- Convert `countable s` to `encodable s` (noncomputable). -/
def countable.to_encodable {α : Type u} {s : set α} : countable s → encodable ↥s :=
Classical.choice
theorem countable_encodable' {α : Type u} (s : set α) [H : encodable ↥s] : countable s :=
Nonempty.intro H
theorem countable_encodable {α : Type u} [encodable α] (s : set α) : countable s :=
Nonempty.intro encodable.subtype
/-- If `s : set α` is a nonempty countable set, then there exists a map
`f : ℕ → α` such that `s = range f`. -/
theorem countable.exists_surjective {α : Type u} {s : set α} (hc : countable s) (hs : set.nonempty s) : ∃ (f : ℕ → α), s = range f := sorry
@[simp] theorem countable_empty {α : Type u} : countable ∅ :=
Nonempty.intro
(encodable.mk (fun (x : ↥∅) => false.elim (subtype.property x)) (fun (n : ℕ) => none)
fun (x : ↥∅) => false.elim (subtype.property x))
@[simp] theorem countable_singleton {α : Type u} (a : α) : countable (singleton a) :=
Nonempty.intro (encodable.of_equiv PUnit (equiv.set.singleton a))
theorem countable.mono {α : Type u} {s₁ : set α} {s₂ : set α} (h : s₁ ⊆ s₂) : countable s₂ → countable s₁ := sorry
theorem countable.image {α : Type u} {β : Type v} {s : set α} (hs : countable s) (f : α → β) : countable (f '' s) := sorry
theorem countable_range {α : Type u} {β : Type v} [encodable α] (f : α → β) : countable (range f) :=
eq.mpr (id (Eq._oldrec (Eq.refl (countable (range f))) (Eq.symm image_univ)))
(countable.image (countable_encodable univ) f)
theorem exists_seq_supr_eq_top_iff_countable {α : Type u} [complete_lattice α] {p : α → Prop} (h : ∃ (x : α), p x) : (∃ (s : ℕ → α), (∀ (n : ℕ), p (s n)) ∧ (supr fun (n : ℕ) => s n) = ⊤) ↔
∃ (S : set α), countable S ∧ (∀ (s : α), s ∈ S → p s) ∧ Sup S = ⊤ := sorry
theorem exists_seq_cover_iff_countable {α : Type u} {p : set α → Prop} (h : ∃ (s : set α), p s) : (∃ (s : ℕ → set α), (∀ (n : ℕ), p (s n)) ∧ (Union fun (n : ℕ) => s n) = univ) ↔
∃ (S : set (set α)), countable S ∧ (∀ (s : set α), s ∈ S → p s) ∧ ⋃₀S = univ :=
exists_seq_supr_eq_top_iff_countable h
theorem countable_of_injective_of_countable_image {α : Type u} {β : Type v} {s : set α} {f : α → β} (hf : inj_on f s) (hs : countable (f '' s)) : countable s := sorry
theorem countable_Union {α : Type u} {β : Type v} {t : α → set β} [encodable α] (ht : ∀ (a : α), countable (t a)) : countable (Union fun (a : α) => t a) :=
eq.mpr (id (Eq._oldrec (Eq.refl (countable (Union fun (a : α) => t a))) (Union_eq_range_sigma fun (a : α) => t a)))
(countable_range fun (a : sigma fun (i : α) => ↥(t i)) => ↑(sigma.snd a))
theorem countable.bUnion {α : Type u} {β : Type v} {s : set α} {t : (x : α) → x ∈ s → set β} (hs : countable s) (ht : ∀ (a : α) (H : a ∈ s), countable (t a H)) : countable (Union fun (a : α) => Union fun (H : a ∈ s) => t a H) := sorry
theorem countable.sUnion {α : Type u} {s : set (set α)} (hs : countable s) (h : ∀ (a : set α), a ∈ s → countable a) : countable (⋃₀s) :=
eq.mpr (id (Eq._oldrec (Eq.refl (countable (⋃₀s))) sUnion_eq_bUnion)) (countable.bUnion hs h)
theorem countable_Union_Prop {β : Type v} {p : Prop} {t : p → set β} (ht : ∀ (h : p), countable (t h)) : countable (Union fun (h : p) => t h) := sorry
theorem countable.union {α : Type u} {s₁ : set α} {s₂ : set α} (h₁ : countable s₁) (h₂ : countable s₂) : countable (s₁ ∪ s₂) :=
eq.mpr (id (Eq._oldrec (Eq.refl (countable (s₁ ∪ s₂))) union_eq_Union))
(countable_Union (iff.mpr bool.forall_bool { left := h₂, right := h₁ }))
theorem countable.insert {α : Type u} {s : set α} (a : α) (h : countable s) : countable (insert a s) :=
eq.mpr (id (Eq._oldrec (Eq.refl (countable (insert a s))) (insert_eq a s))) (countable.union (countable_singleton a) h)
theorem finite.countable {α : Type u} {s : set α} : finite s → countable s := sorry
/-- The set of finite subsets of a countable set is countable. -/
theorem countable_set_of_finite_subset {α : Type u} {s : set α} : countable s → countable (set_of fun (t : set α) => finite t ∧ t ⊆ s) := sorry
theorem countable_pi {α : Type u} {π : α → Type u_1} [fintype α] {s : (a : α) → set (π a)} (hs : ∀ (a : α), countable (s a)) : countable (set_of fun (f : (a : α) → π a) => ∀ (a : α), f a ∈ s a) := sorry
theorem countable_prod {α : Type u} {β : Type v} {s : set α} {t : set β} (hs : countable s) (ht : countable t) : countable (set.prod s t) := sorry
/-- Enumerate elements in a countable set.-/
def enumerate_countable {α : Type u} {s : set α} (h : countable s) (default : α) : ℕ → α :=
fun (n : ℕ) => sorry
theorem subset_range_enumerate {α : Type u} {s : set α} (h : countable s) (default : α) : s ⊆ range (enumerate_countable h default) := sorry
end set
theorem finset.countable_to_set {α : Type u} (s : finset α) : set.countable ↑s :=
set.finite.countable (finset.finite_to_set s)
|
Professional, affordable, friendly and reliable face painter. Based in Milton keynes.
Founded in 2012, Danielle's face painting has quickly become a well established professional business and has worked with companies such as oxfam, IPAN (with Melanie Sykes), Child's play and Leo's appeal.
You may have seen us around working with our regular clients such as at the Buckinghamshire railway centre, Cancer research UK, Buckinghamshire inflatables and mi-events.
As well as corporate events, we love to add that extra colour and sparkle to private events and cater for any ocassion.
We have a current cleared DBS check (feb 2014), carry £5m Pli, medical cover and risk assessments.
Because we love our job, our prices start at just £25p/h!! and we're very willing to travel.
Dont hesitate - Contact us today for a quote!
You can contact Danielle's face painting direct by completing the form below and clicking the 'Send' button.
These details were last reviewed by Danielle's face painting, MILTON KEYNES on 20/04/2014. NOTE: This account appears dormant. It is scheduled for deletion on or just after 21/04/2014. |
#####
##### Tests for flow defaults
#####
struct CircleTest <: Manifold end
struct CircleDecoratorTest <: Manifold end
base_manifold(M::CircleDecoratorTest) = CircleTest()
@traitimpl IsDecoratorManifold{CircleDecoratorTest}
function exp!(M::CircleTest, y, x, v, t::Real)
θ = norm(v)
u = θ == 0 ? zero(v) : v ./ θ
α = θ * t
y .= cos(α) * x + sin(α) * u
return y
end
types = [Vector{Float64},
SizedVector{2, Float64},
MVector{2, Float64},
Vector{Float32},
SizedVector{2, Float32},
MVector{2, Float32}]
@testset "geodesic_flow default" begin
M = CircleTest()
x₀ = normalize(randn(2))
v₀ = normalize((I-x₀*x₀') * randn(2))
for T in types
@testset "Type $T" begin
x, v = geodesic_flow(M, convert(T, x₀), convert(T, v₀), eltype(T)(π))
@test x ≈ -x₀
@test v ≈ -v₀
end
end
end
@testset "geodesic_flow decorator default" begin
M = CircleDecoratorTest()
x₀ = normalize(randn(2))
v₀ = normalize((I-x₀*x₀') * randn(2))
for T in types
@testset "Type $T" begin
x, v = geodesic_flow(M, convert(T, x₀), convert(T, v₀), eltype(T)(π))
@test x ≈ -x₀
@test v ≈ -v₀
end
end
end
|
/**
*
* @file core_ztrmdm.c
*
* PLASMA core_blas kernel
* PLASMA is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.4.5
* @author Dulceneia Becker
* @date 2011-1-18
**/
/*
* @precisions normal z -> c d s
*/
#include <lapacke.h>
#include "dplasma_cores.h"
#include "dplasma_zcores.h"
#if defined(PARSEC_HAVE_STRING_H)
#include <string.h>
#endif /* defined(PARSEC_HAVE_STRING_H) */
#if defined(PARSEC_HAVE_STDARG_H)
#include <stdarg.h>
#endif /* defined(PARSEC_HAVE_STDARG_H) */
#include <stdio.h>
#ifdef PARSEC_HAVE_LIMITS_H
#include <limits.h>
#endif
#include <cblas.h>
#include <core_blas.h>
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
int CORE_ztrmdm(int uplo, int N, PLASMA_Complex64_t *A, int LDA);
/***************************************************************************//**
*
* @ingroup CORE_PLASMA_Complex64_t
*
* CORE_ztrmdm scales the strictly upper or strictly lower triangular part of a
* square matrix by the inverse of a diagonal matrix, ie performs either
*
* A := L / D or A := U / D (only for triangular part above or below diagonal)
*
* where:
*
* L is a strictly lower triangular matrix stored as the strictly lower triangle in A
* U is a strictly upper triangular matrix stored as the strictly upper triangle in A
* D is a diagonal matrix stored as the diagonal in A
*
* The diagonal elements of A are not changed.
*
*******************************************************************************
*
* @param[in] uplo
* INTEGER
* @arg PlasmaLower: Lower triangle of A is stored and scaled.
* @arg PlasmaUpper: Upper triangle of A is stored and scaled.
*
* @param[in] N
* INTEGER
* The number of rows and columns of A. N >= 0.
*
* @param[in,out] A
* PLASMA_Complex64_t array, dimension (LDA,N)
*
* On entry, the triangular matrix A. If uplo = 'U', the leading
* N-by-N upper triangular part of A contains the upper
* triangular part of the matrix A, and the strictly lower
* triangular part of A is not referenced. If uplo = 'L', the
* leading N-by-N lower triangular part of A contains the lower
* triangular part of the matrix A, and the strictly upper
* triangular part of A is not referenced.
*
* On exit, the strictly lower or upper triangular part of A
* scaled by the diagonal elements of A.
*
* @param[in] LDA
* INTEGER
* The leading dimension of the array A. LDA >= max(1,N).
*
*******************************************************************************
*
* @return
* \retval PLASMA_SUCCESS successful exit
* \retval <0 if -i, the i-th argument had an illegal value
*
******************************************************************************/
#if defined(PLASMA_PARSEC_HAVE_WEAK)
#pragma weak CORE_ztrmdm = PCORE_ztrmdm
#define CORE_ztrmdm PCORE_ztrmdm
#endif
int CORE_ztrmdm(int uplo, int N, PLASMA_Complex64_t *A, int LDA)
{
static PLASMA_Complex64_t zone = 1.0;
PLASMA_Complex64_t alpha;
int j;
/* Check input arguments */
if (uplo != PlasmaUpper && uplo != PlasmaLower) {
coreblas_error(1, "Illegal value of UPLO");
return -1;
}
if (N < 0) {
coreblas_error(2, "Illegal value of N");
return -2;
}
if (LDA < max(1, N)) {
coreblas_error(1, "Illegal value of LDA");
return -4;
}
/* Quick return */
if (max(N, 0) == 0)
return PLASMA_SUCCESS;
/**/
if (uplo==PlasmaLower) {
for (j=0; j<(N-1); j++) {
alpha = zone / A[LDA*j+j];
cblas_zscal(N-j-1, CBLAS_SADDR(alpha), &A[LDA*j+j+1], 1);
}
} else if (uplo==PlasmaUpper) {
for (j=1; j<N; j++) {
alpha = zone / A[LDA*j+j];
cblas_zscal(j, CBLAS_SADDR(alpha), &A[LDA*j], 1);
}
}
return PLASMA_SUCCESS;
}
|
If the measure of a set $A$ is not infinite, then the extended measure of $A$ is equal to the measure of $A$. |
open import Data.Nat hiding (_^_)
open import Data.List as List hiding (null)
open import Data.List.Membership.Propositional
open import Data.List.Relation.Unary.Any
open import Data.List.Relation.Unary.All
open import Data.List.Prefix
open import Data.Product hiding (map)
open import Data.Unit
open import Relation.Binary.PropositionalEquality hiding ([_])
open ≡-Reasoning
-- This file contains the definition of monads used for computation in
-- the definitional interpreter for MJ using scopes and frames,
-- described in Section 5 of the paper.
module MJSF.Monad (k : ℕ) where
open import MJSF.Syntax k
open import MJSF.Values k
open import ScopesFrames.ScopesFrames k Ty
module MonadG (g : Graph) where
open SyntaxG g
open ValuesG g
open UsesVal Valᵗ valᵗ-weaken renaming (getFrame to getFrame')
open import Common.Weakening
-- Computations may either time out, raise a null-pointer exception,
-- or successfully terminate to produce a result:
data Res (a : Set) : Set where
timeout : Res a
nullpointer : Res a
ok : (x : a) → Res a
-- The monad is similar to the monad used for STLCSF, except it uses
-- `Res` instead of `Maybe`:
M : (s : Scope) → (List Scope → Set) → List Scope → Set
M s p Σ = Frame s Σ → Heap Σ → Res (∃ λ Σ' → (Heap Σ' × p Σ' × Σ ⊑ Σ'))
-- We define some usual monad operations:
return : ∀ {s Σ}{p : List Scope → Set} → p Σ → M s p Σ
return v f h = ok (_ , h , v , ⊑-refl)
fmap : ∀ {A B : List Scope → Set}{Γ Σ} → (∀ {Σ} → A Σ → B Σ) → M Γ A Σ → M Γ B Σ
fmap g m f h
with (m f h)
... | timeout = timeout
... | nullpointer = nullpointer
... | ok (Σ' , h' , v' , ext') = ok (Σ' , h' , g v' , ext')
join : ∀ {A : List Scope → Set}{Γ Σ} → M Γ (M Γ A) Σ → M Γ A Σ
join m f h
with (m f h)
... | timeout = timeout
... | nullpointer = nullpointer
... | ok (Σ' , h' , m' , ext')
with (m' (wk ext' f) h')
... | timeout = timeout
... | nullpointer = nullpointer
... | ok (Σ'' , h'' , v'' , ext'') = ok ((Σ'' , h'' , v'' , ext' ⊚ ext''))
_>>=_ : ∀ {s Σ}{p q : List Scope → Set} →
M s p Σ → (∀ {Σ'} → p Σ' → M s q Σ') → M s q Σ
(a >>= b) = join (fmap b a)
-- To program in dependent-passing style, we use the variant of
-- monadic strength also used for STLCSF.
_^_ : ∀ {Σ Γ}{p q : List Scope → Set} ⦃ w : Weakenable q ⦄ →
M Γ p Σ → q Σ → M Γ (p ⊗ q) Σ
(a ^ x) f h
with (a f h)
... | timeout = timeout
... | nullpointer = nullpointer
... | ok (Σ , h' , v , ext) = ok (Σ , h' , (v , wk ext x) , ext)
-- The remaining definitions in this file are straightforward
-- monadic liftings of the coercion function from `MJSF.Values` and
-- of the frame operations.
getFrame : ∀ {s Σ} → M s (Frame s) Σ
getFrame f = return f f
usingFrame : ∀ {s s' Σ}{p : List Scope → Set} → Frame s Σ → M s p Σ → M s' p Σ
usingFrame f a _ = a f
timeoutᴹ : ∀ {s Σ}{p : List Scope → Set} → M s p Σ
timeoutᴹ _ _ = timeout
raise : ∀ {s Σ}{p : List Scope → Set} → M s p Σ
raise _ _ = nullpointer
init : ∀ {Σ s' ds es} → (s : Scope) → ⦃ shape : g s ≡ (ds , es) ⦄ →
Slots ds Σ → Links es Σ → M s' (Frame s) Σ
init {Σ} s slots links _ h
with (initFrame s slots links h)
... | (f' , h') = ok (_ , h' , f' , ∷ʳ-⊒ s Σ)
initι : ∀ {Σ s' ds es} → (s : Scope) → ⦃ shape : g s ≡ (ds , es) ⦄ →
(Frame s (Σ ∷ʳ s) → Slots ds (Σ ∷ʳ s)) → Links es Σ → M s' (Frame s) Σ
initι {Σ} s slots links _ h
with (initFrameι s slots links h)
... | (f' , h') = ok (_ , h' , f' , ∷ʳ-⊒ s Σ)
getv : ∀ {s t Σ} → (s ↦ t) → M s (Valᵗ t) Σ
getv p f h = return (getVal p f h) f h
getf : ∀ {s s' Σ} → (s ⟶ s') → M s (Frame s') Σ
getf p f h = return (getFrame' p f h) f h
getd : ∀ {s t Σ} → t ∈ declsOf s → M s (Valᵗ t) Σ
getd d f h = return (getSlot d f h) f h
getl : ∀ {s s' Σ} → s' ∈ edgesOf s → M s (Frame s') Σ
getl e f h = return (getLink e f h) f h
setd : ∀ {s t Σ} → t ∈ declsOf s → Valᵗ t Σ → M s (λ _ → ⊤) Σ
setd d v f h with (setSlot d v f h)
... | h' = return tt f h'
setv : ∀ {s t Σ} → (s ↦ t) → Valᵗ t Σ → M s (λ _ → ⊤) Σ
setv p v f h with (setVal p v f h)
... | h' = return tt f h'
|
import .preliminary
open finset nat multiplicity
section question
variables {x m n : ℕ} (hx1 : 1 < x) (hm1 : 1 < m)
(hxmn : (x ^ m + 1) ∣ (x + 1)^n)
include hxmn
lemma dvd_x_add_one_of_dvd_x_pow_m_add_one {p : ℕ} (hp : p.prime) :
p ∣ x^m + 1 → p ∣ x + 1 :=
λ h, hp.dvd_of_dvd_pow (dvd_trans h hxmn)
section m_odd
variable (hm2 : even m)
include hm2
lemma eq_two_of_prime_of_dvd_x_pow_add_one {p : ℕ} (hp : p.prime)
(hdvd : p ∣ x^m + 1) : p = 2 :=
have hpx1 : p ∣ x + 1, from dvd_x_add_one_of_dvd_x_pow_m_add_one hxmn hp hdvd,
have hxp : (x : zmodp p hp) = -1,
by rwa [← sub_eq_zero, sub_neg_eq_add, ← nat.cast_one, ← nat.cast_add,
zmodp.eq_zero_iff_dvd_nat],
have hxmp : (x^m + 1 : zmodp p hp) = 2,
by rw [hxp, neg_one_pow_eq_pow_mod_two, even_iff.1 hm2, _root_.pow_zero]; norm_num,
have h20 : (2 : zmodp p hp) = 0,
by rwa [← hxmp, ← nat.cast_one, ← nat.cast_pow, ← nat.cast_add,
zmodp.eq_zero_iff_dvd_nat],
by_contradiction (λ hp2 : p ≠ 2, zmodp.prime_ne_zero hp prime_two hp2 (by simpa using h20))
include hx1
lemma x_odd : ¬even x :=
let p := min_fac (x^m + 1) in
have hpp : p.prime, from min_fac_prime (ne_of_gt (succ_lt_succ (nat.pow_pos (by linarith) _))),
have hpdvd : p ∣ x^m + 1, from min_fac_dvd _,
have hp2 : p = 2, from eq_two_of_prime_of_dvd_x_pow_add_one hxmn hm2 hpp hpdvd,
have heven : even (x + 1),
from dvd_x_add_one_of_dvd_x_pow_m_add_one hxmn prime_two (hp2 ▸ hpdvd),
by simpa with parity_simps using heven
lemma x_pow_add_eq_mod_four_eq_two : (x^m + 1 : zmod 4) = 2 :=
have ∀ y : zmod 4, y.val % 2 = 1 → y^2 + 1 = 2, from dec_trivial,
begin
have hm2' := hm2,
cases hm2 with k hk,
rw hk,
rw [mul_comm, pow_mul],
refine this _ _,
erw [← nat.cast_pow, zmod.val_cast_nat, mod_mul_left_mod (x^k) 2 2,
← mod_two_ne_zero, ← even_iff, even_pow, not_and_distrib],
exact or.inl (x_odd hx1 hxmn hm2'),
end
lemma x_pow_m_add_one_eq_2 : x^m + 1 = 2 :=
let p := min_fac (x^m + 1) in
have hpdvd : p ∣ x^m + 1, from min_fac_dvd _,
have hpp : p.prime, from min_fac_prime (ne_of_gt (succ_lt_succ (nat.pow_pos (by linarith) _))),
have hp2 : p = 2, from eq_two_of_prime_of_dvd_x_pow_add_one hxmn hm2 hpp hpdvd,
let q := min_fac ((x^m + 1) / 2) in
have hqdvd : q ∣ (x^m + 1) / 2, from min_fac_dvd _,
have hqq : ¬q.prime,
from assume hq,
have hq2 : q = 2, from eq_two_of_prime_of_dvd_x_pow_add_one hxmn hm2 hq
(dvd_trans hqdvd (div_dvd_of_dvd (hp2 ▸ hpdvd))),
let ⟨r, hr⟩ := hqdvd in
have h4 : 4 ∣ x^m + 1,
from ⟨r, by rw [← nat.mul_div_cancel' hpdvd, hp2, hr, hq2, ← mul_assoc]; refl⟩,
begin
erw [← @zmod.eq_zero_iff_dvd_nat ⟨4, succ_pos _⟩, nat.cast_add, nat.cast_pow, nat.cast_one,
x_pow_add_eq_mod_four_eq_two hx1 hxmn hm2] at h4,
exact absurd h4 dec_trivial
end,
by rw [← nat.mul_div_cancel' hpdvd, hp2, not_imp_comm.1 min_fac_prime hqq, mul_one]
include hm1
lemma m_odd : false :=
lt_irrefl 2 $
calc 2 < x^m + 1 : succ_lt_succ (show x ^ 0 < x ^ m,
by rw [← nat.pow_eq_pow, ← nat.pow_eq_pow]; exact pow_lt_pow hx1 (by linarith))
... = 2 : x_pow_m_add_one_eq_2 hx1 hxmn hm2
end m_odd
open polynomial
include hx1 hm1
lemma x_add_one_dvd_x_pow_add_one : x + 1 ∣ x^m + 1 :=
have (X : polynomial ℤ) + 1 ∣ X ^ m + 1,
by rw [← C_1, ← sub_neg_eq_add, ← C_neg, dvd_iff_is_root, is_root, eval_add, eval_C, eval_pow,
eval_X, neg_one_pow_eq_pow_mod_two, not_even_iff.1 (m_odd hx1 hm1 hxmn), _root_.pow_one,
neg_add_self],
let ⟨p, hp⟩ := this in
int.coe_nat_dvd.1 ⟨(p.eval (x : ℤ)), by simpa [-add_comm] using congr_arg (eval (x : ℤ)) hp⟩
omit hx1 hm1 hxmn
lemma prime_dvd_choose {p : ℕ} (hp : p.prime) {r t i : ℕ} (hm1 : m % 2 = 1) (hi2 : 2 ≤ i)
(hpr : p ^ r ∣ m) : p ^ (r + t + 2) ∣ choose m i * p^((t + 1) * i) :=
have hit : t + 2 ≤ (t + 1) * i,
by rw [add_mul, one_mul]; exact add_le_add
(le_mul_of_one_le_right' (nat.zero_le _) (by linarith)) hi2,
if hp2 : p = 2
then have hr : r = 0,
begin
subst hp2,
cases r, { refl },
{ rw [nat.pow_succ] at hpr,
rw [← mod_two_ne_zero, ← dvd_iff_mod_eq_zero] at hm1,
exact false.elim (hm1 (dvd_trans (by simp) hpr)) }
end,
begin
subst hr, simp only [zero_add, add_mul, one_mul],
exact dvd_mul_of_dvd_right (pow_dvd_pow _
(add_le_add (by conv_lhs {rw ← mul_one t}; exact mul_le_mul (le_refl _)
(by linarith) zero_le_one (nat.zero_le _)) hi2)) _
end
else
have ¬p ^ ((t + 1) * i - (t + 2) + 1) ∣ i,
from
if ht0 : t = 0
then begin
subst ht0,
simp only [add_zero, zero_add, nat.pow_one, one_mul, nat.pow_add],
show ¬p ^ (i - 2 + 1) ∣ i,
{ assume h : p ^ (i - 2 + 1) ∣ i,
have hpi : p ^ (i - 2 + 1) ≤ i, from le_of_dvd (by linarith) h,
exact not_lt_of_ge hpi
(calc i = i - 2 + 2 : by rw [nat.sub_add_cancel hi2]
... < p ^ (i - 2) + 2 * 1 : add_lt_add_of_lt_of_le
(nat.lt_pow_self hp.one_lt _) (le_refl _)
... ≤ p ^ (i - 2) + 2 * p ^ (i - 2) : add_le_add (le_refl _)
(nat.mul_le_mul_left _ (nat.pow_pos hp.pos _))
... = 3 * p ^ (i - 2) : by simp [bit0, bit1, add_mul]
... ≤ p * p ^ (i - 2) : nat.mul_le_mul_right
_ (succ_le_of_lt $ lt_of_le_of_ne hp.two_le (ne.symm hp2))
... = p ^ (i - 2 + 1) : by rw [nat.pow_succ, mul_comm]) }
end
else
have i ≤ (t + 1) * i - (t + 2) + 1,
begin
rw [← nat.sub_add_comm hit, add_mul, one_mul, show 2 = 1 + 1, from rfl],
refine nat.le_sub_left_of_add_le _,
rw [add_assoc, add_right_comm, ← add_assoc, add_le_add_iff_right,
← add_assoc, add_le_add_iff_right],
cases i with i, { exact absurd hi2 dec_trivial },
{ rw [mul_succ],
exact add_le_add (le_mul_of_one_le_right' (nat.zero_le _) (le_of_succ_le_succ hi2))
(nat.pos_of_ne_zero ht0) }
end,
mt (dvd_trans (nat.pow_dvd_pow _ this))
(mt (le_of_dvd (by linarith)) (not_le_of_gt (nat.lt_pow_self hp.one_lt _))),
begin
rw [add_assoc, nat.pow_add, ← nat.sub_add_cancel hit, nat.pow_add _ (_ - _), ← mul_assoc,
nat.mul_dvd_mul_iff_right (nat.pow_pos hp.pos _)],
exact hp.pow_dvd_choose_mul_pow (by linarith) hpr this
end
include hx1 hm1 hxmn
lemma prime_dvd_m {p : ℕ} (hp : p.prime) : ∀ {r s t : ℕ} (ht : p ^ t ∣ x + 1) (ht' : ¬p ^ (t + 1) ∣ x + 1)
(hst : p ^ (s + t) ∣ x^m + 1) (hrs : r ≤ s), p ^ r ∣ m
| 0 s t ht ht' hst hrs := by simp
| r 0 0 ht ht' hst hrs := by simp * at *
| r (s+1) 0 ht ht' hst hrs := false.elim $ ht' $
dvd_x_add_one_of_dvd_x_pow_m_add_one hxmn (by simpa using hp)
(dvd_trans (nat.pow_dvd_pow _ (nat.succ_pos _)) hst)
| (r+1) s (t+1) ht ht' hst hrs :=
let ⟨k, hk⟩ := ht in
have hpk : ¬p ∣ k, from λ hpk, ht'
(by rw [nat.pow_succ, hk]; exact mul_dvd_mul (dvd_refl _) hpk),
have hxm_eq_kpt : (x^m + 1 : ℤ) = (k * p ^ (t+1) - 1)^m + 1,
by rw [← int.coe_nat_inj', int.coe_nat_add, ← eq_sub_iff_add_eq] at hk;
rw [hk]; simp [mul_comm],
have hmeven : even (m - 1),
from suffices even (m - 1 + 1 + 1), by simpa with parity_simps,
by simp [nat.sub_add_cancel (le_of_lt hm1), m_odd hx1 hm1 hxmn] with parity_simps,
have hxm_eq_sum : (x^m + 1 : ℤ) = m * k * p ^ (t+1) + (Ico 2 m.succ).sum
(λ i, choose m i * p^((t+1) * i) * (k^i * (-1) ^ (m - i))),
begin
rw [hxm_eq_kpt, sub_eq_add_neg, add_pow, ← Ico.zero_bot, sum_eq_sum_Ico_succ_bot (succ_pos _),
sum_eq_sum_Ico_succ_bot (succ_lt_succ (lt_trans zero_lt_one hm1)),
nat.sub_zero, neg_one_pow_eq_pow_mod_two, not_even_iff.1 (m_odd hx1 hm1 hxmn),
@neg_one_pow_eq_pow_mod_two _ _ (m - 1), even_iff.1 hmeven],
simp [mul_comm, (pow_mul _ _ _).symm, mul_assoc, mul_left_comm, _root_.mul_pow],
simp only [mul_comm, mul_left_comm, mul_assoc],
end,
have hpr : p ^ r ∣ m, from prime_dvd_m ht ht' hst (le_of_succ_le hrs),
have hdvd_sum : (p : ℤ) ^ (r + (t+1) + 1) ∣ (Ico 2 m.succ).sum
(λ i, choose m i * p^((t+1) * i) * (k^i * (-1 : ℤ) ^ (m - i))),
from dvd_sum (λ i hi, begin
refine dvd_mul_of_dvd_left _ _,
simp only [(int.coe_nat_pow _ _).symm, (int.coe_nat_mul _ _).symm, int.coe_nat_dvd],
convert prime_dvd_choose hp (not_even_iff.1 (m_odd hx1 hm1 hxmn)) (Ico.mem.1 hi).1 hpr
end),
have hdvd_m : (p : ℤ) ^ (r + (t+1) + 1) ∣ m * k * p ^ (t+1),
from (dvd_add_iff_left hdvd_sum).2 begin
rw [← hxm_eq_sum],
simp only [(int.coe_nat_pow _ _).symm, int.coe_nat_dvd,
int.coe_nat_one.symm, (int.coe_nat_add _ _).symm],
exact dvd_trans (nat.pow_dvd_pow _ (by linarith)) hst,
end,
have hdvd_mk : p^(r + 1) ∣ m * k,
from nat.dvd_of_mul_dvd_mul_right (nat.pow_pos hp.pos (t + 1))
(int.coe_nat_dvd.1 $ by simpa [(_root_.pow_add _ _ _).symm] using hdvd_m),
hp.pow_dvd_of_dvd_mul_of_not_dvd hdvd_mk hpk
lemma x_pow_add_one_div_x_add_one_dvd_m : (x^m + 1) / (x + 1) ∣ m :=
dvd_of_forall_prime_pow_dvd $
(λ (p r : ℕ) (hp : p.prime) h,
have htdom : (multiplicity p (x + 1)).dom, from finite_nat_iff.2 ⟨ne_of_gt hp.one_lt, succ_pos _⟩,
let t := (multiplicity p (x + 1)).get htdom in
have ht : p ^ t ∣ x + 1, by rw [← nat.pow_eq_pow]; exact pow_multiplicity_dvd _,
have hrt : p ^ (r + t) ∣ (x^m + 1),
by rw [nat.pow_add, ← nat.div_mul_cancel (x_add_one_dvd_x_pow_add_one hx1 hm1 hxmn)];
exact mul_dvd_mul h ht,
have ht' : ¬p ^ (t + 1) ∣ x + 1,
by rw [← nat.pow_eq_pow, ← multiplicity_lt_iff_neg_dvd, ← enat.coe_get htdom, enat.coe_lt_coe];
exact nat.lt_succ_self _,
prime_dvd_m hx1 hm1 hxmn hp ht ht' hrt (le_refl _))
lemma x_pow_add_one_le_m_mul_x_add_m : x ^ m + 1 ≤ x * m + m :=
le_of_dvd (by linarith) $
let ⟨q, hq⟩ := x_pow_add_one_div_x_add_one_dvd_m hx1 hm1 hxmn in
begin
rw [show x * m + m = (x + 1) * m, by simp [add_mul]],
conv_rhs {rw hq},
rw [← mul_assoc, nat.mul_div_cancel' (x_add_one_dvd_x_pow_add_one hx1 hm1 hxmn)],
simp
end
lemma m_eq_three : m = 3 :=
have x ^ m + 1 ≤ x * m + m, from x_pow_add_one_le_m_mul_x_add_m hx1 hm1 hxmn,
have h4m : ¬ 4 ≤ m,
from λ h, let ⟨m', hm'⟩ := le_iff_exists_add.1 h in
let ⟨x', (hx' : x = 2 + x')⟩ := le_iff_exists_add.1 (nat.succ_le_of_lt hx1) in
have h32 : m' + 4 ≤ 32 * (x' + 2) ^ m',
from calc m' + 4 ≤ (x' + 2) ^ m' + 4 * 1:
add_le_add (le_of_lt $ nat.lt_pow_self dec_trivial _) (le_refl _)
... ≤ (x' + 2) ^ m' + 4 * (x' + 2) ^ m' :
add_le_add (le_refl _) (mul_le_mul_left _ (nat.pow_pos (succ_pos _) _))
... = 5 * (x' + 2) ^ m' : by ring
... ≤ 32 * (x' + 2) ^ m' : mul_le_mul_right _ dec_trivial,
have h16 : 3 * m' + 12 < 16 * (x' + 2) ^ m',
from calc 3 * m' + 12 ≤ 3 * (x' + 2) ^ m' + 12 * 1 :
add_le_add (nat.mul_le_mul_left _ (le_of_lt $ lt_pow_self dec_trivial _)) (le_refl _)
... ≤ 3 * (x' + 2) ^ m' + 12 * (x' + 2) ^ m' :
add_le_add (le_refl _) (mul_le_mul_left _ (nat.pow_pos (succ_pos _) _))
... = 15 * (x' + 2) ^ m' : by ring
... < 16 * (x' + 2) ^ m' :
(mul_lt_mul_right (nat.pow_pos (succ_pos _) _)).2 dec_trivial,
begin
clear_aux_decl, substs hm' hx',
exact not_lt_of_ge this
(calc (2 + x') * (4 + m') + (4 + m')
= x' * (m' + 4) + (3 * m' + 12) : by ring
... < x' * (32 * (x' + 2) ^ m') + 16 * (x' + 2) ^ m' :
add_lt_add_of_le_of_lt (mul_le_mul_left _ h32) h16
... ≤ (x' * (32 * (x' + 2) ^ m') + 16 * (x' + 2) ^ m') +
(1 + (x' + 2) ^ m' * (x' ^ 4 + 8 * x' ^ 3 + 24 * x' ^ 2)) :
le_add_right (le_refl _)
... = (2 + x') ^ (4 + m') + 1 : by simp [nat.pow_add]; ring)
end,
have m_odd : ¬ even m, from m_odd hx1 hm1 hxmn,
begin
clear hxmn this,
rw [not_le] at h4m,
revert m_odd hm1, revert m,
exact dec_trivial
end
lemma x_eq_two : x = 2 :=
have hm3 : m = 3, from m_eq_three hx1 hm1 hxmn,
have x ^ m + 1 ≤ x * m + m, from x_pow_add_one_le_m_mul_x_add_m hx1 hm1 hxmn,
have h3x : ¬ 3 ≤ x, from λ h3x,
begin
rcases le_iff_exists_add.1 h3x with ⟨x', rfl⟩,
subst hm3,
exact not_lt_of_ge this
(calc (3 + x') * 3 + 3 < x' ^ 3 + 9 * x' ^ 2 + 27 * x' + 28 : by linarith
... = (3 + x') ^ 3 + 1 : by ring)
end,
by linarith
omit hxmn
lemma question_4 : x ^ m + 1 ∣ (x + 1) ^ n ↔ (x = 2 ∧ m = 3 ∧ 2 ≤ n) :=
iff.intro
(λ hxmn,
have hm3 : m = 3, from m_eq_three hx1 hm1 hxmn,
have hx2 : x = 2, from x_eq_two hx1 hm1 hxmn,
⟨hx2, hm3, begin
substs hm3 hx2,
refine le_of_not_lt (λ h2n, _),
revert hxmn, revert n,
exact dec_trivial
end⟩)
(begin
rintros ⟨rfl, rfl, hn2⟩,
rw [← nat.add_sub_cancel' hn2, nat.pow_add],
exact dvd_mul_right _ _
end)
end question |
"""
noise_uu(n::Int, lo = - 1, hi = 1)
Generate a signal consisting of `n` steps of uncorrelated uniform noise from
a uniform distribution on `[lo, hi]`.
"""
function noise_uu(n::Int; lo = - 1, hi = 1)
u = Uniform(-lo, hi)
rand(u, n)
end
"""
noise_ug(n::Int; μ = 0, σ = 1)
Generate a signal consisting of `n` steps of uncorrelated Gaussian noise from
a normal distribution with mean `μ` and standard deviation `σ`.
"""
function noise_ug(n::Int; μ = 0, σ = 1)
d = Normal(μ, σ)
rand(d, n)
end
"""
noise_brownian(n::Int; lo = - 1, hi = 1)
noise_brownian(d::Distribution, n::Int)
Generate a signal consisting of `n` steps of Brownian noise, generated as
the zero-mean and unit standard deviation normalised cumulative sum of noise
generated from a uniform distribution on `[lo, hi]`. Optionally, a distribution
`d` from which to sample can be provided.
## Examples
```julia
# Based on uncorrelated uniform noise
noise_brownian(100)
noise_brownian(100, lo = -2, hi = 2)
noise_brownian(Uniform(-3, 3), 100)
# Based on uncorrelated Gaussian noise
μ, σ = 0, 2
noise_brownian(Normal(μ, σ), 100)
```
"""
function noise_brownian(n::Int; lo = - 1, hi = 1)
u = Uniform(lo, hi)
xs = cumsum(rand(u, n))
(xs .- mean(xs)) ./ std(xs)
end
function noise_brownian(d::Distribution, n::Int)
xs = cumsum(rand(d, n))
(xs .- mean(xs)) ./ (std(xs))
end
export noise_uu, noise_ug, noise_brownian |
Ask any business, and there’s a good chance it’s into e-commerce. It may already have a shopping website, or one is already on the pipeline. Even big-time retailers such as Ralph Lauren are redirecting some of their revenues to digital marketing efforts.
No one can blame them. In the Enterprise Guide to Global E-commerce report, its revenue could increase by no less than $4 trillion in 2021. It’s a far cry from less than $1.5 trillion in 2014. It’s also the only trillion-dollar industry to post double-digit growth, according to eMarketer.
Appearance and Use across Different Platforms – The way the website looks on a PC is entirely different once consumers see and use it on a mobile device. Smartphones and tablets, for example, have a much smaller viewing area. Some parts of the site may not render well.
Loading Time – This refers to how fast someone can view the contents of a website. Statistics revealed that Internet users these days are impatient. They wait for less than three seconds before they are likely to choose another site. In the meantime, websites with a one-second load time tend to have the highest traffic growth at 4.6%.
User Experience – Also known as UX design, it is a process of designing websites to boost their usefulness, ease of use, and customer satisfaction. In other words, the pages should make viewing and eventually shopping a pleasant experience.
Because of these, e-commerce owners may benefit more from a customized web development service from teams such as Rebranded.io than from template-based systems including WordPress.
Provide different options for feedback (e.g., live chat, landline, mobile, office address, and email address).
Personalize the experience. Use analytics to create a list of recommended products, for example.
Offer many methods of payments and delivery.
About 12% of the population are into e-commerce, which means there’s still a lot of room to grow. There’s even a big market to tap. Don’t waste it by making these critical mistakes. |
State Before: α : Type ?u.816393
β : Type ?u.816396
a b c d : ℝ≥0∞
r p q : ℝ≥0
x : ℝ
hx : 0 < x
⊢ (ENNReal.ofReal x)⁻¹ = ENNReal.ofReal x⁻¹ State After: no goals Tactic: rw [ENNReal.ofReal, ENNReal.ofReal, ← @coe_inv (Real.toNNReal x) (by simp [hx]), coe_eq_coe,
← Real.toNNReal_inv] State Before: α : Type ?u.816393
β : Type ?u.816396
a b c d : ℝ≥0∞
r p q : ℝ≥0
x : ℝ
hx : 0 < x
⊢ Real.toNNReal x ≠ 0 State After: no goals Tactic: simp [hx] |
{-# LANGUAGE FlexibleContexts #-}
{- |
Module : Language.Scheme.Numerical
Copyright : Justin Ethier
Licence : MIT (see LICENSE in the distribution)
Maintainer : github.com/justinethier
Stability : experimental
Portability : portable
This module implements the numerical tower.
-}
module Language.Scheme.Numerical (
-- * Generic functions
numSub
, numMul
, numDiv
, numAdd
, numMod
, numRationalize
, numBoolBinopEq
, numBoolBinopGt
, numBoolBinopGte
, numBoolBinopLt
, numBoolBinopLte
, numCast
, numDenominator
, numNumerator
, numInexact2Exact
, numExact2Inexact
, num2String
, unpackNum
, numericBinop
-- * Floating point functions
, numFloor
, numCeiling
, numTruncate
, numRound
, numExpt
, numSqrt
, numExp
, numLog
-- * Trigonometric functions
, numSin
, numCos
, numTan
, numAsin
, numAcos
, numAtan
-- * Complex functions
, buildComplex
, numMakePolar
, numRealPart
, numImagPart
, numMagnitude
, numAngle
, numMakeRectangular
-- * Predicates
, isComplex
, isReal
, isRational
, isInteger
, isNumber
, isFloatAnInteger
, isNumNaN
, isNumInfinite
, isNumFinite
, isNumExact
, isNumInexact
) where
import Language.Scheme.Types
import Control.Monad.Error
import Data.Char hiding (isNumber)
import Data.Complex
import Data.Fixed
import Data.Ratio
import Numeric
import Text.Printf
-- |A helper function to perform a numeric operation on two values
numericBinop :: (Integer -> Integer -> Integer) -> [LispVal] -> ThrowsError LispVal
numericBinop _ singleVal@[_] = throwError $ NumArgs (Just 2) singleVal
numericBinop op aparams = mapM unpackNum aparams >>= return . Number . foldl1 op
-- - Begin GenUtil - http://repetae.net/computer/haskell/GenUtil.hs
foldlM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a
foldlM f v (x : xs) = (f v x) >>= \ a -> foldlM f a xs
foldlM _ v [] = return v
foldl1M :: Monad m => (a -> a -> m a) -> [a] -> m a
foldl1M f (x : xs) = foldlM f x xs
foldl1M _ _ = error "Unexpected error in foldl1M"
-- end GenUtil
{- FUTURE: as a general comment here, operations need to be more permissive of the
numerical types they accept. Within reason, a user should not have to know
what numerical type they are passing when using these functions -}
-- |Add the given numbers
numAdd :: [LispVal] -> ThrowsError LispVal
numAdd [] = return $ Number 0
numAdd aparams = do
foldl1M (\ a b -> doAdd =<< (numCast [a, b])) aparams
where doAdd (List [(Number a), (Number b)]) = return $ Number $ a + b
doAdd (List [(Float a), (Float b)]) = return $ Float $ a + b
doAdd (List [(Rational a), (Rational b)]) = return $ Rational $ a + b
doAdd (List [(Complex a), (Complex b)]) = return $ Complex $ a + b
doAdd _ = throwError $ Default "Unexpected error in +"
-- |Subtract the given numbers
numSub :: [LispVal] -> ThrowsError LispVal
numSub [] = throwError $ NumArgs (Just 1) []
numSub [Number n] = return $ Number $ -1 * n
numSub [Float n] = return $ Float $ -1 * n
numSub [Rational n] = return $ Rational $ -1 * n
numSub [Complex n] = return $ Complex $ -1 * n
numSub aparams = do
foldl1M (\ a b -> doSub =<< (numCast [a, b])) aparams
where doSub (List [(Number a), (Number b)]) = return $ Number $ a - b
doSub (List [(Float a), (Float b)]) = return $ Float $ a - b
doSub (List [(Rational a), (Rational b)]) = return $ Rational $ a - b
doSub (List [(Complex a), (Complex b)]) = return $ Complex $ a - b
doSub _ = throwError $ Default "Unexpected error in -"
-- |Multiply the given numbers
numMul :: [LispVal] -> ThrowsError LispVal
numMul [] = return $ Number 1
numMul aparams = do
foldl1M (\ a b -> doMul =<< (numCast [a, b])) aparams
where doMul (List [(Number a), (Number b)]) = return $ Number $ a * b
doMul (List [(Float a), (Float b)]) = return $ Float $ a * b
doMul (List [(Rational a), (Rational b)]) = return $ Rational $ a * b
doMul (List [(Complex a), (Complex b)]) = return $ Complex $ a * b
doMul _ = throwError $ Default "Unexpected error in *"
-- |Divide the given numbers
numDiv :: [LispVal] -> ThrowsError LispVal
numDiv [] = throwError $ NumArgs (Just 1) []
numDiv [Number 0] = throwError $ DivideByZero
numDiv [Rational 0] = throwError $ DivideByZero
numDiv [Number n] = return $ Rational $ 1 / (fromInteger n)
numDiv [Float n] = return $ Float $ 1.0 / n
numDiv [Rational n] = return $ Rational $ 1 / n
numDiv [Complex n] = return $ Complex $ 1 / n
numDiv aparams = do
foldl1M (\ a b -> doDiv =<< (numCast [a, b])) aparams
where doDiv (List [(Number a), (Number b)])
| b == 0 = throwError $ DivideByZero
| (mod a b) == 0 = return $ Number $ div a b
| otherwise = -- Not an integer
return $ Rational $ (fromInteger a) / (fromInteger b)
doDiv (List [(Float a), (Float b)])
| b == 0.0 = throwError $ DivideByZero
| otherwise = return $ Float $ a / b
doDiv (List [(Rational a), (Rational b)])
| b == 0 = throwError $ DivideByZero
| otherwise = return $ Rational $ a / b
doDiv (List [(Complex a), (Complex b)])
| b == 0 = throwError $ DivideByZero
| otherwise = return $ Complex $ a / b
doDiv _ = throwError $ Default "Unexpected error in /"
-- |Take the modulus of the given numbers
numMod :: [LispVal] -> ThrowsError LispVal
numMod [] = return $ Number 1
numMod aparams = do
foldl1M (\ a b -> doMod =<< (numCast [a, b])) aparams
where doMod (List [(Number a), (Number b)]) = return $ Number $ mod' a b
doMod (List [(Float a), (Float b)]) = return $ Float $ mod' a b
doMod (List [(Rational a), (Rational b)]) = return $ Rational $ mod' a b
doMod (List [(Complex _), (Complex _)]) = throwError $ Default "modulo not implemented for complex numbers"
doMod _ = throwError $ Default "Unexpected error in modulo"
-- |Compare a series of numbers using a given numeric comparison
-- function and an array of lisp values
numBoolBinopCompare :: (LispVal
-> LispVal -> Either LispError LispVal)
-> LispVal -> [LispVal] -> Either LispError LispVal
numBoolBinopCompare cmp n1 (n2 : ns) = do
(n1', n2') <- numCast' (n1, n2)
result <- cmp n1' n2'
case result of
Bool True -> numBoolBinopCompare cmp n2' ns
_ -> return $ Bool False
numBoolBinopCompare _ _ _ = return $ Bool True
-- |Numeric equals
numBoolBinopEq :: [LispVal] -> ThrowsError LispVal
numBoolBinopEq [] = throwError $ NumArgs (Just 0) []
numBoolBinopEq (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a == b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp (Complex a) (Complex b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in ="
-- |Numeric greater than
numBoolBinopGt :: [LispVal] -> ThrowsError LispVal
numBoolBinopGt [] = throwError $ NumArgs (Just 0) []
numBoolBinopGt (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a > b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in >"
-- |Numeric greater than equal
numBoolBinopGte :: [LispVal] -> ThrowsError LispVal
numBoolBinopGte [] = throwError $ NumArgs (Just 0) []
numBoolBinopGte (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a >= b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in >="
-- |Numeric less than
numBoolBinopLt :: [LispVal] -> ThrowsError LispVal
numBoolBinopLt [] = throwError $ NumArgs (Just 0) []
numBoolBinopLt (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a < b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in <"
-- |Numeric less than equal
numBoolBinopLte :: [LispVal] -> ThrowsError LispVal
numBoolBinopLte [] = throwError $ NumArgs (Just 0) []
numBoolBinopLte (n : ns) = numBoolBinopCompare cmp n ns
where
f a b = a <= b
cmp (Number a) (Number b) = return $ Bool $ f a b
cmp (Float a) (Float b) = return $ Bool $ f a b
cmp (Rational a) (Rational b) = return $ Bool $ f a b
cmp _ _ = throwError $ Default "Unexpected error in <="
-- |Accept two numbers and cast one of them to the appropriate type, if necessary
numCast' :: (LispVal, LispVal) -> ThrowsError (LispVal, LispVal)
numCast' (a@(Number _), b@(Number _)) = return $ (a, b)
numCast' (a@(Float _), b@(Float _)) = return $ (a, b)
numCast' (a@(Rational _), b@(Rational _)) = return $ (a, b)
numCast' (a@(Complex _), b@(Complex _)) = return $ (a, b)
numCast' ((Number a), b@(Float _)) = return $ (Float $ fromInteger a, b)
numCast' ((Number a), b@(Rational _)) = return $ (Rational $ fromInteger a, b)
numCast' ((Number a), b@(Complex _)) = return $ (Complex $ fromInteger a, b)
numCast' (a@(Float _), (Number b)) = return $ (a, Float $ fromInteger b)
numCast' (a@(Float _), (Rational b)) = return $ (a, Float $ fromRational b)
numCast' ((Float a), b@(Complex _)) = return $ (Complex $ a :+ 0, b)
numCast' (a@(Rational _), (Number b)) = return $ (a, Rational $ fromInteger b)
numCast' ((Rational a), b@(Float _)) = return $ (Float $ fromRational a, b)
numCast' ((Rational a), b@(Complex _)) = return $ (Complex $ (fromInteger $ numerator a) / (fromInteger $ denominator a), b)
numCast' (a@(Complex _), (Number b)) = return $ (a, Complex $ fromInteger b)
numCast' (a@(Complex _), (Float b)) = return $ (a, Complex $ b :+ 0)
numCast' (a@(Complex _), (Rational b)) = return $ (a, Complex $ (fromInteger $ numerator b) / (fromInteger $ denominator b))
numCast' (a, b) = case a of
Number _ -> doThrowError b
Float _ -> doThrowError b
Rational _ -> doThrowError b
Complex _ -> doThrowError b
_ -> doThrowError a
where doThrowError num = throwError $ TypeMismatch "number" num
-- |Accept two numbers and cast one of them to the appropriate type, if necessary
numCast :: [LispVal] -> ThrowsError LispVal
numCast [a, b] = do
(a', b') <- numCast' (a, b)
pure $ List [a', b']
numCast _ = throwError $ Default "Unexpected error in numCast"
-- |Convert the given number to a rational
numRationalize :: [LispVal] -> ThrowsError LispVal
numRationalize [(Number n)] = return $ Rational $ toRational n
numRationalize [(Float n)] = return $ Rational $ toRational n
numRationalize [n@(Rational _)] = return n
numRationalize [x] = throwError $ TypeMismatch "number" x
numRationalize badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Round the given number
numRound :: [LispVal] -> ThrowsError LispVal
numRound [n@(Number _)] = return n
numRound [(Rational n)] = return $ Number $ round n
numRound [(Float n)] = return $ Float $ fromInteger $ round n
numRound [(Complex n)] = do
return $ Complex $ (fromInteger $ round $ realPart n) :+ (fromInteger $ round $ imagPart n)
numRound [x] = throwError $ TypeMismatch "number" x
numRound badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Floor the given number
numFloor :: [LispVal] -> ThrowsError LispVal
numFloor [n@(Number _)] = return n
numFloor [(Rational n)] = return $ Number $ floor n
numFloor [(Float n)] = return $ Float $ fromInteger $ floor n
numFloor [(Complex n)] = do
return $ Complex $ (fromInteger $ floor $ realPart n) :+ (fromInteger $ floor $ imagPart n)
numFloor [x] = throwError $ TypeMismatch "number" x
numFloor badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Take the ceiling of the given number
numCeiling :: [LispVal] -> ThrowsError LispVal
numCeiling [n@(Number _)] = return n
numCeiling [(Rational n)] = return $ Number $ ceiling n
numCeiling [(Float n)] = return $ Float $ fromInteger $ ceiling n
numCeiling [(Complex n)] = do
return $ Complex $ (fromInteger $ ceiling $ realPart n) :+ (fromInteger $ ceiling $ imagPart n)
numCeiling [x] = throwError $ TypeMismatch "number" x
numCeiling badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Truncate the given number
numTruncate :: [LispVal] -> ThrowsError LispVal
numTruncate [n@(Number _)] = return n
numTruncate [(Rational n)] = return $ Number $ truncate n
numTruncate [(Float n)] = return $ Float $ fromInteger $ truncate n
numTruncate [(Complex n)] = do
return $ Complex $ (fromInteger $ truncate $ realPart n) :+ (fromInteger $ truncate $ imagPart n)
numTruncate [x] = throwError $ TypeMismatch "number" x
numTruncate badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Sine
numSin :: [LispVal] -> ThrowsError LispVal
numSin [(Number n)] = return $ Float $ sin $ fromInteger n
numSin [(Float n)] = return $ Float $ sin n
numSin [(Rational n)] = return $ Float $ sin $ fromRational n
numSin [(Complex n)] = return $ Complex $ sin n
numSin [x] = throwError $ TypeMismatch "number" x
numSin badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Cosine
numCos :: [LispVal] -> ThrowsError LispVal
numCos [(Number n)] = return $ Float $ cos $ fromInteger n
numCos [(Float n)] = return $ Float $ cos n
numCos [(Rational n)] = return $ Float $ cos $ fromRational n
numCos [(Complex n)] = return $ Complex $ cos n
numCos [x] = throwError $ TypeMismatch "number" x
numCos badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Tangent
numTan :: [LispVal] -> ThrowsError LispVal
numTan [(Number n)] = return $ Float $ tan $ fromInteger n
numTan [(Float n)] = return $ Float $ tan n
numTan [(Rational n)] = return $ Float $ tan $ fromRational n
numTan [(Complex n)] = return $ Complex $ tan n
numTan [x] = throwError $ TypeMismatch "number" x
numTan badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Arcsine
numAsin :: [LispVal] -> ThrowsError LispVal
numAsin [(Number n)] = return $ Float $ asin $ fromInteger n
numAsin [(Float n)] = return $ Float $ asin n
numAsin [(Rational n)] = return $ Float $ asin $ fromRational n
numAsin [(Complex n)] = return $ Complex $ asin n
numAsin [x] = throwError $ TypeMismatch "number" x
numAsin badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Arccosine
numAcos :: [LispVal] -> ThrowsError LispVal
numAcos [(Number n)] = return $ Float $ acos $ fromInteger n
numAcos [(Float n)] = return $ Float $ acos n
numAcos [(Rational n)] = return $ Float $ acos $ fromRational n
numAcos [(Complex n)] = return $ Complex $ acos n
numAcos [x] = throwError $ TypeMismatch "number" x
numAcos badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Arctangent
numAtan :: [LispVal] -> ThrowsError LispVal
numAtan [(Number n)] = return $ Float $ atan $ fromInteger n
numAtan [Number y, Number x] = return $ Float $ phase $ (fromInteger x) :+ (fromInteger y)
numAtan [(Float n)] = return $ Float $ atan n
numAtan [Float y, Float x] = return $ Float $ phase $ x :+ y
numAtan [(Rational n)] = return $ Float $ atan $ fromRational n
numAtan [Rational y, Rational x] = return $ Float $ phase $ (fromRational x) :+ (fromRational y)
numAtan [(Complex n)] = return $ Complex $ atan n
numAtan [x] = throwError $ TypeMismatch "number" x
numAtan badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Take the square root of the given number
numSqrt :: [LispVal] -> ThrowsError LispVal
numSqrt [(Number n)] = if n >= 0 then return $ Float $ sqrt $ fromInteger n
else return $ Complex $ sqrt ((fromInteger n) :+ 0)
numSqrt [(Float n)] = if n >= 0 then return $ Float $ sqrt n
else return $ Complex $ sqrt (n :+ 0)
numSqrt [(Rational n)] = numSqrt [Float $ fromRational n]
numSqrt [(Complex n)] = return $ Complex $ sqrt n
numSqrt [x] = throwError $ TypeMismatch "number" x
numSqrt badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Raise the first number to the power of the second
numExpt :: [LispVal] -> ThrowsError LispVal
numExpt [(Number n), (Number p)] = return $ Float $ (fromInteger n) ^ p
numExpt [(Rational n), (Number p)] = return $ Float $ (fromRational n) ^ p
numExpt [(Float n), (Number p)] = return $ Float $ n ^ p
numExpt [(Complex n), (Number p)] = return $ Complex $ n ^ p
numExpt [_, y] = throwError $ TypeMismatch "integer" y
numExpt badArgList = throwError $ NumArgs (Just 2) badArgList
{- numExpt params = do
foldl1M (\a b -> doExpt =<< (numCast [a, b])) params
where doExpt (List [(Number a), (Number b)]) = return $ Float $ (fromInteger a) ^ (fromInteger b)
-- doExpt (List [(Rational a), (Rational b)]) = return $ Float $ fromRational $ a ^ b
doExpt (List [(Float a), (Float b)]) = return $ Float $ a ^ b
-- doExpt (List [(Complex a), (Complex b)]) = return $ Complex $ a ^ b -}
-- |Take the exponent of the given number
numExp :: [LispVal] -> ThrowsError LispVal
numExp [(Number n)] = return $ Float $ exp $ fromInteger n
numExp [(Float n)] = return $ Float $ exp n
numExp [(Rational n)] = return $ Float $ exp $ fromRational n
numExp [(Complex n)] = return $ Complex $ exp n
numExp [x] = throwError $ TypeMismatch "number" x
numExp badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Compute the log of a given number
numLog :: [LispVal] -> ThrowsError LispVal
numLog [(Number n)] = return $ Float $ log $ fromInteger n
numLog [Number n, Number base] = return $ Float $ logBase (fromInteger base) (fromInteger n)
numLog [(Float n)] = return $ Float $ log n
numLog [Float n, Number base] = return $ Float $ logBase (fromInteger base) n
numLog [(Rational n)] = return $ Float $ log $ fromRational n
numLog [Rational n, Number base] = return $ Float $ logBase (fromInteger base) (fromRational n)
numLog [(Complex n)] = return $ Complex $ log n
numLog [Complex n, Number base] = return $ Complex $ logBase (fromInteger base) n
numLog [x] = throwError $ TypeMismatch "number" x
numLog badArgList = throwError $ NumArgs (Just 1) badArgList
-- Complex number functions
-- |Create a complex number
buildComplex :: LispVal
-- ^ Real part
-> LispVal
-- ^ Imaginary part
-> ThrowsError LispVal
-- ^ Complex number
buildComplex (Number x) (Number y) = return $ Complex $ (fromInteger x) :+ (fromInteger y)
buildComplex (Number x) (Rational y) = return $ Complex $ (fromInteger x) :+ (fromRational y)
buildComplex (Number x) (Float y) = return $ Complex $ (fromInteger x) :+ y
buildComplex (Rational x) (Number y) = return $ Complex $ (fromRational x) :+ (fromInteger y)
buildComplex (Rational x) (Rational y) = return $ Complex $ (fromRational x) :+ (fromRational y)
buildComplex (Rational x) (Float y) = return $ Complex $ (fromRational x) :+ y
buildComplex (Float x) (Number y) = return $ Complex $ x :+ (fromInteger y)
buildComplex (Float x) (Rational y) = return $ Complex $ x :+ (fromRational y)
buildComplex (Float x) (Float y) = return $ Complex $ x :+ y
buildComplex x y = throwError $ TypeMismatch "number" $ List [x, y]
-- |Create a complex number given its real and imaginary parts
numMakeRectangular :: [LispVal] -> ThrowsError LispVal
numMakeRectangular [x, y] = buildComplex x y
numMakeRectangular badArgList = throwError $ NumArgs (Just 2) badArgList
-- |Create a complex number from its magnitude and phase (angle)
numMakePolar :: [LispVal] -> ThrowsError LispVal
numMakePolar [(Float x), (Float y)] = return $ Complex $ mkPolar x y
numMakePolar [(Float _), y] = throwError $ TypeMismatch "real" y
numMakePolar [x, (Float _)] = throwError $ TypeMismatch "real real" $ x
numMakePolar badArgList = throwError $ NumArgs (Just 2) badArgList
-- |The phase of a complex number
numAngle :: [LispVal] -> ThrowsError LispVal
numAngle [(Complex c)] = return $ Float $ phase c
numAngle [x] = throwError $ TypeMismatch "complex number" x
numAngle badArgList = throwError $ NumArgs (Just 1) badArgList
-- |The nonnegative magnitude of a complex number
numMagnitude :: [LispVal] -> ThrowsError LispVal
numMagnitude [(Complex c)] = return $ Float $ magnitude c
numMagnitude [x] = throwError $ TypeMismatch "complex number" x
numMagnitude badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Retrieve real part of a complex number
numRealPart :: [LispVal] -> ThrowsError LispVal
numRealPart [(Complex c)] = return $ Float $ realPart c
numRealPart [n@(Float _)] = return n
numRealPart [n@(Rational _)] = return n
numRealPart [n@(Number _)] = return n
numRealPart [x] = throwError $ TypeMismatch "complex number" x
numRealPart badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Retrieve imaginary part of a complex number
numImagPart :: [LispVal] -> ThrowsError LispVal
numImagPart [(Complex c)] = do
let n = imagPart c
f = Float n
if isFloatAnInteger f
then return $ Number $ floor n
else return f
numImagPart [(Float _)] = return $ Number 0
numImagPart [(Rational _)] = return $ Number 0
numImagPart [(Number _)] = return $ Number 0
numImagPart [x] = throwError $ TypeMismatch "complex number" x
numImagPart badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Take the numerator of the given number
numNumerator :: [LispVal] -> ThrowsError LispVal
numNumerator [n@(Number _)] = return n
numNumerator [(Rational r)] = return $ Number $ numerator r
numNumerator [(Float f)] = return $ Float $ fromInteger . numerator . toRational $ f
numNumerator [x] = throwError $ TypeMismatch "rational number" x
numNumerator badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Take the denominator of the given number
numDenominator :: [LispVal] -> ThrowsError LispVal
numDenominator [Number _] = return $ Number 1
numDenominator [(Rational r)] = return $ Number $ denominator r
numDenominator [(Float f)] = return $ Float $ fromInteger $ denominator $ toRational f
numDenominator [x] = throwError $ TypeMismatch "rational number" x
numDenominator badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Convert an exact number to inexact
numExact2Inexact :: [LispVal] -> ThrowsError LispVal
numExact2Inexact [(Number n)] = return $ Float $ fromInteger n
numExact2Inexact [(Rational n)] = return $ Float $ fromRational n
numExact2Inexact [n@(Float _)] = return n
numExact2Inexact [n@(Complex _)] = return n
numExact2Inexact [badType] = throwError $ TypeMismatch "number" badType
numExact2Inexact badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Convert an inexact number to exact
numInexact2Exact :: [LispVal] -> ThrowsError LispVal
numInexact2Exact [n@(Number _)] = return n
numInexact2Exact [n@(Rational _)] = return n
numInexact2Exact [(Float n)] = return $ Number $ round n
numInexact2Exact [c@(Complex _)] = numRound [c]
numInexact2Exact [badType] = throwError $ TypeMismatch "number" badType
numInexact2Exact badArgList = throwError $ NumArgs (Just 1) badArgList
-- |Convert a number to a string; radix is optional, defaults to base 10
num2String :: [LispVal] -> ThrowsError LispVal
num2String [(Number n)] = return $ String $ show n
num2String [(Number n), (Number radix)] = do
case radix of
2 -> do -- Nice tip from StackOverflow question #1959715
return $ String $ showIntAtBase 2 intToDigit n ""
8 -> return $ String $ printf "%o" n
10 -> return $ String $ printf "%d" n
16 -> return $ String $ printf "%x" n
_ -> throwError $ BadSpecialForm "Invalid radix value" $ Number radix
num2String [n@(Rational _)] = return $ String $ show n
num2String [(Float n)] = return $ String $ show n
num2String [n@(Complex _)] = return $ String $ show n
num2String [x] = throwError $ TypeMismatch "number" x
num2String badArgList = throwError $ NumArgs (Just 1) badArgList
-- | Determine if the given value is not a number
isNumNaN :: [LispVal] -> ThrowsError LispVal
isNumNaN ([Float n]) = return $ Bool $ isNaN n
isNumNaN _ = return $ Bool False
-- | Determine if number is infinite
isNumInfinite :: [LispVal] -> ThrowsError LispVal
isNumInfinite ([Float n]) = return $ Bool $ isInfinite n
isNumInfinite _ = return $ Bool False
-- | Determine if number is not infinite
isNumFinite :: [LispVal] -> ThrowsError LispVal
isNumFinite ([Number _]) = return $ Bool True
isNumFinite ([Float n]) = return $ Bool $ not $ isInfinite n
isNumFinite ([Complex _]) = return $ Bool True
isNumFinite ([Rational _]) = return $ Bool True
isNumFinite _ = return $ Bool False
-- | Determine if number is exact
isNumExact :: [LispVal] -> ThrowsError LispVal
isNumExact ([Number _]) = return $ Bool True
isNumExact ([Float _]) = return $ Bool False
isNumExact ([Complex _]) = return $ Bool False -- TODO: could be either
isNumExact ([Rational _]) = return $ Bool True
isNumExact _ = return $ Bool False
-- | Determine if number is inexact
isNumInexact :: [LispVal] -> ThrowsError LispVal
isNumInexact ([Number _]) = return $ Bool False
isNumInexact ([Float _]) = return $ Bool True
isNumInexact ([Complex _]) = return $ Bool True
isNumInexact ([Rational _]) = return $ Bool False
isNumInexact _ = return $ Bool False
-- |Predicate to determine if given value is a number
isNumber :: [LispVal] -> ThrowsError LispVal
isNumber ([Number _]) = return $ Bool True
isNumber ([Float _]) = return $ Bool True
isNumber ([Complex _]) = return $ Bool True
isNumber ([Rational _]) = return $ Bool True
isNumber _ = return $ Bool False
-- |Predicate to determine if given number is complex.
-- Keep in mind this does not just look at the types
isComplex :: [LispVal] -> ThrowsError LispVal
isComplex ([Complex _]) = return $ Bool True
isComplex ([Number _]) = return $ Bool True
isComplex ([Rational _]) = return $ Bool True
isComplex ([Float _]) = return $ Bool True
isComplex _ = return $ Bool False
-- |Predicate to determine if given number is a real.
-- Keep in mind this does not just look at the types
isReal :: [LispVal] -> ThrowsError LispVal
isReal ([Number _]) = return $ Bool True
isReal ([Rational _]) = return $ Bool True
isReal ([Float _]) = return $ Bool True
isReal ([Complex c]) = do
imagPt <- numImagPart [(Complex c)]
isExact <- isNumExact [imagPt]
isZero <- numBoolBinopEq [imagPt, (Number 0)]
case (isExact, isZero) of
(Bool True, Bool True) -> return $ Bool True
_ -> return $ Bool False
isReal _ = return $ Bool False
-- |Predicate to determine if given number is a rational.
-- Keep in mind this does not just look at the types
isRational :: [LispVal] -> ThrowsError LispVal
isRational ([Number _]) = return $ Bool True
isRational ([Rational _]) = return $ Bool True
isRational ([Float n]) = return $ Bool $ not $ isInfinite n
isRational _ = return $ Bool False
-- |Predicate to determine if given number is an integer.
-- Keep in mind this does not just look at the types;
-- a floating point input value can return true, for example.
isInteger :: [LispVal] -> ThrowsError LispVal
isInteger ([Number _]) = return $ Bool True
isInteger ([Complex n]) = do
return $ Bool $ (isFloatAnInteger $ Float $ realPart n) && (isFloatAnInteger $ Float $ imagPart n)
isInteger ([Rational n]) = do
let numer = abs $ numerator n
let denom = abs $ denominator n
return $ Bool $ (numer >= denom) && ((mod numer denom) == 0)
isInteger ([n@(Float _)]) = return $ Bool $ isFloatAnInteger n
isInteger _ = return $ Bool False
-- |A utility function to determine if given value is a floating point
-- number representing an whole number (integer).
isFloatAnInteger :: LispVal -> Bool
isFloatAnInteger (Float n) =
((floor n) :: Integer) == ((ceiling n) :: Integer)
isFloatAnInteger _ = False
-- - end Numeric operations section ---
-- |Extract an integer from the given value, throwing a type error if
-- the wrong type is passed.
unpackNum :: LispVal -> ThrowsError Integer
unpackNum (Number n) = return n
unpackNum notNum = throwError $ TypeMismatch "number" notNum
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.