cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Translate the entire conversation x

Copy and paste AI-generated formulas

RL_13320206
3-Newcomer

Copy and paste AI-generated formulas

Hello, I have solved some problems and formulas in artificial intelligence: Deepseek and ChatGPT then and converted them to MATHCAD format. There are no errors, they are well written, but Mathcad does not recognize formulas or numbers, it pastes them as text... Is there any way to solve this? Is it possible to use a programming language to use the Gauss Seidel and Newton Raphson methods directly in Mathcad? I have the codes in Python but I want Mathcad to generate the .mcdx document for me...

8 REPLIES 8
Werner_E
25-Diamond I
(To:RL_13320206)

So you're saying that the AI ​​actually generated valid Mathcad code that actually worked correctly without modification after being manually typed in? Did I understand that correctly?

If so, I'd say you were very lucky, because while AIs have already reached a fairly high level of proficiency in programming in common languages ​​like Python or C, this hasn't been the case with proprietary niche syntax like the programming language in Mathcad Prime. We've already had examples posted here in the forum by a user, and the AI's output had little to do with Prime syntax.

 

I suspect that in any case, you'll have no choice but to manually retype the program yourself in Prime, since the AI ​​is supposedly delivering it in plain text form.

 

Of course, it would be possible to reverse engineer the format of a Prime sheet and write a program that creates a correctly formatted Prime worksheet (essentially a zipped directory structure of multiple XML files) from the text-based Mathcad program.

If you actually intend to write such a program, I wish you the best of luck—it's certainly not an easy undertaking and will be time-consuming.

 

Instead of creating a whole XML worksheet, you could program a converter to convert text like

f(x):=sin(x)^2+6

into

(:= (@FUNCTION (@LABEL VARIABLE f) (@ARGS (@LABEL VARIABLE x))) (+ (^ (@APPLY sin (@ARGS x)) 2) 6))

When you create a math region in Prime by typing Ctrl-Shift-M and then copy the above, you will have created a correct Prime function definition:

Werner_E_0-1749350137485.png

Of course automating this process would also require you to reverse engineer to find out the necessary syntax for all possible expressions.

 

(:= (@FUNCTION (@LABEL VARIABLE f) (@ARGS (@LABEL VARIABLE x))) (+ (^ (@APPLY sin (@ARGS x)) 2) 6))

Interesting, really interesting. I think this sample can teach AI how to translate correctly. Thanks.

Hello @RL_13320206,

 

It looks like you have some responses from our community champions. If any of these replies helped you solve your question, please mark the appropriate reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

You wrote: "Is it possible to use a programming language to use the Gauss Seidel and Newton Raphson methods directly in Mathcad?"

Good news is there are two ways to perform each already built into Mathcad Prime you do not need to program them.

1) Gauss Seidel, use lsolve(A,b) or A^-1*b to solve the matrix problem.

2) Use root() function or a solve block to find the root of a function.

 

Perhaps if you upload Mathcad worksheet it is possible to advise further.

 

Cheers

Terry

Hi,

Thought it might be more productive if an example of each is provided.

 

Capture3.JPG

Capture4.jpg

Hello friends, your answers are very interesting, but it's a bit more complex. I'm referring to Gauss-Seidel and Newton-Raphson for electrical power systems. Newton-Raphson for SEP requires finding the Jacobians and matrix iterations.

Werner_E
25-Diamond I
(To:RL_13320206)

I guess you have to decide what your question actually should be all about.

In your initial post you asked

 

1)  it pastes them as text... Is there any way to solve this?

I pointed out a few ways but there is no built-in method to do it. So I guess you are on your own if you intend to write some wort of converted.

BTW, you did not answer my question if your AI actually came up with a working Mathcad code. As you wrote "There are no errors, they are well written" I have to assume that you manually typed them in and they worked as you expected!?

 

2)  Is it possible to use a programming language to use the Gauss Seidel and Newton Raphson methods directly in Mathcad?

Sure. Mathcad had its own programming facilities. Look them up in the help.
Of course you could program algorithms like the ones you mention.

 

3) I have the codes in Python

Sure, the algorithms in question are well known and can be found for various standard programming languages in the net.

Does that mean you're not so happy with the Mathcad code that the AI had to offer?

 

4)  but I want Mathcad to generate the .mcdx document for me...

Not sure what that means. Mathcad won't create a -mcdx document. On the other hand - sure Mathcad creates a .mcdx document when you push "save" - similar to M$ Word creating a .docx document when you choose "save". 😉

 

If you need help in writing a converter from Python to Mathcad/Prime. I guess you will have not much luck here.

 

If you have a certain problem to solve in Prime and need to program the algorithms you mentioned in Prime, I would suggest that you setup a Prime worksheet and start trying to do what you need. And if you get stuck, come back here, explain your problem as good as possible, attach your worksheet and state which version of Prime you are using.

As Terry already said, chances are that Primes built-in numerical algorithms might suffice and you would not need to invent the wheel from anew. Look up the help for solve block with "find", "minerr", "minimize". The algorithms used by Prime usually are based on Levenberg-Marquardt or Conjugate Gradients.

LucMeekes
23-Emerald IV
(To:RL_13320206)
Announcements


Top Tags