Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi MaplePrimes, 

I am interested in obtaining some gravitational field equations from an action using the FunDiff command. I have been able to write what I think is a pretty short and quick worksheet(with an arbitrary metric) and I am easily able to obtain the Einstein Field Equations. However, when I introduce some new more complicated terms into the action and apply the Simplify command maple does not appear to be able to evaluate and I end up halting the computation. When I specify a metric Maple, for example Schwarzschild, Maple will easily be able to Simplify my expression but it will use metric components during the process. Where what I am interested in is just the Tensor expression with respective indices. 

I was wondering if anyone had any thoughts on how I could resolve this. 

I have attached the worksheet that I am working with. I look forward to your thoughts/comments.

Thank you.  

ActionFieldEquations.mw

If we use, for example, pointplot3d with an mx3 matrix we get a 3d plot. I can click on the plot and choose the lighting. But how do we do that with code?

Maple continuously shows 'Evaluating' and there is no output. How to fix it?

restart

with(LinearAlgebra)

assume(x::real); assume(t::real); assume(`α__1`::real); assume(`α__2`::real); assume(nu::real)

A2s := Matrix([[H__11*exp(I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__13*exp(I*v__21)/(`λ__1`-conjugate(`λ__2`))+1, H__12*exp(-I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__14*exp(-I*v__21)/(`λ__1`-conjugate(`λ__2`)), H__11*exp(I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__13*exp(I*v__22)/(`λ__2`-conjugate(`λ__2`)), H__12*exp(-I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__14*exp(-I*v__22)/(`λ__2`-conjugate(`λ__2`))], [H__12*exp(I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__14*exp(I*v__21)/(`λ__1`-conjugate(`λ__2`)), 1+H__11*exp(-I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__13*exp(-I*v__21)/(`λ__1`-conjugate(`λ__2`)), H__12*exp(I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__14*exp(I*v__22)/(`λ__2`-conjugate(`λ__2`)), H__11*exp(-I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__13*exp(-I*v__22)/(`λ__2`-conjugate(`λ__2`))], [H__13*exp(I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__33*exp(I*v__21)/(`λ__1`-conjugate(`λ__2`)), H__14*exp(-I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__34*exp(-I*v__21)/(`λ__1`-conjugate(`λ__2`)), 1+H__13*exp(I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__33*exp(I*v__22)/(`λ__2`-conjugate(`λ__2`)), H__14*exp(-I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__34*exp(-I*v__22)/(`λ__2`-conjugate(`λ__2`))], [H__14*exp(I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__34*exp(I*v__21)/(`λ__1`-conjugate(`λ__2`)), H__13*exp(-I*v__11)/(`λ__1`-conjugate(`λ__1`))+H__33*exp(-I*v__21)/(`λ__1`-conjugate(`λ__2`)), H__14*exp(I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__34*exp(I*v__22)/(`λ__2`-conjugate(`λ__2`)), H__13*exp(-I*v__12)/(`λ__2`-conjugate(`λ__1`))+H__33*exp(-I*v__22)/(`λ__2`-conjugate(`λ__2`))+1]])

Matrix(%id = 36893490803012390908)

(1)

vvalue := {v__11 = (conjugate(`λ__1`)-`#msub(mi("λ",fontstyle = "normal"),mn("1"))`)*x+(4*`α__1`*(conjugate(`λ__1`)^3-`λ__1`^3)+2*`α__2`*(conjugate(`λ__1`)^2-`λ__1`^2)-8*nu*(conjugate(`λ__1`)^4-`λ__1`^4))*t, v__12 = (conjugate(`λ__1`)-`#msub(mi("λ",fontstyle = "normal"),mn("2"))`)*x+(4*`α__1`*(conjugate(`λ__1`)^3-`λ__2`^3)+2*`α__2`*(conjugate(`λ__1`)^2-`λ__2`^2)-8*nu*(conjugate(`λ__1`)^4-`λ__2`^4))*t, v__21 = (conjugate(`λ__2`)-`#msub(mi("λ",fontstyle = "normal"),mn("1"))`)*x+(4*`α__1`*(conjugate(`λ__2`)^3-`λ__1`^3)+2*`α__2`*(conjugate(`λ__2`)^2-`λ__1`^2)-8*nu*(conjugate(`λ__2`)^4-`λ__1`^4))*t, v__22 = (conjugate(`λ__2`)-`#msub(mi("λ",fontstyle = "normal"),mn("2"))`)*x+(4*`α__1`*(conjugate(`λ__2`)^3-`λ__2`^3)+2*`α__2`*(conjugate(`λ__2`)^2-`λ__2`^2)-8*nu*(conjugate(`λ__2`)^4-`λ__2`^4))*t}

{v__11 = (conjugate(lambda__1)-`#msub(mi("λ",fontstyle = "normal"),mn("1"))`)*x+(4*alpha__1*(conjugate(lambda__1)^3-lambda__1^3)+2*alpha__2*(conjugate(lambda__1)^2-lambda__1^2)-8*nu*(conjugate(lambda__1)^4-lambda__1^4))*t, v__12 = (conjugate(lambda__1)-`#msub(mi("λ",fontstyle = "normal"),mn("2"))`)*x+(4*alpha__1*(conjugate(lambda__1)^3-lambda__2^3)+2*alpha__2*(conjugate(lambda__1)^2-lambda__2^2)-8*nu*(conjugate(lambda__1)^4-lambda__2^4))*t, v__21 = (conjugate(lambda__2)-`#msub(mi("λ",fontstyle = "normal"),mn("1"))`)*x+(4*alpha__1*(conjugate(lambda__2)^3-lambda__1^3)+2*alpha__2*(conjugate(lambda__2)^2-lambda__1^2)-8*nu*(conjugate(lambda__2)^4-lambda__1^4))*t, v__22 = (conjugate(lambda__2)-`#msub(mi("λ",fontstyle = "normal"),mn("2"))`)*x+(4*alpha__1*(conjugate(lambda__2)^3-lambda__2^3)+2*alpha__2*(conjugate(lambda__2)^2-lambda__2^2)-8*nu*(conjugate(lambda__2)^4-lambda__2^4))*t}

(2)

NULL

A2s2 := Determinant(A2s); dets22 := simplify(A2s2, size); length(%)

8949

(3)

dets22f := simplify(subs(vvalue, dets22))

NULL

Download sol1det.mw

Hello. I work with vector fields and 1-forms with the package DifferentialGeometry. I need to copy the output in a latex file, but when I use copy paste what I get is the internal representation of the 1-forms, for example, something like

_DG([[\"form\", M, 1], [[[1], x2/x4], [[2], -1]]])

But what I need is something like:

x2/x4 dx1-(`*`(dx2))

which is what I see at the screen. I have tried lot of commands but I don't get what I want.

Here is the basic code:

restart;

with(DifferentialGeometry);

with(JetCalculus);

DGsetup([x1, x2, x3], M);

w:=evalDG(x2/x4 dx1-dx2)

I'm using Maple 2022.  I'm using fsolve to solve for values of 3 variables and I've created a function that looks like 

solution := (TtT, FtT) -> fsolve({eq1, eq2, eq3},{Y,P,PY},{Y=0..100,P=0..100,PY=0..100})

this works fine, giving answers like

solution(1, 0.5);
    {P = 0.1813175442, PY = 0.1593412279, Y = 0.4393982627}

I'd like to plot Y vs TtT at a fixed FtT of 0.5 so I defined a second function

YFtpt5 := TtT -> solution(TtT, 0.5)[3]

this also works fine, giving

YFtpt5(10);
                       Y = 0.02320766980

so I try to plot it with a range variable like this

with plots:

plot(YFtpt5,0.01..10)

but this gives the error 

plot(YFtpt5, 0.01 .. 10);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

It draws axis but no plot.  I've evaluated the function at 0.01,10, and a number of points in between and everything I've tried gives a numeric answer.  Is it because the answer is "Y=0.43"  or something else.  

Help, have no idea what to do.

Obtain a finite topological space from a dynamical system specified as a system of ODEs, by writing Maple code for following steps (use Maple packages DynamicSytems and GraphTheory, preferablly):

  1. Visualize the phase space of the system by plotting solution curves for different initial conditions.

  2. Consider a finite region of the phase space.

  3. Define a finite grid of points in the region.

  4. Define a topology on the grid points based on their connectivity.

  5. Give some useful information regarding the dynamical system in terms of topological properties.

Article https://mapleprimes.com/posts/208409-Downloading-Historical-Stock-Quotes has worked well for the last few years.

Somewhere in the last 6 months Yahoo has changed the method. Crumbstore no longer exists within the page source.

Does anyone have a method that currently works.

Problem is also verified at: https://www.solveforum.com/forums/threads/solved-yahoo-finance-cookie-and-crumb-not-working.2316600/ ,however they do not have a solution.

I want an example worksheet to open as a worksheet rather than a help page when I'm building help pages for a package. For instance, opening a worksheet instead of a help page is the result of clicking the "Package Overview help page template" hyperlink on the "Templates" help page. The mouseover of the hyperlink suggests it was saved as a help page rather than a worksheet, most likely in a help database. Although I can see the active=true option in INTERFACE HELP, I'm not sure how to convert my spreadsheet to this format without losing the formatting styles. It would make sense to have an option under "save to database" or an active=true option for makehelp, but these do not appear to exist. Any recommendations? Thanks, David.

Dear all,

consider two lists of complex values :

list1 := [l1,l2,l3,l4,l5]

list2 := [s1,s2,s3,s4,s5].

There is a set of second order differential equation

d^2u(k)/dt^2+I*A*du/dt-B*u=0

where A is sum of elements of list1 and list2 and B is multiplication of their element. Therefore,

d^2u[1](k)/dt^2+I*(l1+s1)*du[1]/dt-(l1*s1)*u[1]=0

d^2u[2](k)/dt^2+I*(l2+s2)*du[2]/dt-(l2*s2)*u[2]=0

d^2u[3](k)/dt^2+I*(l3+s3)*du[3]/dt-(l3*s3)*u[3]=0

d^2u[4](k)/dt^2+I*(l4+s4)*du[4]/dt-(l4*s4)*u[4]=0

d^2u[5](k)/dt^2+I*(l5+s5)*du[5]/dt-(l5*s5)*u[5]=0

How can I create a set of differential equations and initial conditions based on nops(list1), then solve this system of differential equations numerically in Maple.

since u[i] are function of k, next step is to transforme them to real space by inverse fourier transform.

finally save the results and plot them.

Note that for simplisity I wrote a linear equation but it is not. so, because of nonlinear terms it is not possible to use superposition of the solution. I have to take them as coupled system of equations.

====

for example

list1 := [ [0., -5.496799068*10^(-15)-0.*I], [.1, 5.201897725*10^(-16)-1.188994754*I], [.2, 6.924043163*10^(-17)-4.747763855*I], [.3, 2.297497722*10^(-17)-10.66272177*I], [.4, 1.159126178*10^(-17)-18.96299588*I] ] 

list2 :=[ [0., -8.634351786*10^(-7)-67.81404036*I], [.1, -0.7387644021e-5-67.76491234*I], [.2, -0.1433025271e-4-67.59922295*I], [.3, -0.2231598645e-4-67.25152449*I], [.4, -0.3280855430e-4-66.56357035*I] ]

where first element is k and the second value is l_i and s_i

the differential equation is

ode_u[i]:= diff(u[i](t),t$2)+I*(list1[i][2]+list2[i][2])*diff(u[i](t),t)-list1[1][2]*list2[2][2]*u[i](t)=0;

eta is in fourier space where k values are in list1[i][1].

We laso know that f(-k)= - f*(k) where f=list[i][2]

and u[i] as function of k, initially has a Gaussian shape at t=0 in fourier space..

Thanks in advance for your help

Anyone out there converted the  nyqlog at MATLAB/nyqlog.m at master · nielsSkov/MATLAB · GitHub  to Maple or Maple Flow? For Nyquist plots...

Recently, ChatGpt has gained a lot of attention and there are mixed reviews about it. Some people think highly of its capabilities, while others are more critical. Regardless, it has been an interesting  topic on assistant programming.

I'm going to give two examples to illustrate what's interesting and what's lacking.

First, I want ChatGpt to write a Maple code for the enumeration of all prime numbers up to 100. Then it writes:

primes:= proc(n)
   local i, j, primes;
   primes:= [2];
   for i from 3 to n do
      for j from 2 to i-1 do
         if i mod j = 0 then break;
      end do;
      if j = i then primes:= [op(primes), i]; end if;
   end do;
   return primes;
end proc;

primes(100);

I copy and paste this code, maple shows an error: Error, reserved word `do` unexpected

I report the error to it:

this code cannot run since "Error, reserved word `do` unexpected"

Then it gives: I apologize for the error in the previous code. Here is a corrected version of the code that can be run in Maple:

primes:= proc(n)
   local i, j, primesList;
   primesList:= [2];
   for i from 3 to n do
      for j from 2 to i-1 do
         if i mod j = 0 then 
            break;
         end if;
      end do;
      if j = i then 
         primesList:= [op(primesList), i]; 
      end if;
   end do;
   return primesList;
end proc;

primes(100);

Ok, It's tediously written code, but at least it's correct. 

Furthermore, I ask:

Is there a more concise approach that utilizes maple's built-in functions.

It tells me:

Yes, there is a more concise approach that utilizes Maple's built-in functions. Here's an example:

primes := [seq(i, i=2..100)]; primes := [op(select(isprime, primes))];

The seq function generates a list of numbers from 2 to 100. The select function filters out all non-prime numbers using the isprime function, which tests the primality of a number. The result is stored in the primes array.

Ok, this answer meets my expectations.

 

Another example is the generation of all 6th order non-isomorphic graphs, which pops up as:

# Load the GraphTheory package
with(GraphTheory):

# Generate a list of all non-isomorphic graphs with 6 vertices
graphs := NonIsomorphicGraphs(6):

# Print the list of non-isomorphic graphs
print(graphs);

But NonIsomorphicGraphs(6) as we know is the number  of non-isomorphic graphs but  not graphs  themselves.

 

So I say:

in the above codes, NonIsomorphicGraphs need the options output = graphs, outputform = graph

ChatGpt gives :

Here is a revised version of the code that takes into account the options output = graphs and outputform = graph:

 

# Load the GraphTheory package
with(GraphTheory):

# Generate a list of all non-isomorphic graphs with 6 vertices
graphsList := NonIsomorphicGraphs(6, output = graphs, outputform = graph):

# Print the number of non-isomorphic graphs
print("Number of non-isomorphic graphs: ", nops(graphsList));

# Print each non-isomorphic graph in the list
for i in 1 to nops(graphsList) do
  print("Graph ", i, ": ", graphsList[i]);
end do

It still has syntax errors. I made some artificial adjustments.

# Load the GraphTheory package
with(GraphTheory):

# Generate a list of all non-isomorphic graphs with 6 vertices
graphsList := [NonIsomorphicGraphs(6, output = graphs, outputform = graph)]:

# Print the number of non-isomorphic graphs
print("Number of non-isomorphic graphs: ", nops(graphsList));

# Print each non-isomorphic graph in the list
for i from 1 to nops(graphsList) do
  print("Graph ", i, ": ", graphsList[i]);
end do;

I pulled a wry face when  it builds a lot of codes  that do not exist in Maple.. Here's a little tidbit of my conversation with it.

This software still needs more work. I'm not sure how far it can go, but maybe programming becomes easier. Maybe more interesting examples will be found.

Hello everyone ! 

I am completely new to using math solving applications like maple.

I was introduced to it in my university course and since then I found it very helpful in solving 2nd degree differential equations and integrals.

However, i don't have any intuition for programming, so i found the commands of maple very confusing.

The last couple of weeks, I have been completely destroyed by a problem I've recently encountered...

I was given a bunch of (x,y) coordinates of a function and i was told that the function in question is a polynomial of a 3rd degree.

So my question is, can maple help me in solving this type of problems or no ?!?!?!

And if yes, can someone give me a general direction in which i have to go ?

Also, I was told that this problem can be solved in Excel ?

Thank you all in adavce ! 

Looking for the solution of this a non linear system y = x^2 + 2*x - 3 ,  y = x^3 + 3*x^2 - 4*x - 8 (The system has 3 real solutions A = (-3.35, 1.51)    B = (-0.72, -3.92)  C = (2.07, 5.42) ).

i have tried to solve it as follows:

eq1 := x^2 + 2*x - 3

eq2 := x^3 + 3*x^2 - 4*x - 8

fsolve({eq1 = eq2})

I get 

   {x = -3.346462190}, {x = -0.7222456338}, {x = 2.068707823}

That is what i expected.
 

But if i try to use solve and then evalf i find three complex solutions.

solution := solve({eq1 = eq2}, explicit)

evalf(%);
      
  { x = 2.068707824 - 4x10^(-10)   I },     { x = -3.346462190 - 7.660254040 x10^(-10)    I },   { x = -0.722245634 + 9.660254040x10^(-10)    I }
    

Why ? I don't understand.

Moreover, solving the equations as follows:
sys1 := y = x^2 + 2*x - 3;
sys2 := y = x^3 + 3*x^2 - 4*x - 8;

fsolve({sys1, sys2}, {x, y})

yeld just one solution:

               {x = 2.068707823, y = 5.416967705}

Someone can explain me this behaviour ?

Dear Users,

I hope everyone here is fine. I want to extract dat file from the attached contour plot file. Please help me to resolve this issue. Many thanks in advance

Dat_file.mw

restart:
PDEtools[declare](f(x), prime = x):
PDEtools[declare](Theta(x), prime = x):
PDEtools[declare](Phi(x), prime = x):
N := 4; M := .1; Kp := .1; Gr := 0.1e-1; Gc := 0.1e-1; Pr := 1; S := 0.1e-1; Sc := .78; Kc := 0.1e-1; La := 1
f (x):=  sum((p^(i))*f [i] (x), i = 0 .. N) ;
Theta(x):=  sum((p^(i))*Theta[i] (x), i = 0 .. N) ;
Phi(x):= sum((p^(i))*Phi [i] (x), i = 0 .. N);
HPMEq1 := (1-p)*(diff(f(x), x, x, x))+p*(diff(f(x), x, x, x)+(1/2)*(diff(f(x), x, x))*f(x)-(M^2+Kp)*(diff(f(x), x)-La)+Gr*Theta(x)+Gc*Phi(x))
HPMEq2 := (1-p)*(diff(Theta(x), x, x))/Pr+p*((diff(Theta(x), x, x))/Pr+(1/2)*(diff(Theta(x), x))*f(x)+S*Theta(x))
HPMEq3 := (1-p)*(diff(Phi(x), x, x))/Sc+p*((diff(Phi(x), x, x))/Sc+(1/2)*(diff(Phi(x), x))*f(x)+Kc*Phi(x))
for i from 0 to N do equ[1][i] := coeff(HPMEq1, p, i) = 0 end do
for i from 0 to N do equ[1][i] := coeff(HPMEq2, p, i) = 0 end do
for i from 0 to N do equ[1][i] := coeff(HPMEq3, p, i) = 0 end do
cond[1][0] := f[0](0) = 0, (D(f[0]))(0) = 0, Theta[0](0) = 1, Phi[0](0) = 1, Theta[0](5) = 0, Phi[0](5) = 0, (D(f[0]))(5) = 1; for j to N do cond[1][j] := f[j](0) = 0, (D(f[j]))(0) = 0, Theta[j](0) = 0, Phi[j](0) = 0, Theta[j](5) = 0, Phi[j](5) = 0, (D(f[j]))(5) = 0 end do
for i from 0 to N do pdsolve({cond[1][i], equ[1][i]}, f[i](x)); f[i](x) := rhs(%) end do
f(x) := evalf(simplify(sum(f[n](x), n = 0 .. N))); convert(f(x), 'rational'); subs(x = 1, diff(f(x), x))

Please rectify the error
Thank you

First 235 236 237 238 239 240 241 Last Page 237 of 2218