I am trying to solve two nonlinear equations self consistently and I have other fourth order algebraic equation. Such equations are important to calculate phase diagram in superconductors in co-existence region. I would like to have a plot of y and z for given x.

I am trying to make following plot.

The blue curve in inset is z(M/Tco) versus x and blue curve in whole figure is y(T/Tco) versus x

My approach is to solve first equation numerically which will give me four gn roots and I need to choose only real positive roots giving me in terms of y and z. For each n I need gn.

Then plugging gn in equation second and third gives me two nonlinear equations in terms of y and z and need to solve self consistently for y and z and sum here is Matsubara sum.

I used NSolve like above then FindRoot but didn’t work out.
NSolve::ratnz: NSolve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.

I am wondering how to get y and z for different x and make a plot, any suggestions with the code would really be appreciable.

In the given code I tried to solve the two non linear coupled rate equations using Odeint subroutine. Odient subroutine is pre-written by someone else. I have written derivs subroutine and main part of the program. The derivs subroutine contains the information of the non-linear ordinary differential equations, given as:

By solving these equation, I am interested to find $T(tau)$. But below given code is giving too many errors. For example

Error: Unclassifiable statement at (1) ode_v3.f90:29:65:

Error: Invalid character in name at (1) ode_v3.f90:2:13:

2 | implicit none
| 1

31 | implicit real*8 (a-h,o-z)
| 2

Error: Two main PROGRAMs at (1) and (2)

Please help me to remove these errors. Any help is highly appreciated. Just want to let you know that I am not much familiar with FORTRAN language and its way of working.

program main
implicit none
double precision T
double precision x1, x2, y0, x !x stands for tau and y(1) for T and y(2) for phi
integer :: n
open(2,file='data.txt',status='unknown')
ystart(1) = 1000.0 ! Initial Temperature T0 = 1000 MeV
ystart(2) = 10.0 ! Initial condition for phi
x1 = 0.07 ! Initial Thermalization time tau_i
x2 = 10 ! Upper limit on, can be read as tau_qgp if T(tau_qgp) = 155 MeV
nvar = 2
write(2,901)
write(2,905)x,y(1)
901 format(4x, 'tau', 4x, 'Temp.',/)
call odeint(ystart,nvar,x1,x2,eps,h1,hmin,nok,nbad,derivs,rkqc)
do n=1,100
2 y(1)=ystart(1)
end do
end
c.............................................................
c subtoutine odeint
c.............................................................
subroutine odeint(ystart,nvar,x1,x2,eps,h1,hmin,nok,nbad,
1 derivs,rkqc)
implicit real*8 (a-h,o-z)
external derivs
external rkqc
parameter (maxstp=10000,nmax=10,two=2.0,zero=0.0,
1 tiny=1.e-30)
common/path/kmax,kount,dxsav,xp(200),yp(10,200)
dimension ystart(nvar),yscal(nmax),y(nmax),dydx(nmax)
x=x1
h=dsign(h1,x2-x1)
nok=0
nbad=0
kount=0
do 11 i=1,nvar
y(i)=ystart(i)
11 continue
if(kmax.gt.0.0)xsav=x-dxsav*two
do 16 nstp=1,maxstp
call derivs(x,y,dydx)
do 12 i=1,nvar
yscal(i)=dabs(y(i))+dabs(h*dydx(i))+tiny
12 continue
if(kmax.gt.0.0)then
if(dabs(x-xsav).gt.dabs(dxsav))then
if(kount.lt.kmax-1)then
kount=kount+1
xp(kount)=x
do 13 i=1,nvar
yp(i,kount)=y(i)
13 continue
xsav=x
endif
endif
endif
if((x+h-x2)*(x+h-x1).gt.zero)h=x2-x
call rkqc(y,dydx,nvar,x,h,eps,yscal,hdid,hnext,derivs)
if(hdid.eq.h)then
nok=nok+1
else
nbad=nbad+1
endif
if((x-x2)*(x2-x1).ge.zero)then
do 14 i=1,nvar
ystart(i)=y(i)
14 continue
if(kmax.ne.0.0)then
kount=kount+1
xp(kount)=x
do 15 i=1,nvar
yp(i,kount)=y(i)
15 continue
endif
return
endif
if(dabs(hnext).lt.hmin)pause 'stepsize smaller than minimum.'
h=hnext
16 continue
pause 'too many step'
return
end
c...................................................................
c subroutine rkqc
c...................................................................
subroutine rkqc(y,dydx,n,x,htry,eps,yscal,hdid,hnext,derivs)
implicit real*8 (a-h,o-z)
parameter (nmax=10,pgrow=-0.20,pshrnk=-0.25,fcor=1./15.,
1 one=1.,safety=0.9,errcon=6.0e-04)
external derivs
dimension y(n),dydx(n),yscal(n),ytemp(nmax),ysav(nmax),
1 dysav(nmax)
xsav=x
do 11 i=1,n
ysav(i)=y(i)
dysav(i)=dydx(i)
11 continue
h=htry
1 hh=0.5*h
call rk4(ysav,dysav,n,xsav,hh,ytemp,derivs)
x=xsav+hh
call derivs(x,ytemp,dydx)
call rk4(ytemp,dydx,n,x,hh,y,derivs)
x=xsav+h
if(x.eq.xsav)pause 'stepsize not significant in rkqc'
call rk4(ysav,dysav,n,xsav,h,ytemp,derivs)
errmax=0.0
do 12 i=1,n
ytemp(i)=y(i)-ytemp(i)
errmax=dmax1(errmax,dabs(ytemp(i)/yscal(i)))
12 continue
errmax=errmax/eps
if(errmax.gt.one)then
h=safety*h*(errmax**pshrnk)
go to 1
else
hdid=h
if(errmax.gt.errcon)then
hnext=safety*h*(errmax**pgrow)
else
hnext=4.0*h
endif
endif
do 13 i=1,n
y(i)=y(i)+ytemp(i)*fcor
13 continue
return
end
c....................................................
c subroutine rk4
c....................................................
subroutine rk4(y,dydx,n,x,h,yout,derivs)
implicit real*8 (a-h,o-z)
external derivs
parameter (nmax=10)
dimension y(n),dydx(n),yout(n),yt(nmax),dyt(nmax),dym(nmax)
hh=h*0.5
h6=h/6.0
xh=x+hh
do 11 i=1,n
yt(i)=y(i)+hh*dydx(i)
11 continue
call derivs(xh,yt,dyt)
do 12 i=1,n
yt(i)=y(i)+hh*dyt(i)
12 continue
call derivs(xh,yt,dym)
do 13 i=1,n
yt(i)=y(i)+h*dym(i)
dym(i)=dyt(i)+dym(i)
13 continue
call derivs(x+h,yt,dyt)
do 14 i=1,n
yout(i)=y(i)+h6*(dydx(i)+dyt(i)+2.0*dym(i))
14 continue
return
end
c--------------------------------------------------------
c SUBROUTINE derivs for coupled rate Equation
c.......................................................
subroutine derivs(x,y,dydx)
implicit real*8 (a-h,o-z)
dimension y(10),dydx(10)
common/root/ct,rms,hc,pi,T0,x1,Tc
pi2=pi*pi
c alphas=6.*pi/((33-2*nf)*dlog(8.*y(2)/Tc)) !coupling for strange parti.
alphas=0.5
alphas2=alphas**2
nf=3 !no. of flavour
a=(32 + (21*nf))*pi2/180 !parameter a
b1=1 + (1.70*nf)
b2=1 + (nf/6)
b3=alphas2*log(alphas**-1)
b=0.342*b1/(b2*b3) !parameter b
c defining first order deriviate of T
c1=y(1)/(3*x)
c2=y(2)*(y(1)**-3)
c3=18*a*x
c4=c2/c3
dydx(1)=-c1+c4 !First order derivative of Temperature --eq12
c defining first order deriviate of phi
d1=2*a*y(1)*y(2)/(3*b)
d2=y(2)/2.
d3=1/x
d4=(5/y(1))*dydx(1)
d5=8*a*(T**4)
d6=9*x
d7=d5/d6
dydx(2)=-d1- d2*(d3-d4) + d7 !First order derivative of Phi --eq13
write(123,*)x,y(2)
write(500,*)x,y(1)
return
end
c.......................................................

Solve is a symbolic solver of algebraic as well as various types of transcendental equations, as the problem at hand, and so we should use exact numbers.

Next we should restrict the domain of y, a natural assumption is y > 0, nevertheless one should also add a bound from above (it is not always necessary). Taking a look at the plot e.g. Plot(f(y), {y, 0, 5}), we should be satisfied with 0 < y < 5, and so Solve
provides an exact solution in terms of the Root object:

This solution can be further transformed symbolically for more detailed purposes.
Using a bound for y we could use NSolve as well without rationalizing inexact coefficients to get a numerical solution, however an exact solution is a full information we can get from given equation.

I want to make a simple program with mips assembly to learn the language. I have the function ax²+bx. The user has to input the a,b and the domain of function.I want to print the values that the function is zero but only the integers of the domain. I thought that the simplest way is to loop all the integers from (x1,x2) and print the values that the function=zero.I get an error “Unknown system call 268501060”.

.data
msg_read_a: .asciiz"dwse arithmo a:"
msg_read_b: .asciiz"dwse arithmo b:"
msg_read_x1: .asciiz"dwse diastima x1:"
msg_read_x2: .asciiz"dwse diastima x2:"
riza: .asciiz"h sunartish mhdenizetai sto: n"
.text
main:
li $v0,4
la $a0,msg_read_a #α
syscall
li $v0,5
syscall
move $t0,$v0
li $v0,4
la $a0,msg_read_b #β
syscall
li $v0,5
syscall
move $t1,$v0
li $v0,4
la $a0,msg_read_x1 #διαστημα χ1
syscall
li $v0,5
syscall
move $t2,$v0
li $v0,4
la $a0,msg_read_x2 #διαστημα χ2
syscall
li $v0,5
syscall
move $t3,$v0
move $t4, $t2 #πρωτο χ για επαναληψη
while:
beq $t4, $t3, exit
mul $t6,$t4,$t4 #x^2
mul $t7,$t0,$t6 #a*x^2
mul $t6,$t1,$t4 #b*x
add $t8, $t7, $t6 #τ8 τελικη τιμη συναρτησης
beq $t8,0,isioi #if(t8=0)
isioi:
li $v0, 1
la $v0, riza
syscall
move $a0, $t8
li $v0, 1
syscall
add $t4, $t4, 1
j while
exit:
li $v0, 10
syscall

How to find the pre-image of the set if this function maps from real numbers to real numbers. What command would I use, to see the pre-image if the function would map from integers to integers.

It is easy to compute with mathematica, but the command to find the pre-image I cannot find.

What I tried, and there are no methods available to solve it:

We have a new special offer for you our valued customers, The offer is titled, “CAPTCHAs.IO’s Private Dedicated API, Reliable Dedicated Private API for faster reCAPTCHA and Image CAPTCHA Solving”.

Your very own reCAPTCHA / CAPTCHA private API CAPTCHA solving access server. With unlimited threads and API calls. This is a dedicated server which we will install latest CapMonster Pro. Running with 20 threads of CapMonster Pro (latest version) with 1 year subscription and could handle 2000 captchas/minute load speed. Supported CAPTCHAs are reCAPTCHAs v2, v3, and invisible with 100,000++ normal image CAPTCHAs.

reCAPTCHA v2, v3 and invisible solving time is 10 to 60 seconds on average, depending on the complexity of reCAPTCHA set in the Google Admin Console for reCAPTCHA. For image CAPTCHAs solving time is 0 to 1 second on average.

Our datacenter is a European colocation datacenter strategically located in the Netherlands, and connected to globally based Points of Presence. Constructed, owned and operated by sister company Greenhouse Datacenters, these Tier 3 designed facilities enable flexible, sustainable, secure and highly connected IT infrastructure deployments. Servers enjoy a connection of 10 Tbit/s global network with only 45% utilization with 10g DDoS protection.

Best of all these servers are genuine hardware and no fake virtual hardware shared, operates fast and stable 24/7/365.

To order please visit https://captchas.io/servers/

I tried this with the Online Wolfram Equation Solver, but it doesn’t even display the formatted equation, even though I’m quite sure it is correct.

I’m not a mathematician, so I have no idea whether solving this equation is hopeless. Any hints as how to approach this problem (in Mathematica or otherwise) are much appreciated; also if it involves simplifying / approximating the solution. I need an analytic solution though.

We are trying to solve numerically a kink solution in matlab using the sine-gordon equation, therefore followed the steps according to the paper (1) listed below. The sine gordon equation is a non-linear pde and the numerical solution was clearly explained in the paper (1). However, the problem is that if we use the initial conditions f(x) and g(x) (page 6 of the paper), the solution will have a disturbance and is not as clean as figure 5.4a (p. 6) from the paper it self. To solve this we ‘doubled’ the size of the soliton by replacing ‘x’ in the initial conditions for ‘x/2’. Therefore my question: What is the explanition that dividing x by 2 instead of taking just x justifies? Perhaps we made a mistake in the numerical model?

Thanks for your time.

Source

The paper used: https://www.uni-muenster.de/imperia/md/content/physik_tp/lectures/ws2016-2017/num_methods_i/sinegordon.pdf

There are a few references from source 1 to chapter 4: https://www.uni-muenster.de/imperia/md/content/physik_tp/lectures/ws2016-2017/num_methods_i/wave.pdf

Matlab code

The changes of the inital conditions are cleary commented in the matlab code.

clear all; clc; close all;
%% Define variables
L = 40; %Choosing a bigger L can make it look nicer, also change it in the function at the bottom of the code
delta_x = 0.05;
delta_t = 0.01;
c = 0.2;
t_end = 90;
T = t_end/delta_t;
M = L/delta_x;
N = M+1;
x = linspace(-L,L,M+1);
t = linspace(0,t_end,T+1);
%end
%% Calculate first time row
u_0 = transpose(f(x));
gamma_1 = transpose(g(x));
beta_1 = sin(u_0);
alpha = delta_t/delta_x;
a = 1-alpha^2;
b = alpha^2/2;
c = b;
A = diag(a*ones(1,N)) + diag(b*ones(N-1,1),1) + diag(c*ones(1,N-1),-1);
A(1,2) = A(1,2) + b;
A(N,M) = A(N,M) + b;
B = 2*A;
%% Calculate second time row
u_1 = delta_t*gamma_1 + A*u_0 - (delta_t^2/2)*beta_1;
u = zeros(N,T);
u(:,1) = u_0;
u(:,2) = u_1;
%% Calculate the full matrix
beta = zeros(N,T);
beta(:,1) = beta_1;
for j = 2:(T)
beta(:,j) = sin(u(:,j));
u(:,j+1) = -u(:,j-1) + B*u(:,j) - (delta_t^2)*beta(:,j);
end
%figure
mesh(x(1:10:end),t(1:10:end),transpose(u(1:10:end,1:10:end)))
xlabel('x')
ylabel('t')
zlabel('u')
for n = 1:T-1
for l = 1:N-1
e(l,n) = (1/2*((u(l,n+1)-u(l,n))/delta_t)^2+1/2*((u(l+1,n+1)-u(l,n+1))/delta_x)*((u(l+1,n)-u(l,n))/delta_x)+(1-cos(u(l,n+1)+1-cos(u(l,n))))/2);
end
E(n) = delta_x*sum(e(:,n));
end
%% Define the functions
% Single soliton
function f = f(x)
c = 0.2; %This can be varied to create a nicer picture, also change it in the 'g'function
L = 20; %This can be varied to create a nicer picture, also change it in the 'g'function
f = 4*atan(exp((x/2)/sqrt(1-c^2))); % the '+L/2' can also be changed to have a different starting point for the soliton, don't forget to also change it in the 'g'function
end
function g = g(x)
c = 0.2;
L = 20;
g = -2*c/sqrt(1-c^2)*sech((x/2)/sqrt(1-c^2));
end