# Items tagged with convertconvert Tagged Items Feed

### Conversion of chemical formulas to string...

September 13 2014
1 1

Hi everyone

Right now I am working on a command that calculates the molar mass of molecules. Mostly it is working like a charm but in some cases the interpretation of the input goes wrong.
The command converts the input to a string, e.g.:

f:=convert(Ca3(PO4)2, string) = "Ca[3](PO[4])[2]"

f := StringTools:-Remove("[]_*^+-", f) = "Ca3(PO4)2"

However, sometimes information such as parentheses is lost (which is understandable considering the fact that maple does not know chemical syntax):

f := convert(NH[3][3]*PO[4], string) = "NH[3][3]*PO[4]"

f := StringTools:-Remove("[]_*^+-", f) = "NH33PO4"

In special cases it goes completely nuts (I am aware this is not a real molecule):

f := convert(Al(OH)2(NH3)2, string) = "Al(#msub(mfenced(mi("OH")),mn("2")))(NH[3])[2]"

The problem could of course simply be solved by typing the input as a string with no subscripts but is looks much nicer with the correct chemical syntax as input.

Do any of you know a way to translate the input charactor by charactor into a (understandable) string?

Thanks in anvance,

### Pixel Conversion...

August 09 2014 Maple 18
3
1

Here is an example of manipulating an Array of pixels. I chose the x-rite ColorChecker as a model so there would be published results to check my work. A number of details about color spaces have become clear through this exercise. The color adaptation process was modeled by converting betweenXYZ and LMS. Different black points may be selected depending on how close to zero illuminance one would accept as a good model.

I look forward to extending this work to verify and improve the color calibration of my photography. Also some experimentation with demosaicing should be possible.

 Initialization

x-rite Colorchecker xyY Matrix

=

=

 Convert xyY to XYZ

=

 XYZ D50 to XYZ D65

=

Convert XYZ to Lab (D50 or D65 White Point)

 Reference White Point for D50  =  =  = Lab Conversion Constants; Reference White Point for D65  =  =  =

=

Convert XYZ to aRGB (XYZ D50 or D65 to aRGB D65)

XYZ Scaling for aRGB Ymax,Ymin (Ref. Adobe RGB (1998) Color Image Encoding Section 4.3.2.2 and 4.3.8)

 White Point (Luminance=160Cd/m^2) D65 Black Point (Luminance=0.5557Cd/m^2) D65 White Point (Luminance=160Cd/m^2) D50 Black Point (Luminance=0.5557Cd/m^2) D50 =  =  = =  =  =

aRGB Expansion for 8bits

Combine Steps

Note: The aRGB values published for ColorChecker assume a black point of 0cd/m^2.

=

=

 Convert XYZ to ProPhoto RGB (D50)

=

 Convert XYZ to sRGB (XYZ D50 or D65 to sRGB D65)

Note: The sRGB values published for ColorChecker assume a black point of 0cd/m^2.

=

=

Corrections to the original version of theis document;
 Make the scaling for a nonzero black point the same for all RGB color spaces.
 Clip negative RGB values to zero.
 Remove the redundant Array container from matrix multiplications.
Use map in place of the $to apply a function to each element of an Array. ### Expand (a+b)^n in binomial expansion form... July 26 2014 1 3 expand( (a+b)^n) convert((a+b)^n,Sum) none expands in binomial form. Is there any way for Maple to generate binomial expansion of (a+b)^n without entering manually. martin ### Vector math and conditional functions... July 17 2014 1 4 Level: Idiot (Me) I have a matrix of 3 columns and lots of rows M • First column is latitude in degrees • Second column is longitude in degrees • Third column is data So I set lambda:=M(..,1) and phi_g:=M(..,2) giving me two column vectors. I want to convert lambda and phi_g to polar coordinates theta and phi theta:=90-lambda produces "Error, (in rtable/Sum) invalid arguments" WHY? I also want to convert phi_g to phi where phi=phi_g when phi_g is 0...180 and phi=phi_g +360 when phi_g <0 How do I create a conditional function like this? ### Vector Field to "normal" function... July 14 2014 1 8 Hello everyone. I have a vector field in 2d-cartesian coordinates which I would like to convert to a "normal" function, that is f(x, y) where when you put x and y in, you get the magnitude of the vector at that point. Example vector field: This one is very hard to handle by hand which is why I want to use Maple for it. I tried VectorCalculus[Norm] but it gave me this: ### convert data readed from text file to array ?... July 12 2014 0 4 i have read data from a text file. i want to convert this data to array,how should i do that ? for example : i have readed these files and i want convert them to array which for the first one,has 3 rows and 4 columns. what should i do ?  > restart:  > FileTools[Text][ReadFile]("NLIST.txt");  (1)  > op(FileTools[Text][ReadFile]("ELIST.txt"));  (2)  > ### Error, (in dsolve/numeric/bvp/convertsys) unable t... June 29 2014 2 3 hi.i encountered this erroe [Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system] with solving set of differential equation.please help me.thanks a lot dsys3 := {1*h1(theta)+1*(diff(h1(theta), theta, theta))+1*(diff(h2(theta), theta))+1*(diff(h2(theta), theta, theta, theta))+1*h3(theta)+1*(diff(h3(theta), theta, theta))+1*(diff(h1(theta), theta, theta, theta, theta)) = 0, 1*h2(theta)+1*(diff(h2(theta), theta, theta, theta, theta))+1*(diff(h2(theta), theta, theta))+1*(diff(h1(theta), theta))+1*(diff(h1(theta), theta, theta, theta))+1*(diff(h3(theta), theta))+1*(diff(h3(theta), theta, theta, theta)) = 0, h3(theta)^5*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+(diff(h3(theta), theta, theta))*h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+(diff(h3(theta), theta, theta, theta, theta))*h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+h1(theta)*h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+(diff(h1(theta), theta, theta))*h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+(diff(h2(theta), theta))*h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+(diff(h2(theta), theta, theta, theta))*h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+h3(theta)^4*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)+h3(theta)^4*(diff(h2(theta), theta, theta, theta, theta, theta, theta))*(1+ln(h3(theta))^2*1+2*ln(h3(theta))*1)-beta*h3(theta)^3*1-chi*ln(h3(theta))^2*1/kappa-chi*1/kappa-2*chi*ln(h3(theta))*1/kappa = 0, h1(0) = 0, h1(1) = 0, h2(0) = 0, h2(1) = 0, h3(0) = 1, h3(1) = 1, ((D@@1)(h1))(0) = 0, ((D@@1)(h1))(1) = 0, ((D@@1)(h2))(0) = 0, ((D@@1)(h2))(1) = 0, ((D@@1)(h3))(0) = 0, ((D@@1)(h3))(1) = 0, ((D@@2)(h3))(0) = 0, ((D@@2)(h3))(1) = 0}; dsol5 := dsolve(dsys3, 'maxmesh' = 600, numeric, output = listprocedure); %; Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system ### convert help of older maple version to 18... June 13 2014 4 3 you can change help of older maple version to 18 by this command: HelpTools:-Database:-ConvertAll(): for example if you download DirectSearch optimization package it's help don't open in maple 18 because in maple 18 .hdb converted to .help and you can do this convert by HelpTools:-Database:-ConvertAll(): DirectSearch version 2 created for maple 13 and i converted it's help to 18. after i typed this command maple 18 wrote: "Converting G:\\Program Files\\Maple 18\\lib\\DirectSearch.hdb to G:\\Program Files\\Maple 18\\lib\\DirectSearch.help" Warning, .hdb help databases are deprecated, 'G:\Program Files\Maple 18\lib\DirectSearch.hdb' will not be used, see ?HelpTools,Migrate help page for more information. and when try again it worked properly and DirectSearch help opened. ### how to convert a ODE/DAE system to a real system... June 04 2014 2 9 I am using Maple 15 to numerically solve a system of differential algebraic euqations (DAE) with given initial conditions, and I've tried rfk45_dae and rosenbrock_dae solver, but both solver responded in error like this Error, (in dsolve/numeric) cannot numerically solve complex DAE initial value problems, the system must be converted to a real system I don't understand what is a real system, and how could i convert it to a real system. ### Units conversion problem... May 09 2014 0 2 This is an addition to the following post: http://www.mapleprimes.com/questions/141795-Unit-Conversion-Problem But I use the clickable facilities of Maple. Here is the problem: >32[[degC]]; 32[[degC]] right-click -> Units -> Replace units -> degF 288 --- [[degF]] 5 >evalf[5]( (2) ); 57.600[[degF]] but if I do that: >convert(32, 'temperature', 'degC', 'degF'); 448 --- 5 >evalf[5]( (4) ); 89.600 Why the conversion is bad when you try to do it by the clickable way???????????? -------------------------------------- Mario Lemelin Maple 18 Ubuntu 13.10 - 64 bitsMaple 18 Win 7 - 64 bits messagerie : mario.lemelin@cgocable.ca téléphone : (819) 376-0987 ### How can I solve Matrix = Matrix ? ... April 25 2014 2 13 I have two 6x1 Matrices which are the results of a calculation process in Maple. One with a set of equations and the other one with a set of variables: A := [0, f(x6), f(x6), 0, 0, f(x6)]; b := [x1, x2, x3, x4, x5, x6]; I'd like to solve the following system: for i from 1 to 6 do eq[i] := A[i] = b[i]: od; which is eq[1] := 0 = x1; eq[2] := f(x6) = x2; eq[3] := f(x6) = x3; ... If I type in the eqations manually, and execute "s := solve({eq[1],..,eq[6]},{x1,..,x6})" everything solves fine. If I use the "for i from..." - structure, and execute "s := solve({eq[1],..,eq[6]},{x1,..,x6})" I get an empty space as solution. I've tried to convert both matrices into lists, but it doesn't work. Could it be that Maple doesnt know that x6 has to be the x6 in the function f(x6) ? Can anyone tell me how to solve this please? ### Error, (in dsolve/numeric/bvp/convertsys) unable t... April 08 2014 0 13 i am trying to solve 6 ODE with boundary condition  (1)  (2)  (3)  (4)  (5)  (6)  (7)  (8)  (9)  (10)  (11)  (12)  (13)  (14)  (15)  (16)  (17)  (18)  (19)  (20)  (1)  (2)  (3)  (4)  (5)  (6)  (7)  (8)  (9)  (10)  (11)  (12)  (13)  (14)  (15)  (16)  (17)  (18)  (19)  (20) then i get this error Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system i dont know where i need to change after view it one by one.. Download hydro.mw ### Maple LaTeX font consistency... April 07 2014 2 4 Dear Mapleprimes, I have been struggling with a problem in the last couple of days. I wish to export a Maple plot to LaTeX while ensuring font consistency. While searching for solutions online, I found the psfrag package in LaTeX. So far, however, I have been unsuccesful in making this work. As as test, I attempted to export plot(x^2) to LaTeX. I used the following code to convert to .eps which worked fine: plotsetup(ps, plotoutput = plot1.eps, plotoptions = portrait, noborder,height=5in,width=5in);plot(x^2); Then in LaTeX, I have: \documentclass{article} \usepackage{graphicx} \usepackage{psfrag} \begin{document} \begin{figure}[!h] \centering \psfrag{x}{$ \alpha \$}
\includegraphics[scale=0.5]{plot1.eps}
\end{figure}
\end{document}

However, no replacements are made. After intense Google searching I found the following post http://www.mapleprimes.com/posts/43255-Trouble-Replacing-Maple-Axes-Labels which to sum up argues that this was only possible with earlier versions of Maple.

Does anyone know if the problem has been resolved?

Does anyone know any other ways to ensure font consistency for plots imported from Maple to LaTeX?

Thank you very much in advance!

C

### printf for list 0 format conversion help...

March 13 2014
0 3

Hi all,

Say I have some list like this,

tmp:=[[0, 0, 1], [0, 1, 0], [0, 1, 1], [0, 1, 2], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 0]];

And I have worked out some probabilities for each of them, a,b,c,d, ect.

I want to print them like this

Pr( 001 ) = 1

Pr( 010 ) = 1-phi[2]+phi[2]*(1-p[3])*(1-phi[3])

Pr( 011 ) = phi[2]*p[3]*(1-phi[3])

and so on.

I there a way to do that?

The probabilities can be extracted from a Vector. I have no problem to print them.

I dont know how to convert the 0,1,2 into the desired format as shown above.

This is the best I can do.

Also, is it possible to convert all the subscripte [] to _ when printing the output?

and get ride of all * as well.

Thanks,

casperyc

### convert 2nd order ODE to system of First ODE ...

March 09 2014
1 2

Dear all;

Please Have some one an idea to transform or convert 2nd order ODE to system of First ODE ( of course using maple).

Thanks

 3 4 5 6 7 8 9 Last Page 5 of 41
﻿