Package cc.redberry.core.number

Examples of cc.redberry.core.number.Complex


        return false;
    }

    public static boolean isRealNegativeNumber(Tensor tensor) {
        if (tensor instanceof Complex) {
            Complex complex = (Complex) tensor;
            return complex.isReal() && complex.getReal().signum() < 0;
        }
        return false;
    }
View Full Code Here


//    }

    @Override
    Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
        Product product = (Product) currentNode;
        Complex factor = product.getFactor();
        PContent content = new PContent(product.getIndexless(), product.getDataSubProduct());

        //TODO getForbidden only if necessary!!!!!!!!!!!!!!!!!
        TIntHashSet forbidden = new TIntHashSet(iterator.getForbidden());
        SubsResult subsResult = atomicSubstitute(content, forbidden);
        if (subsResult == null)
            return currentNode;

        List<Tensor> newTos = new ArrayList<>();
        while (true) {
            if (subsResult == null)
                break;
            factor = factor.divide(fromFactor);
            newTos.add(subsResult.newTo);
            content = subsResult.remainder;
            subsResult = atomicSubstitute(content, forbidden);
        }
        Tensor[] result = new Tensor[newTos.size() + content.indexless.length + 2];
View Full Code Here

            int[] newIndicesNames = permutation.permute(freeIndicesNames);
            generatedTensors.add(ApplyIndexMapping.applyIndexMapping(tensor, new Mapping(freeIndicesNames, newIndicesNames), new int[0]));
        }
        Tensor[] summands = generatedTensors.toArray(new Tensor[generatedTensors.size()]);
        if (multiplyFactorial)
            return Tensors.multiply(new Complex(new Rational(1, generatedTensors.size())), Tensors.sum(summands));
        else
            return Tensors.sum(summands);
    }
View Full Code Here

     * @param power    power
     * @return result of argument exponentiation
     * @throws IllegalArgumentException if argument is not scalar
     */
    public static Tensor pow(Tensor argument, int power) {
        return pow(argument, new Complex(power));
    }
View Full Code Here

     * @param power    power
     * @return result of argument exponentiation
     * @throws IllegalArgumentException if argument is not scalar
     */
    public static Tensor pow(Tensor argument, java.math.BigInteger power) {
        return pow(argument, new Complex(power));
    }
View Full Code Here

        if (t instanceof Power) {
            if (!isSymbolic(t.get(0)))
                return false;
            if (!TensorUtils.isInteger(t.get(1)))
                return false;
            Complex e = (Complex) t.get(1);
            if (!e.isReal() || e.isNumeric())
                return false;
            return true;
        }
        for (Tensor tt : t)
            if (!isSymbolic(tt))
View Full Code Here

        Tensor toTensor() {
            BigInteger exponent = this.exponent;
            if (minExponent != null && minExponent.value != null) {
                exponent = exponent.subtract(minExponent.value);
                if (diffSigns && minExponent.value.testBit(0))
                    return Tensors.negate(Tensors.pow(tensor, new Complex(exponent)));
            }
            return Tensors.pow(tensor, new Complex(exponent));
        }
View Full Code Here

                if (withCoefficients) {
                    coefficient = CC.generateNewSymbol();
                    coefficients.add((SimpleTensor) coefficient);
                } else coefficient = Complex.ONE;

                term = Tensors.multiply(coefficient, term, term instanceof Sum ? new Complex(new Rational(1, term.size())) : Complex.ONE);
            } else if (withCoefficients)
                term = FastTensors.multiplySumElementsOnFactors((Sum) term);
            result.put(term);
        }
        this.result = (symmetries == null || symmetries.isEmpty()) ? result.build() : symmetrize(result.build(), symmetries);
View Full Code Here

        return tensor instanceof Complex && ((Complex) tensor).isPositiveNatural();
    }

    public static boolean isRealPositiveNumber(Tensor tensor) {
        if (tensor instanceof Complex) {
            Complex complex = (Complex) tensor;
            return complex.isReal() && complex.getReal().signum() > 0;
        }
        return false;
    }
View Full Code Here

        return false;
    }

    public static boolean isRealNegativeNumber(Tensor tensor) {
        if (tensor instanceof Complex) {
            Complex complex = (Complex) tensor;
            return complex.isReal() && complex.getReal().signum() < 0;
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of cc.redberry.core.number.Complex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.