Fréquences de résonances à partir du graphe

Bonsoir à tous;
Je suis débutant en labview, en fait je travaille avec labview 6i sous windows 95. Mon problème est le suivant: je fais l'acquisition d'un signal acoustique avec une carte d'acquisition de NI et je calcule  la FFT  de ce signal  ensuite je la représente dans un graphe, alors à partir de cette représentation graphique j'aimerai bien remonter automatiquement à certaines fréquences et les afficher dans un tableau à une dimension qu'on appelle les fréquences de résonances. ces fréquences correspondent aux creux présents dans le graphe. en fait j'aimerai bien savoir si elle existe une formule dans le domaine fréquentielle pour convertir les lieux détectés en fréquences exactes comme la formule utilisée dans le domaine temporel:
t=t0+dt*[lieux];
dans ce programme j'ai utilisé la fonction detect piks and valleys, en fait cette fonction detecte l'amplitude et le lieux correspondant à chaque fréquence mais mon problème comment convertir le lieux detecté en fréquence exacte?
voilà une impression d'ecran qui représente le signal acquis ainsi la représentation graphique de la FFT:
Pièces jointes :
impression.jpg ‏1407 KB

Bonjour, ton graphique fréquentiel a sur l’axe des Y l’amplitude et en axe X la fréquence. L’axe des Y est un tableau 1D, et pour chaque valeur de ce tableau correspond une fréquence dans un tableau 1D de l’axe de X (de pas delta f, soit fi = fo + delta f * index). La fonction de recherche de pic te retourne les amplitudes des pics (valeur du tableau Y) et les index de ces mêmes valeurs dans le tableau. Si tu indexes le tableau des X tu trouveras la fréquence associées.
Luc Desruelle | Voir mon profil | LabVIEW Code & blog
Co-auteur livre LabVIEW : Programmation et applications
CLA : Certified LabVIEW Architect / Certifié Architecte LabVIEW
CLD : Certified LabVIEW Developer / Certifié Développeur LabVIEW

Similar Messages

  • Une partie de programme ne s'exécute pas

    Bonjour à tous;
    J'ai réalisé un programme pour mésurer la vitesse de phase à partir des fréquences de résonance. Mon problème est le suivant: lorsque j'exécute celui-ci je remarque qu'une partie du programme n'est pas exécutée et pourtant il ne y a pas d'erreurs et meme il ne se bloque pas. En fait, j'arrive pas à croire ce défaut , il m'apparait bizarre. Je travaille sous labview 6i dans l'environnement Windows 95 car la carte d'acquisition de données de NI exige Windows 95. S'il vous plait si vous avez une idée, n'hésitez pas à la transmettre.
    Cordialement;

    Désolé, mais au lieu d'une réponse, voici de nouvelles questions :
    Quel est le défaut exact ?
    La boucle FOR ne s'exécute jamais ?
    La boucle FOR ne s'exécute pas le nombre de fois attendu ?
    La condition "compris entre 1E+7 et 2E+7" n'est jamais vraie ?
    Autre chose ?
    Et puis :
    Quel est le contenu de la séquence 0 de la séquence multiple ? Pourriez-vous également joindre une capture d'écran ?
    Quelle est la taille du tableau (nombre d'éléments) qui entre dans la boucle FOR ?
    Quelle est la valeur du I32 qui sort du VI de recherche des pics ?
    Je suppose que le contenu de la condition Faux est un simple fil puisque dans ce cas l'élément en cours ne doit pas être ajouté au tableau. Prière de confirmer.
    Dans l'attente de vos réponses qui clarifieront les choses et nous permettront de vous aider de manière ciblée, je vous invite à lire le paragraphe Auto-Indexing Loops de ce document. Vous y apprendrez qu'en utilisant l'auto-indexage (comme dans votre code) il ne faut pas relier l'entrée N de la boucle FOR car le nombre d'itérations à réaliser est alors défini par le nombre d'éléments du tableau auto-indexé. Faites des essais pour voir ce qui se passe en utilisant l'auto-indexage et en reliant N et en définissant celui-ci à un nombre inférieur, égal et supérieur au nombre d'éléments du tableau. Si le nombre d'éléments de votre tableau devait différer du nombre de pics trouvés (d'où la nécessité de voir le code de la séquence 0 et mes autres questions), la boucle FOR pourrait ne pas s'exécuter le nombre de fois attendu.

  • Problème affichage sur graphe XY[Labview 8.5]

    Bonjour à tous,
    Je réalise l'acquisition de signaux à partir d'une application de test qui me fournit les coordonnées (X,Y)
    des signaux (voir fichier texte joint). Les coordonnée en X sont données en temps absolu, c'est à dire le nombre
    de seconde écroulé depuis le 1er Janvier 1904. Malheureusement lors de l'affichage sur un graphe (X,Y), je constate
    qu'une partie du graphe n'est pas utilisé! ( Partie représenté en jaune sur l'image jointe) Je ne comprend pas pourquoi!
    Pourriez vous m'éclairer???
    Cordialement.
    S.
    Résolu !
    Accéder à la solution.
    Pièces jointes :
    graphe.JPG ‏63 KB

    Bonjour,
    Malheureusement, je ne peux pas vous founir le code associé au fichier pour des raisons de confidentialités
    d'une part. Et d'autre part, il ne vous sera pas possible de l'exploité sans l'environnement associé (composé de nombreux VIs).
    Cordialement.
    S.
    Pièces jointes :
    VIgraphe.JPG ‏31 KB

  • Windows Azure Active Directory MA - Maximum number of items that can be serialized or deserialized in an object graph is '500000'. Change the object graph or increase the MaxItemsInObjectGraph quota.

    Trying to use WAAD with FIM 2010 R2 SP1 (4.1.3496.0) and during export several objects cause a warning/info with:
    Maximum number of items that can be serialized or deserialized in an object graph is '500000'. Change the object graph or increase the MaxItemsInObjectGraph quota.
    I looked, this appears hard coded into the MA, anyone know what causes this? My best guess is something like a large group membership? Does anyone know what the limits around the WAAD MA are?
    Here is the indepth error logged during the failure:
    ProvisioningServiceAdapter::ExecuteWithRetry: Action: Export, Attempt: 0, Exception: Microsoft.Online.Coexistence.ProvisionRetryException: Unable to communicate with the Windows Azure Active Directory service. Tracking ID: e94e6020-8434-4aa7-9a29-b2edf7fe6b2e
    See the event log for more details. ---> System.ServiceModel.CommunicationException: There was an error while trying to serialize parameter http://schemas.microsoft.com/online/aws/change/2010/01:syncObjects. The InnerException message was 'Maximum number
    of items that can be serialized or deserialized in an object graph is '500000'. Change the object graph or increase the MaxItemsInObjectGraph quota. '.  Please see InnerException for more details. ---> System.Runtime.Serialization.SerializationException:
    Maximum number of items that can be serialized or deserialized in an object graph is '500000'. Change the object graph or increase the MaxItemsInObjectGraph quota.
       at System.Runtime.Serialization.XmlObjectSerializerContext.IncrementItemCount(Int32 count)
       at WriteArrayOfstringToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
       at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type
    declaredType)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
       at WriteSyncObjectGroupToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
       at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type
    declaredType)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
       at WriteArrayOfSyncObjectToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
       at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
       at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
       at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
       at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter writer, PartInfo part, Object graph)
       --- End of inner exception stack trace ---
    Server stack trace:
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter writer, PartInfo part, Object graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter writer, PartInfo part, Object graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter writer, PartInfo[] parts, Object[] parameters)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean
    isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
       at System.ServiceModel.Channels.BinaryMessageEncoderFactory.BinaryMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
       at System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
       at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Microsoft.Online.Coexistence.Schema.IProvisioningWebService.Provision(SyncObject[] syncObjects)
       at Microsoft.Online.Coexistence.ProvisionHelper.InvokeAwsAPI[T](Func`1 awsOperation, String opsLabel)
       --- End of inner exception stack trace ---
       at Microsoft.Online.Coexistence.ProvisionHelper.CommunicationExceptionHandler(CommunicationException ex)
       at Microsoft.Online.Coexistence.ProvisionHelper.InvokeAwsAPI[T](Func`1 awsOperation, String opsLabel)
       at Microsoft.Azure.ActiveDirectory.Connector.ProvisioningServiceAdapter.<>c__DisplayClass1.<Export>b__0()
       at Microsoft.Azure.ActiveDirectory.Connector.ProvisioningServiceAdapter.ExecuteWithRetry(String actionName, Action action).

    Hi gdedshg,
    >>Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota
    When meet the above exception, please try to do the following configuration:
    On the server side:
    Add the following to the server's config file:
    <behaviors>
    <serviceBehaviors>
    <behavior name="MyServiceBehavior">
    <dataContractSerializer
    maxItemsInObjectGraph="2147483647" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    And reference it in the service using the following code:
    <services>
    <service
    behaviorConfiguration="MyServiceBehavior"
    name="serviceName">……
    On the client side:
    Add the following: 
    <behaviors>
    <endpointBehaviors>
    <behavior name="MyClientbehavior">
    <dataContractSerializer
    maxItemsInObjectGraph="2147483647"/>
    </behavior>
    </endpointBehaviors>
    </behaviors>
     And reference it in the endpoint using the following code:
    <endpoint address="serviceAddress"
    behaviorConfiguration="MyClientbehavior"
    For more information, please try to refer to the following article:
    http://blog.aggregatedintelligence.com/2011/01/wcf-maxitemsinobjectgraph-error.html .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Personalized Views - Charts and Graphs?

    Hi All,
    Can PerformancePoint web parts and graphs be combined with SharePoint's "personalized views" in order to create personalized dashboards for each user?
    Any advice or recommendations are greatly appreciated,
    Regards,
    CP

    Depends on what level you want this to be achieved.  The requirements for a normal user might will be different from Power Users or BI professionals.  This'll be the difference between chart parts and allowing people to use Dashboard Designer.
    What level of user are you needing to cater for?
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How to do graphs??

    The instructions for graphs always have you mark cells and then drag them onto the graph. But my graphs are on a different sheet (and need to be because it has lots of data).
    I imported my excel sheets, and one of my graphs now has a screwed up x axis. I see no way to manually edit the series that go into the graph. How do I do anything without dragging data across sheets?
    I agree with people who say that this is the spreadsheet for people with small amounts of data.
    The graph video tutorial link is dead also.

    We all need to make suggestions on this part, the graphs. Use the feedback option of the Numbers Menu to do this. They really do listen to us if enough say something.
    Jason

  • JPanel help

    hey,
    I'm making a calculator program with a function graphing part using JFrame and JPanel. But these two have been causing problems because when I run the GraphMain class, only a portion of the graph shows up. I have tested the Main and Graph classes and they work but the problem is the GraphMain class. Could somebody please help. here are the three classes:
    import java.util.Scanner;
    import java.util.ArrayList;
    //"Parentheses, Exponents, Multiplication and Division, and Addition and Subtraction"
    //NEED TO HANDLE NEGATIVE NUMBERS AND DIFFERENCE BETWEEN MINUS
    //RECURSIVE SOLVE DOESN'T WORK FOR INPUT WITH TWO SET PARENTHESIS EX. (1+56)(3/8)
    public class Main
         public static ArrayList<Character> symbols;
         public static double lastAnswer;
         public static boolean radians;
         public static void main(String[] args)
              //initialize recognized symbols
              symbols = new ArrayList<Character>();
              symbols.add('+');
              symbols.add('~');
              symbols.add('*');
              symbols.add('/');
              symbols.add('%');
              symbols.add('^');
              symbols.add('s');
              symbols.add('c');
              symbols.add('t');
              symbols.add('l');
              radians = true;
              Scanner in = new Scanner(System.in);
              System.out.println("CALCULATOR (h for help)");
              System.out.println("NOTE: ~ represents minus, - represents negative");
              String input = "";
              input = clearWhitespace(in.nextLine());
              while (!input.equalsIgnoreCase("q"))
                   if (input.equalsIgnoreCase("graph"))
                        System.out.println("Opening function graphing window...");
                   if (input.equalsIgnoreCase("h"))
                        System.out.println("\nVARIABLES");
                        System.out.println("ans = last answer");
                        System.out.println("@ = pi = 3.14...");
                        System.out.println("# = e = 2.718...");
                        System.out.println("\nKEYS");
                        System.out.println("h = help");
                        System.out.println("q = quit");
                        System.out.println("* = multiply");
                        System.out.println("~ = subtract");
                        System.out.println("+ = add");
                        System.out.println("/ = divide");
                        System.out.println("% = modulus");
                        System.out.println("sin = sine");
                        System.out.println("cos = cosine");
                        System.out.println("tan = tangent");
                        System.out.println("csc = cosecant");
                        System.out.println("sec = cosecant");
                        System.out.println("cot = cotangent");
                        System.out.println("asin = sine inverse");
                        System.out.println("acos = cosine inverse");
                        System.out.println("atan = tangent inverse");
                        System.out.println("acsc = cosecant inverse");
                        System.out.println("asec = cosecant inverse");
                        System.out.println("acot = cotangent inverse");
                        System.out.println("log = logarithm");
                        System.out.println("ln = natural logarithm");
                        System.out.println("() = solve first");
                        System.out.println("ENTER = solve");
                        System.out.println("\nFUNCTIONS");
                        System.out.println("checkDiagnostics");
                        System.out.println("enableRadians");
                        System.out.println("enableDegrees\n");
                   else if (diagnostics(input) != null)
                        System.out.println(diagnostics(input));
                   else if (!input.equals(""))
                        try
                             System.out.println("= " + solve(replaceVariables(input)));
                        catch (IllegalArgumentException ex)
                             System.out.println(ex.getMessage());
                   input = clearWhitespace(in.nextLine());
              /*String blah = "(415(645(2762+4)2524)4256465)";
              String la = blah.substring(findParenthesis(blah)[0], findParenthesis(blah)[1]);
              System.out.println(la);*/
              /*String gah = "2+7*356*7+6+23*34";
              gah = multiplyDivide(gah);
              gah = addSubtract(gah);
              System.out.println(gah);*/
              /*int i = 1;
              System.out.println(findNums(gah, i)[0]);
              System.out.println(findNums(gah, i)[1]);
              System.out.println(gah.substring(findNums(gah, i)[0], i));
              System.out.println(gah.substring(i + 1, findNums(gah, i)[1]));*/
              /*String foo = "2^2";
              foo = exponents(foo);
              System.out.println(foo);*/
              /*String boo = "2sin~";
              boo = replaceVariables(boo);
              boo = trigonometry(boo);
              System.out.println(boo);*/
              /*String lala = "2546(23(4)2)24562";
              System.out.println(lala.substring(findParenthesis(lala)[0] + 1, findParenthesis(lala)[1]));
              System.out.println(lala.substring(0, findParenthesis(lala)[0]));*/
              /*int q = 1000000;
              double[] ys = new double[q];
              for (int i = 1; i < q; i++)
                   ys[i] = Double.parseDouble(solve("sin(" + i + ")^(cos" + i + ")"));
              System.out.println("DONE");*/
              //about 41 seconds
              //System.out.println(solveFunctionOfX("x^2", 3));
         public static String solve(String theInput) throws IllegalArgumentException
              String input = theInput;
              int first = 0, last = 0;
              try
                   first = findParenthesis(input)[0];
                   last = findParenthesis(input)[1];
              catch (IllegalArgumentException ex)
                   throw ex;
              String replace = "";
              String temp = "";
              while (first != -1 && last != -1)
                   replace = solve(input.substring(first + 1, last));
                   temp = "";
                   if (first != 0)
                        temp += input.substring(0, first);
                   if (first - 1 >= 0 && Character.isDigit(input.charAt(first - 1)))
                        temp += "*";
                   temp += replace;
                   if (last + 1 < input.length() && (Character.isDigit(input.charAt(last + 1)) || input.charAt(last + 1) == '-'))
                        temp += "*";
                   if (last != input.length() - 1)
                        temp += input.substring(last + 1, input.length());
                   input = temp;
                   first = findParenthesis(input)[0];
                   last = findParenthesis(input)[1];
              try
                   input = fourLetterFunctions(input);
                   input = threeLetterFunctions(input);
                   input = twoLetterFunctions(input);
                   input = exponents(input);
                   input = multiplyDivide(input);
                   input = addSubtract(input);
                   lastAnswer = Double.parseDouble(input);
              catch (IllegalArgumentException ex)
                   throw ex;
              return input;
         public static double solveFunctionOfX(String input, double x)
              String solveFunction = "", solution = "";
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == 'x')
                        solveFunction += x;
                   else
                        solveFunction += input.charAt(i);
              try
                   solution = solve(solveFunction);
              catch (IllegalArgumentException ex)
                   return 0;
              return Double.parseDouble(solution);
         public static String clearWhitespace(String input)
              String result = "";
              for (int i = 0; i < input.length(); i++)
                   if (!Character.isWhitespace(input.charAt(i)))
                        result += input.substring(i, i+1);
              return result;
         public static int[] findParenthesis(String input)
              int count = 0;
              int first = -1, last = -1;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '(')
                        if (count == 0)
                             first = i;
                        count++;
                   else if (input.charAt(i) == ')')
                        count--;
                        if (count == 0)
                             last = i;
              if (count > 0)
                   throw new IllegalArgumentException("Missing Right Parenthesis");
              else if (count < 0)
                   throw new IllegalArgumentException("Missing Left Parenthesis");
              return new int[]{first, last};
         public static String addSubtract(String theInput)
              int j, k;
              double a, b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '+' || input.charAt(i) == '~')
                        j = findNums(input, i)[0];
                        k = findNums(input, i)[1];
                        b = Double.parseDouble(input.substring(i + 1, k));
                        if (i == 0)
                             if (input.charAt(i) == '+')
                                  solution = lastAnswer + b;
                             else if (input.charAt(i) == '~')
                                  solution = lastAnswer - b;
                        else
                             a = Double.parseDouble(input.substring(j, i));
                             if (input.charAt(i) == '+')
                                  solution = a + b;
                             else if (input.charAt(i) == '~')
                                  solution = a - b;
                        if (i != 0)
                             temp = input.substring(0, j);
                        temp += solution + input.substring(k, input.length());
                        input = temp;
                        i = 0;
              return input;
         public static String multiplyDivide(String theInput)
              int j, k;
              double a = 0, b = 0, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '*' || input.charAt(i) == '/' || input.charAt(i) == '%')
                        j = findNums(input, i)[0];
                        k = findNums(input, i)[1];
                        b = Double.parseDouble(input.substring(i + 1, k));
                        if (i == 0)
                             if (input.charAt(i) == '*')
                                  solution = lastAnswer * b;
                             else if (input.charAt(i) == '/')
                                  if (b == 0)
                                       throw new IllegalArgumentException("Divide by Zero Error");
                                  solution = lastAnswer / b;
                             else if (input.charAt(i) == '%')
                                  solution = lastAnswer % b;
                        else
                             a = Double.parseDouble(input.substring(j, i));
                             if (input.charAt(i) == '*')
                                  solution = a * b;
                             else if (input.charAt(i) == '/')
                                  if (b == 0)
                                       throw new IllegalArgumentException("Divide by Zero Error");
                                  solution = a / b;
                             else if (input.charAt(i) == '%')
                                  solution = a % b;
                        if (i != 0)
                             temp = input.substring(0, j);
                        temp += solution + input.substring(k, input.length());
                        input = temp;
                        i = 0;
              return input;
         public static String exponents(String theInput)
              int j, k;
              double a, b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '^')
                        j = findNums(input, i)[0];
                        k = findNums(input, i)[1];
                        b = Double.parseDouble(input.substring(i + 1, k));
                        if (i == 0)
                             if (input.charAt(i) == '^')
                                  solution = Math.pow(lastAnswer, b);
                        else
                             a = Double.parseDouble(input.substring(j, i));
                             if (input.charAt(i) == '^')
                                  solution = Math.pow(a, b);
                        if (i != 0)
                             temp = input.substring(0, j);
                        temp += solution + input.substring(k, input.length());
                        input = temp;
                        i = 0;
              return input;
         public static String fourLetterFunctions(String theInput)
              int  k;
              double b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length() - 4; i++)
                   if (input.substring(i, i + 4).equals("asin") || input.substring(i, i + 4).equals("acos") || input.substring(i, i + 4).equals("atan") || input.substring(i, i + 4).equals("acsc") || input.substring(i, i + 4).equals("asec") || input.substring(i, i + 4).equals("acot"))
                        k = findNums(input, i + 3)[1];
                        b = Double.parseDouble(input.substring(i + 4, k));
                        //System.out.println(b);
                        if (input.substring(i, i + 4).equals("asin"))
                             if (Math.abs(b) > 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.asin(b) : Math.asin(b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("acos"))
                             if (Math.abs(b) > 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.acos(b) : Math.acos(b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("atan"))
                             solution = (radians? Math.atan(b) : Math.atan(b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("acsc"))
                             if (Math.abs(b) < 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.asin(1 / b) : Math.asin(1 / b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("asec"))
                             if (Math.abs(b) < 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.acos(1 / b) : Math.acos(1 / b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("acot"))
                             solution = 1 / (radians? Math.atan(1 / b) : Math.atan(1 / b) * 180 / Math.PI);
                        //System.out.println(solution);
                        if (i != 0)
                             temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += solution;
                        temp += input.substring(k, input.length());
                        input = temp;
                        //System.out.println(temp);
                        i = 0;
              return input;
         public static String threeLetterFunctions(String theInput)
              int  k;
              double b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length() - 3; i++)
                   if (input.substring(i, i + 3).equals("sin") || input.substring(i, i + 3).equals("cos") || input.substring(i, i + 3).equals("tan") || input.substring(i, i + 3).equals("log") || input.substring(i, i + 3).equals("csc") || input.substring(i, i + 3).equals("sec") || input.substring(i, i + 3).equals("cot"))
                        k = findNums(input, i + 2)[1];
                        b = Double.parseDouble(input.substring(i + 3, k));
                        //System.out.println(b);
                        if (input.substring(i, i + 3).equals("sin"))
                             solution = Math.sin((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("cos"))
                             solution = Math.cos((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("tan"))
                             if ((b + Math.PI / 2) % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = Math.tan((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("log"))
                             if (b <= 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = Math.log10(b);
                        if (input.substring(i, i + 3).equals("csc"))
                             if (b % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = 1 / Math.sin((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("sec"))
                             if ((b + Math.PI / 2) % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = 1 / Math.cos((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("cot"))
                             if (b % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = 1 / Math.tan((radians? b : b * 180 / Math.PI));
                        //System.out.println(solution);
                        if (i != 0)
                             temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += solution;
                        temp += input.substring(k, input.length());
                        input = temp;
                        //System.out.println(temp);
                        i = 0;
              return input;
         public static String twoLetterFunctions(String theInput)
              int  k;
              double b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length() - 2; i++)
                   if (input.substring(i, i + 2).equals("ln"))
                        k = findNums(input, i + 1)[1];
                        b = Double.parseDouble(input.substring(i + 2, k));
                        //System.out.println(b);
                        if (input.substring(i, i + 2).equals("ln"))
                             if (b <= 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = Math.log(b);
                        //System.out.println(solution);
                        if (i != 0)
                             temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += solution;
                        temp += input.substring(k, input.length());
                        input = temp;
                        //System.out.println(temp);
                        i = 0;
              return input;
         public static String replaceVariables(String theInput)
              String input = theInput;
              String temp = "";
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '#')
                        temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += Math.E;
                        if (i != input.length() - 1 && (Character.isDigit(input.charAt(i + 1)) || input.charAt(i + 1) == '-'))
                             temp += "*";
                        temp += input.substring(i+1, input.length());
                        input = temp;
                   else if (input.charAt(i) == '@')
                        temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += Math.PI;
                        if (i != input.length() - 1 && (Character.isDigit(input.charAt(i + 1)) || input.charAt(i + 1) == '-'))
                             temp += "*";
                        temp += input.substring(i+1, input.length());
                        input = temp;
                   else if (i < input.length() - 2 && input.substring(i, i + 3).equals("ans"))
                        temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += lastAnswer;
                        if (i != input.length() - 3 && (Character.isDigit(input.charAt(i + 3)) || input.charAt(i + 3) == '-'))
                             temp += "*";
                        temp += input.substring(i+3, input.length());
                        input = temp;
              return input;
         public static int[] findNums(String input, int charPos)
              int k = charPos - 1, j = charPos + 1;
              while (k > 0 && (Character.isDigit(input.charAt(k - 1)) || input.charAt(k - 1) == 'E' || input.charAt(k - 1) == '.' || input.charAt(k - 1) == '-'))
                   k--;
              while(j < input.length() && (Character.isDigit(input.charAt(j)) || input.charAt(j) == 'E' || input.charAt(j) == '.' || input.charAt(j) == '-'))
                   j++;
              return new int[]{k,j};
         public static String diagnostics(String input)
              if (input.equals("checkDiagnostics"))
                   return "" + (radians? "radians":"degrees");
              else if (input.equalsIgnoreCase("radians?"))
                   return "" + radians;
              else if (input.equalsIgnoreCase("enabledegrees"))
                   radians = false;
                   return "done";
              else if (input.equalsIgnoreCase("enableradians"))
                   radians = true;
                   return "done";
              else
                   return null;
    import java.awt.Color;
    import java.awt.Graphics;
    public class Graph
         public Graph(int axMin, int axMax, int ayMin, int ayMax, int aappletSize)
              /*xSize = x;
              ySize = y;*/
              xMin = axMin;
              xMax = axMax;
              yMin = ayMin;
              yMax = ayMax;
              appletSize = aappletSize;
              xScaling = (double) appletSize/(Math.abs(xMin) + Math.abs(xMax));
              yScaling = (double) appletSize/(Math.abs(yMin) + Math.abs(yMax));
              //System.out.println(xScaling);
              //System.out.println(yScaling);
              rectCenterX = (xMin + xMax )/ 2;
              rectCenterY = (yMin + yMax) / 2;
              //System.out.println(rectCenterX);
              //System.out.println(rectCenterY);
              appletCenterX = (int)((appletSize / 2) - (rectCenterX * xScaling));
              appletCenterY = (int)((appletSize / 2) - (rectCenterY * yScaling));
              //System.out.println(appletCenterX);
              //System.out.println(appletCenterY);
              functions = new String[10];
              functionsBoolean = new boolean[10];
              functionSolutions = new double[10][appletSize];
              functionAppletSolutions = new int[10][appletSize];
              axis = true;
         public void drawGraph(Graphics g)
              drawAxis(g);
              drawFunctions(g);
         public void setFunction(int num, String function)
              functions[num] = function;
              solveFunctions(num);
         public void enableDisableFunction(int function, boolean state)
              functionsBoolean[function] = state;
         private void drawFunctions(Graphics g)
              for (int i = 0; i < 10; i++)
                   if (functionsBoolean)
                        g.setColor(colors[i]);
                        for (int j = 0; j < appletSize - 1; j++)
                             if ((functionAppletSolutions[i][j + 1] > 0 && functionAppletSolutions[i][j + 1] < appletSize) || (functionAppletSolutions[i][j] > 0 && functionAppletSolutions[i][j] < appletSize))
                                  g.drawLine(j, functionAppletSolutions[i][j], j + 1, functionAppletSolutions[i][j + 1]);
         private void solveFunctions(int i)
              for (int j = 0; j < appletSize; j++)
                   //System.out.println(convertToRectangular(j,0)[0]);
                   //System.out.println(functions.get(i));
                   //System.out.println(Main.solveFunctionOfX(functions.get(i), convertToRectangular(j,0)[0]));
                   functionSolutions[i][j] = Main.solveFunctionOfX(functions[i], convertToRectangular(j,0)[0]);
                   functionAppletSolutions[i][j] = convertToApplet(0, functionSolutions[i][j])[1];
         private double[] convertToRectangular(int appletX, int appletY)
              double newX = 0, newY = 0;
              newX = (double) ((appletX - appletCenterX) / xScaling);
              newY = (double) ((appletY - appletCenterY) / yScaling);
              return new double[]{newX, newY};
         private int[] convertToApplet(double x, double y)
              int newX = 0, newY = 0;
              newX = (int) (x * xScaling) + appletCenterX;
              newY = (int) (-y * yScaling) + appletCenterY;
              return new int[]{newX, newY};
         private void drawAxis(Graphics g)
              if (axis)
                   g.setColor(Color.black);
                   //x-axis
                   g.drawLine(0, appletCenterY, appletSize, appletCenterY);
                   //y-axis
                   g.drawLine(appletCenterX, 0, appletCenterX, appletSize);
         public void printSolutions(int functionNumber)
              for (int i = 0; i < appletSize; i++)
                   System.out.println(convertToRectangular(i,0)[0] + " | " + functionSolutions[functionNumber][i]);
         public void printAppletSolutions(int functionNumber)
              for (int i = 0; i < appletSize; i++)
                   System.out.println(i + " | " + functionAppletSolutions[functionNumber][i]);
         public void printFunctionsBoolean()
              for (int i = 0; i < functionsBoolean.length; i++)
                   System.out.println(i + " | " + functionsBoolean[i]);
         private boolean axis;
         private String[] functions;
         private double[][] functionSolutions;
         private int[][] functionAppletSolutions;
         private boolean[] functionsBoolean;
         private int xMin;
         private int xMax;
         private int yMin;
         private int yMax;
         private int appletSize;
         private double rectCenterX;
         private double rectCenterY;
         private int appletCenterX;
         private int appletCenterY;
         private double xScaling;
         private double yScaling;
         private static Color[] colors = new Color[]{Color.blue, Color.cyan, Color.green, Color.magenta, Color.orange, Color.pink, Color.red, Color.yellow, Color.gray, Color.darkGray};
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JCheckBoxMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JOptionPane;
    public class GraphMain implements ActionListener, ItemListener
         public JMenuBar createJMenuBar()
              JMenuBar menuBar = new JMenuBar();
              JMenu fileMenu = new JMenu("File");
              menuBar.add(fileMenu);
              JMenuItem exit = new JMenuItem("Exit");
              exit.addActionListener(this);
              fileMenu.add(exit);
              JMenu functionMenu = new JMenu("Function");
              menuBar.add(functionMenu);
              JMenu function1 = new JMenu("function 1");
              JMenuItem edit1 = new JMenuItem("edit 1");
              JCheckBoxMenuItem enable1 = new JCheckBoxMenuItem("enable 1");
              edit1.addActionListener(this);
              enable1.addItemListener(this);
              function1.add(edit1);
              function1.add(enable1);
              functionMenu.add(function1);
              JMenu function2 = new JMenu("function 2");
              JMenuItem edit2 = new JMenuItem("edit 2");
              JCheckBoxMenuItem enable2 = new JCheckBoxMenuItem("enable 2");
              edit2.addActionListener(this);
              enable2.addItemListener(this);
              function2.add(edit2);
              function2.add(enable2);
              functionMenu.add(function2);
              JMenu function3 = new JMenu("function 3");
              JMenuItem edit3 = new JMenuItem("edit 3");
              JCheckBoxMenuItem enable3 = new JCheckBoxMenuItem("enable 3");
              edit3.addActionListener(this);
              enable3.addItemListener(this);
              function3.add(edit3);
              function3.add(enable3);
              functionMenu.add(function3);
              JMenu function4 = new JMenu("function 4");
              JMenuItem edit4 = new JMenuItem("edit 4");
              JCheckBoxMenuItem enable4 = new JCheckBoxMenuItem("enable 4");
              edit4.addActionListener(this);
              enable4.addItemListener(this);
              function4.add(edit4);
              function4.add(enable4);
              functionMenu.add(function4);
              JMenu function5 = new JMenu("function 5");
              JMenuItem edit5 = new JMenuItem("edit 5");
              JCheckBoxMenuItem enable5 = new JCheckBoxMenuItem("enable 5");
              edit5.addActionListener(this);
              enable5.addItemListener(this);
              function5.add(edit5);
              function5.add(enable5);
              functionMenu.add(function5);
              JMenu function6 = new JMenu("function 6");
              JMenuItem edit6 = new JMenuItem("edit 6");
              JCheckBoxMenuItem enable6 = new JCheckBoxMenuItem("enable 6");
              edit6.addActionListener(this);
              enable6.addItemListener(this);
              function6.add(edit6);
              function6.add(enable6);
              functionMenu.add(function6);
              JMenu function7 = new JMenu("function 7");
              JMenuItem edit7 = new JMenuItem("edit 7");
              JCheckBoxMenuItem enable7 = new JCheckBoxMenuItem("enable 7");
              edit7.addActionListener(this);
              enable7.addItemListener(this);
              function7.add(edit7);
              function7.add(enable7);
              functionMenu.add(function7);
              JMenu function8 = new JMenu("function 8");
              JMenuItem edit8 = new JMenuItem("edit 8");
              JCheckBoxMenuItem enable8 = new JCheckBoxMenuItem("enable 8");
              edit8.addActionListener(this);
              enable8.addItemListener(this);
              function8.add(edit8);
              function8.add(enable8);
              functionMenu.add(function8);
              JMenu function9 = new JMenu("function 9");
              JMenuItem edit9 = new JMenuItem("edit 9");
              JCheckBoxMenuItem enable9 = new JCheckBoxMenuItem("enable 9");
              edit9.addActionListener(this);
              enable9.addItemListener(this);
              function9.add(edit9);
              function9.add(enable9);
              functionMenu.add(function9);
              JMenu function10 = new JMenu("function 10");
              JMenuItem edit10 = new JMenuItem("edit 10");
              JCheckBoxMenuItem enable10 = new JCheckBoxMenuItem("enable 10");
              edit10.addActionListener(this);
              enable10.addItemListener(this);
              function10.add(edit10);
              function10.add(enable10);
              functionMenu.add(function10);
              return menuBar;
         public Container createContentPane()
              JPanel contentPane = new JPanel()
                   public void run()
                        while (true)
                             repaint();
                   public void paintComponent(Graphics g)
                        //System.out.println(getWidth());
                        //System.out.println(getHeight());
                        graph.drawGraph(g);
                        //graph.printAppletSolutions(0);
              contentPane.setOpaque(true);
              return contentPane;
         public void actionPerformed(ActionEvent e)
              JMenuItem source = (JMenuItem) (e.getSource());
              String what = source.getText();
              if (what.equals("Exit"))
                   quit();
              else if (what.equals("edit 1"))
                   graph.setFunction(0, JOptionPane.showInputDialog(null, "Enter function 1."));
              else if (what.equals("edit 2"))
                   graph.setFunction(1, JOptionPane.showInputDialog(null, "Enter function 2."));
              else if (what.equals("edit 3"))
                   graph.setFunction(2, JOptionPane.showInputDialog(null, "Enter function 3."));
              else if (what.equals("edit 4"))
                   graph.setFunction(3, JOptionPane.showInputDialog(null, "Enter function 4."));
              else if (what.equals("edit 5"))
                   graph.setFunction(4, JOptionPane.showInputDialog(null, "Enter function 5."));
              else if (what.equals("edit 6"))
                   graph.setFunction(5, JOptionPane.showInputDialog(null, "Enter function 6."));
              else if (what.equals("edit 7"))
                   graph.setFunction(6, JOptionPane.showInputDialog(null, "Enter function 7."));
              else if (what.equals("edit 8"))
                   graph.setFunction(7, JOptionPane.showInputDialog(null, "Enter function 8."));
              else if (what.equals("edit 9"))
                   graph.setFunction(8, JOptionPane.showInputDialog(null, "Enter function 9."));
              else if (what.equals("edit 10"))
                   graph.setFunction(9, JOptionPane.showInputDialog(null, "Enter function 10."));
         public void itemStateChanged(ItemEvent e)
              JCheckBoxMenuItem source = (JCheckBoxMenuItem)(e.getSource());
    String what = source.getText();
    if (what.equals("enable 1"))
                   graph.enableDisableFunction(0, source.getState());
              else if (what.equals("enable 2"))
                   graph.enableDisableFunction(1, source.getState());
              else if (what.equals("enable 3"))
                   graph.enableDisableFunction(2, source.getState());
              else if (what.equals("enable 4"))
                   graph.enableDisableFunction(3, source.getState());
              else if (what.equals("enable 5"))
                   graph.enableDisableFunction(4, source.getState());
              else if (what.equals("enable 6"))
                   graph.enableDisableFunction(5, source.getState());
              else if (what.equals("enable 7"))
                   graph.enableDisableFunction(6, source.getState());
              else if (what.equals("enable 8"))
                   graph.enableDisableFunction(7, source.getState());
              else if (what.equals("enable 9"))
                   graph.enableDisableFunction(8, source.getState());
              else if (what.equals("enable 10"))
                   graph.enableDisableFunction(9, source.getState());
         protected void quit()
              System.exit(0);
         private static void createAndShowGUI()
              JFrame frame = new JFrame("Graph");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              GraphMain main = new GraphMain();
              frame.setJMenuBar(main.createJMenuBar());
              frame.setContentPane(main.createContentPane());
              frame.setSize(408, 457);
              /*GraphComponent component = new GraphComponent();
              frame.add(component);*/
              frame.setVisible(true);
         public static void main(String[] args)
              /*for (int i = 1; i <= 10; i++)
                   System.out.println("JMenu function" + i + " = new JMenu(function " + i + ");\n" +
                             "JMenuItem edit" + i + " = new JMenuItem(edit " + i + ");\n" +
                                       "JCheckBoxMenuItem enable" + i + " = new JCheckBoxMenuItem(enable " + i + ");\n" +
                                                 "edit" + i + ".addActionListener(this);\n" +
                                                 "enable" + i + ".addItemListener(this);\n" +
                                                 "function" + i + ".add(edit" + i + ");\n" +
                                                 "function" + i + ".add(enable" + i + ");\n" +
                                                 "functionMenu.add(function" + i + ");\n");
              graph = new Graph(-10, 10, -10, 10, 400);
              graph.setFunction(0, "x");
              graph.setFunction(1, "x^2");
              graph.setFunction(2, "x^3");
              graph.setFunction(3, "x^4");
              graph.setFunction(4, "x^5");
              graph.setFunction(5, "x^6");
              graph.setFunction(6, "x^7");
              graph.s

    If only the x-positive part of graph is showing up, check the behaviour of Math.pow
    when the first argument is negative. (I know you are trying to raise numbers to a
    positive integral power, but I have no idea what happens further up when you
    parse the expression.)

  • Help with possibly noobish question

    Hello,
    I need to make some complex graph structures such that this format will not do
    1: 2 ->4
    2: 4 ->2
    I have several additions to each node to take care of that is the main problem.
    each node has aarity which I could hold as a separate array to be accessed for each object instance of a node
    Part 1:
    The problem is that i have to know which node is connected to which arity element and then I have to search for the free elements and label their indexes with characters. I think I can solve this
    Part 2:
    The second problem is maybe a little worse as I have to translate certain groups graphs to something like this and then connect them to any graph as needed. Will i need to make a separate object for this purpose??
    | ..................| n input wires connected |
    |???????????????????????????????????|
    | Wires maped to edges from graph |
    |___________________________________|
    | ..................| n output wires wires connected |
    Part 3:
    To compound this I have to find a way to implement a menu selector to choose random graphs or parts of graphs for a Genetic Algorithm. Selection is not the problem here its is mapping the structures into a chromosone which is causing me the problem.
    Part 4:
    Each connection has the graphs triggers different application specific rules that cause the graph to reduce or change connections.
    Any help on strategies for these problems would greatly be appreciated
    kind regards
    Prashant

    Hello all and thanks for the replies positive or not. Sorry if I offended you bbritta. I guess its not such and easy question after all.
    Well its not due tomorrow and I am doing some research into a wierd topic so you guys are along the right lines. The topic I am researching is non-determinstic interaction nets. I don't know too many people doing this. Interaction Nets invented by a guy named Yves Lafont and you can google this and the topic I am researching.
    All the code written thus far exists in C and is very hard to interpret as it uses a Lex and Yacc parser to implement the creation of tokens and syntax rules of the Interaction Nets programming language.
    Basically its a high level visual graph programming language however it can also be used on low level based on interpretation. Thus the need for graph data structures. Essentially I have to modify this programming language for non-determinism and demonstrate this in a Genetic Algorithm. The latter would be no problem if I could get the data structure sorted. People familiar with Lamda calculus, Linear Logic and Process Calculus might have seen this in some research papers.
    However I have not had a very good theoretical background so finding the data structures to map the complexity of the graphs is a little problematic. I will outline my idea and what I have done a little clearer below.
    So far I have broken the prob into smaller steps as suggested by someone, I hope the pseudo code helps a little more.
    class Symbol
    convertASCIItoINt( char value) : return int
    getChar() : return char
    checkAvailability() : return boolean;
    //each Symbol is assigned to a free port and is traditionally input.
    //several instances of this obj are used to
    class Port  implements Symbol
      initialisePort( num);
      checkFreePorts( ) : return boolean;
      setPortSymbol (port [num])
      private ports [ num ];
      setEndPortAsSpecial( ports [ num ]) // each node has a special port called principal port
    // each node has a set of port and each port can have a label as a string
    class Node
    setNodeSymbol()
    getnodeSymbol()
    public Port node_obj [ port_num ];
    setSpecialSymbol( string)
      //destructor to delete node connected to
      //duplicator to create a copy of cell value
      //constructor create a copy of the cell
    getSpecialSymbol() : return string symbol;
    checkSpecialSymbol(node_obj [ port_num ]): return string symbol;
    //so far as a typical graph goes i think its acceptable to connect the nodes in an vector with
    //a list at each element although this is not shown below.
    class Net
      connecNodes( node_obj [ port_num], node_obj [ port_num] )
      checkDeadlock(): return boolean; //check for cycles
      public Node net_obj [ node_num ];
      checkConnected( node_obj [ port_num], node_obj [ port_num] ): return boolean;
    //this is where the execution engine will be placed
    class InteractionRules
    ruleTrigger( )
      Node n = new n
      n.checkSpecialSymbol()
      // its here where things get complicated with the data structure as according to the rules I have to delete
      // add or copy a value of a particular node in a Net
      determineReduction()
        //if (ports [ num ] = num )
        // a reduction occurs according to the rule in the method above ruleTrigger();
       //at this point the relevant nodes will be removed and new nodes will be added according to the rules
    storeCopyofOriginalNet()
       //needed to rollback if rules are infeasable or deadlock occurs.
    }I desperately still need help to complete the data structure I have also considered manipulating the complex associations between the sets as multimaps and maps
    Sorry if I am not clear I am trying my best to explain something I have had little background and almost no help in as I am creating the special rules as I go along such as keeping an copy of a net / graph before modifying it in the Genetic Algorithm.
    Kind Regards and Best Wishes
    Prashant

  • FormsGraph PJC getting overlapped with other windows

    Hello,
    We have an application which has a window with 3 graphs (FormsGraph PJCs). If we open any other window on top of the graphs window, the graphs take control of the active window and bleed overtop of the active window. This happens only when the currently opened window is smaller than the graphs windows and if the mouse pointer moves to the partly visible graphs window.
    Can anyone help in resolving this?
    Thanks,
    Ashok

    Nope, 10.6.7 didn't solve the problem.  It still happens.
    It is, however, related in some way to either Juniper Networks VPN sopftware (Network Connect) or Microsoft Remote Desktop Connection.
    This morning when it happened those were the only two things I had open - Safari connected fired off Network Connect and then opened MS Remote Desktop to connect to a remote windows box.
    When I closed both, Safari got stuck in the "background only" mode.
    I will experiment more...

  • Slow scrollbar problem

    Hi guys, I have a problem of slow repaint with scrolling. I have a panel which contains a lot of graphical information. It's dynamically changes its size and may have a width up to 15000 - this is when it gets really slow when I scroll it.
    I was thinking that may be implementing my own ScrollBar will solve the problem, the ScrollBar which will not technically scroll the panel, but by analyzing it's position I will be able to paint only the corresponding part of graph on the screen, and won't have to repaint all of that invisible stuff beyond the screen.
    So I don't know, is it worth trying to do this? And if it is can anybody give me some hints on how to do it? If not, is there any other way to speed it up?
    Thank you, Paulina

    Feri, I'm sorry, I posted the previous message without making some other changes, so at the end the speed was actually improved!
    However, the scrolling worked fine when I applied the changes for the separate panel only. But in my main program I'll have at least 4 of these panels on the screen. I searched the forum and found a code which creates only one scrollbar that will handle the scrolling of all panels simulteniously. In this case, scrolling works fast, but the lines do not get drawn completely, only separate points are drawn. So instead of the line ____________ I see smth like this - - - - -
    Here is the code that I use to make one scrollbar to handle all panels:
    JScrollBar horscrollbar = new JScrollBar(JScrollBar.HORIZONTAL); //scrollbar that will be placed at the bottom of the main window
    JScrollPane[] jsps = new JScrollPane[4]; //creating 4 JScrollPane's , one for each graph
    //scrollbars in those JScrollPane's should not be visible
    int hn = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
    int vn = ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER;
    //making graphs the clients of JScrollPane
    jsps[0] = new JScrollPane(graph, vn, hn);     
    jsps[1] = new JScrollPane(graph2, vn, hn);     
    jsps[2] = new JScrollPane(graph3, vn, hn);     
    jsps[3] = new JScrollPane(graph4, vn, hn);
    //horscrollbar is registered to listen to this event
    public void adjustmentValueChanged(AdjustmentEvent e){
         JScrollBar source = (JScrollBar) e.getSource();
         if(source==horscrollbar){
    //transferring the value of horscrollbar to each invisible horizontal scrollbar in jsps[]
         int adj = e.getValue();     
         for (int x=0; x<4; x++)
              jsps[x].getHorizontalScrollBar().setValue(adj);
         }

  • Crystal dashboard viewer

    Hi, I'm working with SAP Business One and we are looking for a report viewer solution that can run an RPT file or Xcelcius dashboard in fullscreen on an LCD monitor.
    It would need to have auto refresh functionality as well.  We want to show orders in a queue in real time.
    Is there anything out there that can do that?
    Thanks!
    Mike

    Mike,
    Third Wave's Advanced Productivity Pack can provide this functionality.    instead of using a crystal viewer, i would suggest that you use our interactive dashboard with Gold Arrow drill back into B1. 
    APP dashboards use a standard B1 query to display the data.  the dashboard can include graphs and/or data grids,  They can also be setup to auto refresh.  in your example you may just want a data grid that shows the orders.   the sap query would define which columns are included.  
    A dashboard can also be interactive, which means that i can click on a part the graph and the data grid will be updated to show the detail.    for example the graph might show the total amount of orders that needs to ship each day this week.   When i click on the bar for wednesday, the data grid provides a list of the orders that are to ship that day.  the data grid can have drill down arrows back to the transaction, BP, item etc.
    the Advanced Productivity pack does not require additional Crystal Dashboard viewer licenses.  It will also take a significantly less time to setup dashboards with the APP than a CrystalDashboard.   the added benefit is that APP also provide the most comprehensive document/report delivery system available for Business One.  there are  number of other really neat features that it also includes. 
    this will provide a much better option because they can drill back to B1 forms. 
    this video provides a good overview - http://www.youtube.com/watch?v=hlLQQyxL4Us
    additional information can be found at http://www.twbs.com/index.php/solutions/third-wave-products
    Korey
    korey.lind @twbs.comn

  • Mesure période signal carré

    Bonjour,
    Je tiens d’abord à préciser que je  suis un novice en ce qui concerne Labview.
    Je développe une expérience pour la mesure des moments d’inertie. Pour cela, j’ai besoin de mesurer l’accélération angulaire d’une roue. J’ai acheté une « photogate head » qui délivre un signal carré de 5V lorsque la roue tourne ( style encodeur). La période de chaque cycle de ce signal me permettra de calculer la vitesse de rotation de la roue à un instant donné. Le nombre de cycle est limité (i.e. le signa n’est pas continu).  A partir du graph v=f(t), les étudiants pourront calculer l’accélération angulaire.
    J’ai acheté une carte d’acquisition NI-6008.  Avec Labview, j’arrive à acquérir un signal carré analogique provenant d’un générateur  ( avec le VI « lire » DAQmx) et à l’écrire dans un fichier.
    Avec le VI « mesure d’impulsion », j’arrive à mesurer la période et la durée d’impulsion, mais uniquement pour le premier cycle. Ce que je veux c’est mesurer la période pour des cycles allant de n= 1 à N et écrire un fichier (temps, période ou vitesse) afin de calculer l’accélération. J’ai essaye d’utiliser une boucle « For » sur l’entrée « numéro d’impulsion » du VI (mesure impulsion) mais sans succès.
    Que dois-je faire ?
    Est-ce que j’utilise une méthode correcte ou existe-t-il une solution plus simple ?
    Merci pour votre aide

    Bonjour Lou60,
    Grâce à Rodéric, il n'y a plus d'erreur au niveau de votre VI. Toutefois, comme il l'avait signalé auparavant, vous avez un problème de structure. En effet, pour réaliser la mesure N fois, vous devez inclure dans votre boucle for la fonction daqmx read, ceci afin d'acquérir de nouvelles données Je vous envoie un exemple qui doit convenir à votre application.
    Cordialement
    Nb: vous pouvez directement glisser l'image que je vous envoie dans le diagramme de LabVIEW
    Mathieu B
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Forum Aéronautique, Spatial et Défense. Avec la participation exceptionnelle de Bernard DUPRIEU, Res...
    Pièces jointes :
    mesure signal carre.png ‏49 KB

  • Déterminer une ordonnée en fonction d'une abscisse

    Bonjour à tous, 
    comme le titre l'indique, je souhaiterai à partir du graphe que je joint ci-dessous receptionner l'ordonnée correspondant à mon point en abscisse.
    Ma courbe de référence est la courbe blanche. Je voudrais receptionner en continu les valeurs correspondants à mon abscisse. Exemple, je suis à 100 Hz en abscisse il faut que je receptionne 0.25 environ selon la courbe blanche.
    cordialement
    Résolu !
    Accéder à la solution.

    Regarde sur wikipedia...http://fr.wikipedia.org/wiki/Interpolation_num%C3%A9rique
    LabVIEW propose un vi tout prêt, où tu câbles tes vecteurs X et Y, la/les valeur(s) x en entrée et la méthode associée. Tu récupère la/les valeurs y associée(s) au(x) x câblé.
    Dans cet exemple, qui est en fait une multiplication par 100, tu peux voir le fonctionnement. Pense à jeter un coup d'oeil à l'aide.
    Francis M | Voir mon profil
    Certified LabVIEW Developer

  • Tables in Pages 09

    I'm fairly new to Macs, and I'm just starting to get used to Pages. I'm wanting to create a table that has some parts text and some parts pictures/graphs (copied in from elsewhere). I have numerous pictures in one cell, and therefore that one cell is longer than 1 page, but instead of continuing that cell on the next page, Pages hides the part of the cell that is longer than the page, so that it can't be seen. How do I change the settings so that the program will automatically continue the cell/table on a new page when needed?

    Hey there
    Is there seriously no way to flow one cell onto the next page? I've got cells in various tables that I need to flow over pages (yes, I'm in WP mode), as their content is heavy, and to not flow means it's using up reams of paper when it doesn't need to! Word does this automatically! I've spent all day trying to work around this, and I just can't find a way of making this software work with our company needs. In some cases, cell content is longer than an A4 page. It initially rolls the entire cell over to the next page (really annoyingly unnecessary), and then, as it's content becomes longer than the A4 page, it just disappears off the bottom of the page, rendering the information unreadable.
    It seems like such a simple issue. It's so easy to set up a tables to our exacting needs, make them look great etc, but it just doesn't seem to do this most basic of requirement... a ridiculous oversight by Apple???
    Help!

  • Créer une synthèse de séquence tableau/graphe

    Bonjour,
    Alors voilà j'ai creer un vi qui permet d'envoyer des séquences de tests (avec NI-845x protocole SPI) et mon but est de récapituler dans un tableau 2D les trames émises(une case par octet) et en face les trames reçus associées.
    Mon problème est que j'ai une boucle de condition or quand je place mon tableau hors de la boucle le resultat s'affiche un quart de seconde, et je ne peux placer le tableau à l'interieur car je n'aurais pas les résultats de la condition"FAUX" dans mon tableau. 
    Comment faire?
    Ensuite j'aimerais qu'il y ai un graphe derière (j'ai choisis le déroulant) qui affiche les trames émises sur une courbe et les trames reçut sur une autre avec 2 autre courbes correspondant au CS et CLK , en faite ça serait de reproduire l'oscilloscope , et que mes trames soient en binaire.
    Pour celà j'avais pensé
    1)convertir en binaire toutes les cases  de mon tableau 2D
    2)Sur une ligne : mettre les valeurs de toutes les cases les unes après les autres pour mettre la valeur finale dans une case. 
    3) faire ça pour chaque ligne afin d'obtenir un tableau 1D
    puis envoyé ce tableau sur un graphe.
    exemple:
    J'espère etre un peu plus claire avec cet exemple...
    Et même pour faire ça je n'y arrive pas!
    Bon si vous avez de meilleures idées n'hésitez pas !!!
    Merci beaucoup de m'aider parce que je craque !!

    Bonjour,
    mettre deux questions dans un post n'est pas un choix judicieux : on ne sait pas à quoi répondre, et on a un peu l'impression de faire votre travail.
    De plus, poster à la fois dans la partie française (bien) et dans la partie anglaise (pas bien, et encore moins bien en français), ce n'est pas très correct vis a vis de ceux qui vont répondre : cela créera des doublons.
    Ceci étant dit, pour répondre à la première partie de votre question, je pense qu'il faudrait que vous postiez un vi simple (pas l'intégralité de votre projet avec des vi's qui necessitent google earth pour voir le diagramme en entier) qui résume votre problème.;-)
    En faisant cela, il y a de fortes chances pour que vous résolviez votre problème par vous même !
    Cordialement,
    V-F

Maybe you are looking for

  • How to Connect Early 2011 MBP 13" to Apple 20" Cinema Display at 1680x1050?

    My early 2011 MacBookPro will only display 1280x800 on an external Apple 20" Cinema Display. The MBP's specs say that it will support dual displays and video mirroring simultaneously at full native resolution on the built-in display and up to 2560x16

  • Data Inconsistency when activating DSO in BI 7.0

    Hi Guys, We are using BI 7.0, We have an ODS object and 2 IOs in that A & B. When we load data to that DSO it is loaded propery and that 2 IOs data is seen in New Data Table. The real strange thing when we activate that request that 2 IOs data is not

  • Why do i always get the Japanese version of JRE/JDK?

    why do i always get the Japanese version? i am in tokyo and i just want to get the English version of JRE and JDK. Why is it so difficult, I have been trying for the last 8 hours to find mirrors and other versions and installing all of them only to s

  • Adobe Elements 6 will not load

    Several times I have installed, then uninstalled this program for the same reason, namely, it will not load. For a few times after the reinstall, it works okay, then stops. I have gone into "Services" and restarted the "active file monitor" but it do

  • JavaFX Applet only works with Netbeans

    Hello Together, i have a Problem with my JavaFX Applet. All works fine but only if Netbeans start the Browser Applikation or Netbeans is runing in the Background. If i start the Website with the Applet without Netbeans only the JavaFX Icon will schow